Skip to content

Commit

Permalink
Make webidl conversions work with multiple categories
Browse files Browse the repository at this point in the history
Since all generated js files are so interdependent on each other, splitting them into folders according to their category screws up all relative paths between each other.

Instead, we'll put all generated js files into a single folder and split .idl and -impl files according to their category, which works fine.
  • Loading branch information
Sebastian Mayr committed Nov 19, 2015
1 parent 9874bfb commit 2eac87e
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 20 deletions.
4 changes: 0 additions & 4 deletions .eslintignore
Expand Up @@ -20,10 +20,6 @@ lib/jsdom/level3/xpath.js

lib/jsdom/living/generated/**

# Buggy: https://github.com/eslint/eslint/issues/3707
#!lib/jsdom/living/generated/**/*-impl.js
# Compensated in package.json

test/browser/files
test/browser/index.js
test/jquery-fixtures
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -9,4 +9,3 @@ npm-debug.log
benchmark/browser-bundle.js

lib/jsdom/living/generated/**/*.js
!lib/jsdom/living/generated/**/*-impl.js
1 change: 0 additions & 1 deletion .jscsrc
Expand Up @@ -50,7 +50,6 @@
"lib/jsdom/level3/ls.js",
"lib/jsdom/level3/xpath.js",
"lib/jsdom/living/generated/**",
"!lib/jsdom/living/generated/**/*-impl.js",
"test/browser/files",
"test/browser/index.js",
"test/jquery-fixtures",
Expand Down
4 changes: 2 additions & 2 deletions lib/jsdom/browser/Window.js
Expand Up @@ -6,14 +6,14 @@ const History = require("./history");
const VirtualConsole = require("../virtual-console");
const define = require("../utils").define;
const inherits = require("../utils").inheritFrom;
const EventTarget = require("../living/generated/events/EventTarget");
const EventTarget = require("../living/generated/EventTarget");
const namedPropertiesWindow = require("../living/named-properties-window");
const cssom = require("cssom");
const postMessage = require("../living/post-message");
const DOMException = require("../web-idl/DOMException");
const btoa = require("abab").btoa;
const atob = require("abab").atob;
const idlUtils = require("../living/generated/util");
const idlUtils = require("../living/generated/utils");
const internalConstants = require("../living/helpers/internal-constants");
const createFileReader = require("../living/file-reader");
const createXMLHttpRequest = require("../living/xmlhttprequest");
Expand Down
2 changes: 1 addition & 1 deletion lib/jsdom/level1/core.js
Expand Up @@ -11,7 +11,7 @@ var HtmlToDom = require("../browser/htmltodom").HtmlToDom;
var Location = require("../browser/location");
var vm = require("vm");
var CookieJar = require('tough-cookie').CookieJar;
var EventTarget = require("../living/generated/events/EventTarget");
var EventTarget = require("../living/generated/EventTarget");
var attributes = require("../living/attributes");
var mapper = require("../utils").mapper;
var clone = require("../living/node").clone;
Expand Down
2 changes: 1 addition & 1 deletion lib/jsdom/level2/events.js
Expand Up @@ -181,7 +181,7 @@ inheritFrom(core.Event, core.MutationEvent, {
REMOVAL : 3
});

core.EventTarget = require('../living/generated/events/EventTarget').interface;
core.EventTarget = require('../living/generated/EventTarget').interface;

// Reinherit class heirarchy with EventTarget at its root
inheritFrom(core.EventTarget, core.Node, core.Node.prototype);
Expand Down
@@ -1,8 +1,8 @@
"use strict";
const DOMException = require("../../../web-idl/DOMException");
const reportException = require("../../helpers/runtime-script-errors");
const domSymbolTree = require("../../helpers/internal-constants").domSymbolTree;
const idlUtils = require("../util");
const DOMException = require("../../web-idl/DOMException");
const reportException = require("../helpers/runtime-script-errors");
const domSymbolTree = require("../helpers/internal-constants").domSymbolTree;
const idlUtils = require("../generated/utils");

class EventTargetImpl {
constructor() {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/jsdom/living/file-reader.js
@@ -1,7 +1,7 @@
"use strict";

const DOMException = require("../web-idl/DOMException");
const EventTarget = require("./generated/events/EventTarget");
const EventTarget = require("./generated/EventTarget");
const addConstants = require("../utils").addConstants;
const blobSymbols = require("./blob-symbols");

Expand Down
Empty file.
2 changes: 1 addition & 1 deletion lib/jsdom/living/xmlhttprequest-event-target.js
@@ -1,6 +1,6 @@
"use strict";

const EventTarget = require("./generated/events/EventTarget");
const EventTarget = require("./generated/EventTarget");

function XMLHttpRequestEventTarget() {
if (!(this instanceof XMLHttpRequestEventTarget)) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -62,7 +62,7 @@
"pretest": "npm run convert-idl && git submodule update --init --recursive",
"test": "node ./test/runner",
"test-browser": "node ./test/browser-runner",
"lint": "jscs lib/ && jscs test/ && eslint . && eslint --no-ignore lib/jsdom/living/generated/**/*-impl.js && eslint test/web-platform-tests/to-upstream --ext .html",
"lint": "jscs lib/ && jscs test/ && eslint . && eslint test/web-platform-tests/to-upstream --ext .html",
"update-authors": "git log --format=\"%aN <%aE>\" | sort -f | uniq > AUTHORS.txt",
"benchmark": "node ./benchmark/runner",
"benchmark-browser": "node ./benchmark/runner --bundle",
Expand Down
6 changes: 3 additions & 3 deletions scripts/webidl/convert.js
Expand Up @@ -5,7 +5,7 @@ const Q = require("q");
const readdirRecursive = require("fs-readdir-recursive");
const webidl2js = require("webidl2js");

const outputDir = "lib/jsdom/living/generated/";
const outputDir = path.resolve(__dirname, "../../lib/jsdom/living/generated/");

function readConcatenatedSource(files) {
return Q.all(files.map(f => {
Expand Down Expand Up @@ -38,12 +38,12 @@ function doConversion(inputPath) {
.then(readConcatenatedSource)
.then(src => {
const folder = isDir ? inputPath : path.dirname(inputPath);
generateClasses(src, path.relative(outputDir, folder));
generateClasses(src, folder);
});
}

function onlyIDL(filePath) {
return path.extname(filePath) === ".idl";
}

doConversion("lib/jsdom/living/generated/events").done();
doConversion(path.resolve(__dirname, "../../lib/jsdom/living/events")).done();

0 comments on commit 2eac87e

Please sign in to comment.