@qooxdoo/framework 7.1.0 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/Manifest.json +22 -22
  3. package/lib/compiler/compile-info.json +83 -83
  4. package/lib/compiler/index.js +422 -356
  5. package/lib/resource/qx/tool/cli/templates/loader/loader-browser.tmpl.js +1 -2
  6. package/lib/resource/qx/tool/schema/compile-1-0-0.json +11 -1
  7. package/npm-shrinkwrap.json +11471 -562
  8. package/package.json +4 -3
  9. package/source/class/qx/event/handler/Focus.js +1 -1
  10. package/source/class/qx/theme/iconfont/LoadMaterialIcons.js +4 -4
  11. package/source/class/qx/theme/iconfont/LoadMaterialIconsOutlined.js +4 -4
  12. package/source/class/qx/theme/iconfont/LoadMaterialIconsRound.js +4 -4
  13. package/source/class/qx/theme/iconfont/LoadMaterialIconsSharp.js +4 -4
  14. package/source/class/qx/theme/iconfont/LoadMaterialIconsTwoTone.js +4 -4
  15. package/source/class/qx/theme/tangible/ColorEngine.js +3 -3
  16. package/source/class/qx/theme/tangible/Decoration.js +3 -3
  17. package/source/class/qx/tool/cli/commands/Compile.js +10 -2
  18. package/source/class/qx/tool/cli/commands/Lint.js +14 -13
  19. package/source/class/qx/tool/compiler/Es6ify.js +7 -4
  20. package/source/class/qx/tool/compiler/app/Application.js +14 -0
  21. package/source/class/qx/tool/compiler/targets/Target.js +6 -5
  22. package/source/class/qx/tool/compiler/targets/meta/Browserify.js +73 -31
  23. package/source/class/qx/tool/utils/Json.js +1 -1
  24. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v126.eot +0 -0
  25. package/source/resource/qx/iconfont/MaterialIcons/{materialicons-v70.ttf → materialicons-v126.ttf} +0 -0
  26. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v126.woff +0 -0
  27. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v126.woff2 +0 -0
  28. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v101.eot +0 -0
  29. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v101.otf +0 -0
  30. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v101.woff +0 -0
  31. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v101.woff2 +0 -0
  32. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v100.eot +0 -0
  33. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v100.otf +0 -0
  34. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v100.woff +0 -0
  35. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v100.woff2 +0 -0
  36. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v101.eot +0 -0
  37. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v101.otf +0 -0
  38. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v101.woff +0 -0
  39. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v101.woff2 +0 -0
  40. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v104.eot +0 -0
  41. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v104.otf +0 -0
  42. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v104.woff +0 -0
  43. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v104.woff2 +0 -0
  44. package/source/resource/qx/tool/cli/templates/loader/loader-browser.tmpl.js +1 -2
  45. package/source/resource/qx/tool/schema/compile-1-0-0.json +11 -1
  46. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v70.eot +0 -0
  47. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v70.woff +0 -0
  48. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v70.woff2 +0 -0
  49. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v38.eot +0 -0
  50. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v38.otf +0 -0
  51. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v38.woff +0 -0
  52. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v38.woff2 +0 -0
  53. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v37.eot +0 -0
  54. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v37.otf +0 -0
  55. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v37.woff +0 -0
  56. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v37.woff2 +0 -0
  57. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v38.eot +0 -0
  58. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v38.otf +0 -0
  59. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v38.woff +0 -0
  60. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v38.woff2 +0 -0
  61. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v36.eot +0 -0
  62. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v36.otf +0 -0
  63. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v36.woff +0 -0
  64. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v36.woff2 +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qooxdoo/framework",
3
- "version": "7.1.0",
3
+ "version": "7.1.1",
4
4
  "description": "The JS Framework for Coders",
5
5
  "author": "The qooxdoo project",
6
6
  "keywords": [
@@ -51,7 +51,7 @@
51
51
  "bin/deploy"
52
52
  ],
53
53
  "dependencies": {
54
- "@babel/core": "^7.12.10",
54
+ "@babel/core": "^7.17.10",
55
55
  "@babel/eslint-parser": "^7.16.3",
56
56
  "@babel/generator": "^7.12.11",
57
57
  "@babel/parser": "^7.12.11",
@@ -60,7 +60,7 @@
60
60
  "@babel/plugin-syntax-jsx": "^7.16.7",
61
61
  "@babel/plugin-transform-block-scoping": "^7.12.12",
62
62
  "@babel/plugin-transform-react-jsx": "^7.12.12",
63
- "@babel/preset-env": "^7.12.11",
63
+ "@babel/preset-env": "^7.17.10",
64
64
  "@babel/preset-react": "^7.12.10",
65
65
  "@babel/preset-typescript": "^7.12.7",
66
66
  "@babel/traverse": "^7.12.12",
@@ -73,6 +73,7 @@
73
73
  "ajv": "^8.8.1",
74
74
  "app-module-path": "^2.2.0",
75
75
  "async": "^2.6.3",
76
+ "babelify": "^10.0.0",
76
77
  "better-ajv-errors": "^1.1.1",
77
78
  "browserify": "^17.0.0",
78
79
  "chokidar": "^3.5.1",
@@ -88,7 +88,7 @@ qx.Class.define("qx.event.handler.Focus", {
88
88
  nullable: true
89
89
  },
90
90
 
91
- /** The focussed DOM element */
91
+ /** The focused DOM element */
92
92
  focus: {
93
93
  apply: "_applyFocus",
94
94
  nullable: true
@@ -20,9 +20,9 @@
20
20
  * A dummy class to trigger the compiler to copy the MaterialIcons font files
21
21
  */
22
22
  /**
23
- * @asset(qx/iconfont/MaterialIcons/materialicons-v70.ttf)
24
- * @asset(qx/iconfont/MaterialIcons/materialicons-v70.woff2)
25
- * @asset(qx/iconfont/MaterialIcons/materialicons-v70.woff)
26
- * @asset(qx/iconfont/MaterialIcons/materialicons-v70.eot)
23
+ * @asset(qx/iconfont/MaterialIcons/materialicons-v126.ttf)
24
+ * @asset(qx/iconfont/MaterialIcons/materialicons-v126.woff2)
25
+ * @asset(qx/iconfont/MaterialIcons/materialicons-v126.woff)
26
+ * @asset(qx/iconfont/MaterialIcons/materialicons-v126.eot)
27
27
  */
28
28
  qx.Class.define("qx.theme.iconfont.LoadMaterialIcons", {});
@@ -20,9 +20,9 @@
20
20
  * A dummy class to trigger the compiler to copy the MaterialIconsOutlined font files
21
21
  */
22
22
  /**
23
- * @asset(qx/iconfont/MaterialIcons/materialiconsoutlined-v38.otf)
24
- * @asset(qx/iconfont/MaterialIcons/materialiconsoutlined-v38.woff2)
25
- * @asset(qx/iconfont/MaterialIcons/materialiconsoutlined-v38.woff)
26
- * @asset(qx/iconfont/MaterialIcons/materialiconsoutlined-v38.eot)
23
+ * @asset(qx/iconfont/MaterialIcons/materialiconsoutlined-v101.otf)
24
+ * @asset(qx/iconfont/MaterialIcons/materialiconsoutlined-v101.woff2)
25
+ * @asset(qx/iconfont/MaterialIcons/materialiconsoutlined-v101.woff)
26
+ * @asset(qx/iconfont/MaterialIcons/materialiconsoutlined-v101.eot)
27
27
  */
28
28
  qx.Class.define("qx.theme.iconfont.LoadMaterialIconsOutlined", {});
@@ -20,9 +20,9 @@
20
20
  * A dummy class to trigger the compiler to copy the MaterialIconsRound font files
21
21
  */
22
22
  /**
23
- * @asset(qx/iconfont/MaterialIcons/materialiconsround-v37.otf)
24
- * @asset(qx/iconfont/MaterialIcons/materialiconsround-v37.woff2)
25
- * @asset(qx/iconfont/MaterialIcons/materialiconsround-v37.woff)
26
- * @asset(qx/iconfont/MaterialIcons/materialiconsround-v37.eot)
23
+ * @asset(qx/iconfont/MaterialIcons/materialiconsround-v100.otf)
24
+ * @asset(qx/iconfont/MaterialIcons/materialiconsround-v100.woff2)
25
+ * @asset(qx/iconfont/MaterialIcons/materialiconsround-v100.woff)
26
+ * @asset(qx/iconfont/MaterialIcons/materialiconsround-v100.eot)
27
27
  */
28
28
  qx.Class.define("qx.theme.iconfont.LoadMaterialIconsRound", {});
@@ -20,9 +20,9 @@
20
20
  * A dummy class to trigger the compiler to copy the MaterialIconsSharpe font files
21
21
  */
22
22
  /**
23
- * @asset(qx/iconfont/MaterialIcons/materialiconssharp-v38.otf)
24
- * @asset(qx/iconfont/MaterialIcons/materialiconssharp-v38.woff2)
25
- * @asset(qx/iconfont/MaterialIcons/materialiconssharp-v38.woff)
26
- * @asset(qx/iconfont/MaterialIcons/materialiconssharp-v38.eot)
23
+ * @asset(qx/iconfont/MaterialIcons/materialiconssharp-v101.otf)
24
+ * @asset(qx/iconfont/MaterialIcons/materialiconssharp-v101.woff2)
25
+ * @asset(qx/iconfont/MaterialIcons/materialiconssharp-v101.woff)
26
+ * @asset(qx/iconfont/MaterialIcons/materialiconssharp-v101.eot)
27
27
  */
28
28
  qx.Class.define("qx.theme.iconfont.LoadMaterialIconsSharp", {});
@@ -20,9 +20,9 @@
20
20
  * A dummy class to trigger the compiler to copy the MaterialIconsTwoTone font files
21
21
  */
22
22
  /**
23
- * @asset(qx/iconfont/MaterialIcons/materialiconstwotone-v36.otf)
24
- * @asset(qx/iconfont/MaterialIcons/materialiconstwotone-v36.woff2)
25
- * @asset(qx/iconfont/MaterialIcons/materialiconstwotone-v36.woff)
26
- * @asset(qx/iconfont/MaterialIcons/materialiconstwotone-v36.eot)
23
+ * @asset(qx/iconfont/MaterialIcons/materialiconstwotone-v104.otf)
24
+ * @asset(qx/iconfont/MaterialIcons/materialiconstwotone-v104.woff2)
25
+ * @asset(qx/iconfont/MaterialIcons/materialiconstwotone-v104.woff)
26
+ * @asset(qx/iconfont/MaterialIcons/materialiconstwotone-v104.eot)
27
27
  */
28
28
  qx.Class.define("qx.theme.iconfont.LoadMaterialIconsTwoTone", {});
@@ -87,7 +87,7 @@ var helper = {
87
87
  var color = d[0];
88
88
  var state = d[1];
89
89
  switch (state) {
90
- case "focussed":
90
+ case "focused":
91
91
  return qx.util.ColorUtil.scale(color, {
92
92
  lightness: 10,
93
93
  saturation: 10
@@ -159,10 +159,10 @@ qx.Theme.define("qx.theme.tangible.ColorEngine", {
159
159
  "text-on-error": helper.onX,
160
160
  "primary-hovered": helper.xState,
161
161
  "primary-disabled": helper.xState,
162
- "primary-focussed": helper.xState,
162
+ "primary-focused": helper.xState,
163
163
  "primary-selected": helper.xState,
164
164
  "primary-selected_disabled": helper.xState,
165
- "error-focussed": helper.xState,
165
+ "error-focused": helper.xState,
166
166
 
167
167
  // alpha colors
168
168
  "primary-alpha-5": helper.setAlpha,
@@ -40,7 +40,7 @@ qx.Theme.define("qx.theme.tangible.Decoration", {
40
40
  include: "material-textfield",
41
41
  style: {
42
42
  widthBottom: 2,
43
- colorBottom: "primary-focussed"
43
+ colorBottom: "primary-focused"
44
44
  }
45
45
  },
46
46
 
@@ -56,7 +56,7 @@ qx.Theme.define("qx.theme.tangible.Decoration", {
56
56
  include: "material-textfield",
57
57
  style: {
58
58
  widthBottom: 2,
59
- colorBottom: "error-focussed"
59
+ colorBottom: "error-focused"
60
60
  }
61
61
  },
62
62
 
@@ -287,7 +287,7 @@ qx.Theme.define("qx.theme.tangible.Decoration", {
287
287
  "button-box-pressed": {
288
288
  include: "button-box",
289
289
 
290
- style: { backgroundColor: "primary-focussed" }
290
+ style: { backgroundColor: "primary-focused" }
291
291
  },
292
292
 
293
293
  "button-box-pressed-hovered": {
@@ -359,7 +359,10 @@ qx.Class.define("qx.tool.cli.commands.Compile", {
359
359
  this.argv["feedback"] = configDb.db("qx.default.feedback", true);
360
360
  }
361
361
 
362
- if (this.argv.verbose) {
362
+ // Validate compile.json against the schema
363
+ await qx.tool.config.Compile.getInstance().load();
364
+
365
+ if (this.argv.verbose) {
363
366
  console.log(`
364
367
  Compiler: v${this.getCompilerVersion()} in ${require.main.filename}
365
368
  Framework: v${await this.getQxVersion()} in ${await this.getQxPath()}`);
@@ -1204,7 +1207,8 @@ Framework: v${await this.getQxVersion()} in ${await this.getQxPath()}`);
1204
1207
  "loaderTemplate",
1205
1208
  "publish",
1206
1209
  "deploy",
1207
- "standalone"
1210
+ "standalone",
1211
+ "localModules"
1208
1212
  ].forEach(name => {
1209
1213
  if (appConfig[name] !== undefined) {
1210
1214
  var fname = "set" + qx.lang.String.firstUp(name);
@@ -1226,6 +1230,10 @@ Framework: v${await this.getQxVersion()} in ${await this.getQxPath()}`);
1226
1230
  app.setDescription(appConfig.description);
1227
1231
  }
1228
1232
 
1233
+ if (appConfig.localModules) {
1234
+ app.setLocalModules(appConfig.localModules);
1235
+ }
1236
+
1229
1237
  var parts = appConfig.parts || targetConfig.parts || data.parts;
1230
1238
  if (parts) {
1231
1239
  if (!parts.boot) {
@@ -95,7 +95,16 @@ qx.Class.define("qx.tool.cli.commands.Lint", {
95
95
 
96
96
  members: {
97
97
  async process() {
98
- await this.__applyFixes();
98
+
99
+ let files = this.argv.files || [];
100
+ if (files.length === 0) {
101
+ files.push("source/class/**/*.js");
102
+ }
103
+ for (let i = 0; i < files.length; i++) {
104
+ files[i] = path.join(process.cwd(), files[i]);
105
+ }
106
+
107
+ await this.__applyFixes(files);
99
108
 
100
109
  let helperFilePath = require.main.path;
101
110
  while (true) {
@@ -134,13 +143,6 @@ qx.Class.define("qx.tool.cli.commands.Lint", {
134
143
  fix: this.argv.fix
135
144
  });
136
145
 
137
- let files = this.argv.files || [];
138
- if (files.length === 0) {
139
- files.push("source/class/**/*.js");
140
- }
141
- for (let i = 0; i < files.length; i++) {
142
- files[i] = path.join(process.cwd(), files[i]);
143
- }
144
146
  if (this.argv.printConfig) {
145
147
  const fileConfig = await linter.calculateConfigForFile(files[0]);
146
148
  qx.tool.compiler.Console.info(JSON.stringify(fileConfig, null, " "));
@@ -230,19 +232,18 @@ qx.Class.define("qx.tool.cli.commands.Lint", {
230
232
  * @return {Promise<void>}
231
233
  * @private
232
234
  */
233
- async __applyFixes() {
235
+ async __applyFixes(files) {
234
236
  const fixParams = this.argv.fixJsdocParams;
235
237
  if (fixParams && fixParams !== "off") {
236
- let replaceInFiles = [];
237
238
  const regex =
238
239
  fixParams === "type-first"
239
240
  ? /@param\s+([\w$]+)\s+({[\w|[\]{}<>?. ]+})/g
240
241
  : /@param\s+({[\w|[\]{}<>?. ]+})\s+([\w$]+)/g;
241
- replaceInFiles.push({
242
- files: "source/class/**/*.js",
242
+ let replaceInFiles = {
243
+ files: files,
243
244
  from: regex,
244
245
  to: "@param $2 $1"
245
- });
246
+ };
246
247
 
247
248
  await replaceInFile(replaceInFiles);
248
249
  }
@@ -106,6 +106,7 @@ qx.Class.define("qx.tool.compiler.Es6ify", {
106
106
  construct(filename) {
107
107
  super();
108
108
  this.__filename = filename;
109
+ this.__knownApiFunctions = ["addListener","addListenerOnce"];
109
110
  },
110
111
 
111
112
  properties: {
@@ -125,6 +126,7 @@ qx.Class.define("qx.tool.compiler.Es6ify", {
125
126
 
126
127
  members: {
127
128
  __filename: null,
129
+ __knownApiFunctions: null,
128
130
 
129
131
  async transform() {
130
132
  let src = await fs.promises.readFile(this.__filename, "utf8");
@@ -275,6 +277,7 @@ qx.Class.define("qx.tool.compiler.Es6ify", {
275
277
  let t = this;
276
278
  const isTest = this.__filename.indexOf("/test/") > -1;
277
279
  let arrowFunctions = this.getArrowFunctions();
280
+ let knownApiFunctions = this.__knownApiFunctions;
278
281
 
279
282
  return {
280
283
  visitor: {
@@ -282,13 +285,13 @@ qx.Class.define("qx.tool.compiler.Es6ify", {
282
285
  if (path.node.callee.type == "MemberExpression") {
283
286
  let callee = collapseMemberExpression(path.node.callee);
284
287
  if (arrowFunctions == "careful") {
285
- if (!callee.endsWith(".addListener")) {
288
+ if (!knownApiFunctions.some(fName => callee.endsWith("."+fName))) {
286
289
  return;
287
290
  }
288
291
  if (
289
292
  path.node.arguments.length != 3 ||
290
293
  path.node.arguments[0].type != "StringLiteral" ||
291
- path.node.arguments[1].type != "ArrowFunctionExpression" ||
294
+ path.node.arguments[1].type != "FunctionExpression" ||
292
295
  path.node.arguments[2].type != "ThisExpression"
293
296
  ) {
294
297
  return;
@@ -324,14 +327,14 @@ qx.Class.define("qx.tool.compiler.Es6ify", {
324
327
  * @returns
325
328
  */
326
329
  __pluginRemoveUnnecessaryThis() {
330
+ let knownApiFunctions = this.__knownApiFunctions;
327
331
  return {
328
332
  visitor: {
329
333
  CallExpression(path) {
330
334
  if (
331
335
  path.node.callee.type == "MemberExpression" &&
332
- path.node.callee.object.type == "ThisExpression" &&
333
336
  path.node.callee.property.type == "Identifier" &&
334
- path.node.callee.property.name == "addListener" &&
337
+ knownApiFunctions.includes(path.node.callee.property.name) &&
335
338
  path.node.arguments.length == 3 &&
336
339
  path.node.arguments[0].type == "StringLiteral" &&
337
340
  path.node.arguments[1].type == "ArrowFunctionExpression" &&
@@ -217,6 +217,20 @@ qx.Class.define("qx.tool.compiler.app.Application", {
217
217
  writeIndexHtmlToRoot: {
218
218
  init: false,
219
219
  check: "Boolean"
220
+ },
221
+
222
+ /**
223
+ * Map specifying local modules to include in the build. Local modules are
224
+ * always included in the compiled output, regardless of application type
225
+ * (node, browser, etc.). Each member of the map has a key that is the
226
+ * name of the module to be `require`d in code. The value is the path to
227
+ * the module to be included. The path must begin with "./", and is
228
+ * relative to the directory containing compile.json. The module may be
229
+ * either a CommonJS module or an ES6 module.
230
+ */
231
+ localModules : {
232
+ init : null,
233
+ check : "Object"
220
234
  }
221
235
  },
222
236
 
@@ -432,11 +432,12 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
432
432
  new qx.tool.compiler.targets.meta.PolyfillJs(appMeta)
433
433
  );
434
434
 
435
- // Add browserified CommonJS modules, if any
436
- if (appMeta.getEnvironmentValue("qx.compiler.applicationType") == "browser") {
437
- bootPackage.addJavascriptMeta(
438
- new qx.tool.compiler.targets.meta.Browserify(appMeta));
439
- }
435
+ // Add browserified CommonJS modules, if any. The Browserify
436
+ // class will always bundle local modules specified for an
437
+ // application in compile.json, but will not bundle `require()`d
438
+ // modules that are Node modules.
439
+ bootPackage.addJavascriptMeta(
440
+ new qx.tool.compiler.targets.meta.Browserify(appMeta));
440
441
 
441
442
  /*
442
443
  * Assemble the Parts
@@ -24,7 +24,7 @@ const fs = qx.tool.utils.Promisify.fs;
24
24
  const path = require("upath");
25
25
 
26
26
  /**
27
- *
27
+ *
28
28
  */
29
29
  qx.Class.define("qx.tool.compiler.targets.meta.Browserify", {
30
30
  extend: qx.tool.compiler.targets.meta.AbstractJavascriptMeta,
@@ -45,35 +45,52 @@ qx.Class.define("qx.tool.compiler.targets.meta.Browserify", {
45
45
  let hasCommonjsModules = false;
46
46
  let commonjsModules = new Set();
47
47
  let references = {};
48
+ const localModules =
49
+ this.__appMeta.getApplication().getLocalModules() || {};
48
50
  const db = this.__appMeta.getAnalyser().getDatabase();
49
51
 
50
- // Get a Set of unique `require`d CommonJS module names from all classes
51
- for (let className in db.classInfo) {
52
- let classInfo = db.classInfo[className];
53
- if (classInfo.commonjsModules) {
54
- Object.keys(classInfo.commonjsModules).forEach(
55
- moduleName =>
56
- {
57
- // Add this module name to the set of module names
58
- commonjsModules.add(moduleName);
59
-
60
- // Add the list of references from which this module was require()d
61
- if (! references[moduleName]) {
62
- references[moduleName] = new Set();
63
- }
64
- references[moduleName].add([ ...classInfo.commonjsModules[moduleName] ]);
65
-
66
- // There is at least one module
67
- hasCommonjsModules = true;
68
- });
52
+ // Only include discovered `require()`d Node modules if the
53
+ // target application type is browser.
54
+ if (this.__appMeta.getEnvironmentValue("qx.compiler.applicationType") ==
55
+ "browser") {
56
+
57
+ // Get a Set of unique `require`d CommonJS module names from
58
+ // all classes
59
+ for (let className in db.classInfo) {
60
+ let classInfo = db.classInfo[className];
61
+ if (classInfo.commonjsModules) {
62
+ Object.keys(classInfo.commonjsModules).forEach(
63
+ moduleName =>
64
+ {
65
+ // Ignore this found `require()` if its a local modules
66
+ if (moduleName in localModules) {
67
+ return;
68
+ }
69
+
70
+ // Add this module name to the set of module names
71
+ commonjsModules.add(moduleName);
72
+
73
+ // Add the list of references from which this module was require()d
74
+ if (! references[moduleName]) {
75
+ references[moduleName] = new Set();
76
+ }
77
+ references[moduleName].add([ ...classInfo.commonjsModules[moduleName] ]);
78
+
79
+ // There is at least one module
80
+ hasCommonjsModules = true;
81
+ });
82
+ }
69
83
  }
70
84
  }
71
85
 
72
- // If there are any CommonJS modules required, browserify them
73
- if (hasCommonjsModules) {
86
+ // If there are any CommonJS modules required to be bundled, or
87
+ // any local modules specified for the application in
88
+ // compile.json, browserify them
89
+ if (hasCommonjsModules || localModules) {
74
90
  await this.__browserify(
75
91
  commonjsModules,
76
92
  references,
93
+ localModules,
77
94
  ws
78
95
  );
79
96
  }
@@ -83,8 +100,9 @@ qx.Class.define("qx.tool.compiler.targets.meta.Browserify", {
83
100
  });
84
101
  },
85
102
 
86
- async __browserify(commonjsModules, references, ws) {
87
- let b;
103
+ async __browserify(commonjsModules, references, localModules, ws) {
104
+ const babelify = require("babelify");
105
+ const preset = require("@babel/preset-env");
88
106
  const browserify = require("browserify");
89
107
  const builtins = require("browserify/lib/builtins.js");
90
108
 
@@ -97,7 +115,7 @@ qx.Class.define("qx.tool.compiler.targets.meta.Browserify", {
97
115
 
98
116
  return new Promise(resolve =>
99
117
  {
100
- b = browserify(
118
+ let b = browserify(
101
119
  [],
102
120
  {
103
121
  builtins : builtins,
@@ -106,20 +124,44 @@ qx.Class.define("qx.tool.compiler.targets.meta.Browserify", {
106
124
  detectGlobals : true
107
125
  });
108
126
  b._mdeps.on("missing", (id, parent) => {
109
- let message = [];
127
+ let message = [];
110
128
 
111
- message.push(`ERROR: could not locate require()d module: "${id}"`);
112
- message.push(" required from:");
129
+ message.push(`ERROR: could not locate require()d module: "${id}"`);
130
+ message.push(" required from:");
131
+
132
+ try {
113
133
  [ ...references[id] ].forEach(refs => {
114
134
  refs.forEach(ref =>
115
135
  {
116
136
  message.push(` ${ref}`);
117
137
  });
118
138
  });
139
+ } catch(e) {
140
+ message.push(` <compile.json:application.localModules'>`);
141
+ }
119
142
 
120
- qx.tool.compiler.Console.error(message.join("\n"));
121
- });
122
- b.require(commonjsModules);
143
+ qx.tool.compiler.Console.error(message.join("\n"));
144
+ });
145
+
146
+ // Include any dynamically determined `require()`d modules
147
+ if (commonjsModules.length > 0) {
148
+ b.require(commonjsModules);
149
+ }
150
+
151
+ // Include any local modules specified for the application
152
+ // in compile.json
153
+ if (localModules) {
154
+ for (let requireName in localModules) {
155
+ b.require(localModules[requireName], { expose : requireName });
156
+ }
157
+ }
158
+
159
+ // Ensure ES6 local modules are converted to CommonJS format
160
+ b.transform(babelify, {
161
+ presets: [preset],
162
+ sourceMaps: false,
163
+ global: true
164
+ });
123
165
  b.bundle((e, output) => {
124
166
  if (e) {
125
167
  // We've already handled the case of missing module. This is something else.
@@ -23,7 +23,7 @@
23
23
  * *********************************************************************** */
24
24
 
25
25
  const Ajv = require("ajv");
26
- const betterAjvErrors = require("better-ajv-errors");
26
+ const betterAjvErrors = require("better-ajv-errors").default;
27
27
  const fs = qx.tool.utils.Promisify.fs;
28
28
 
29
29
  qx.Class.define("qx.tool.utils.Json", {
@@ -91,7 +91,6 @@ qx.$$createdAt = function(obj, filename, lineNumber, column) {
91
91
  };
92
92
 
93
93
  var isWebkit = /AppleWebKit\/([^ ]+)/.test(navigator.userAgent);
94
- var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
95
94
  var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
96
95
 
97
96
  qx.$$loader = {
@@ -103,7 +102,7 @@ qx.$$loader = {
103
102
  closureParts : %{ClosureParts},
104
103
  bootIsInline : %{BootIsInline},
105
104
  addNoCacheParam : %{NoCacheParam},
106
- isLoadParallel: !isFirefox && !isIE11 && 'async' in document.createElement('script'),
105
+ isLoadParallel: !isIE11 && 'async' in document.createElement('script'),
107
106
  delayDefer: false,
108
107
  splashscreen: window.QOOXDOO_SPLASH_SCREEN || null,
109
108
  isLoadChunked: false,
@@ -53,11 +53,11 @@
53
53
  "minItems": 1,
54
54
  "items": {
55
55
  "type": "object",
56
- "additionalItems": false,
57
56
  "required": [
58
57
  "class",
59
58
  "name"
60
59
  ],
60
+ "additionalProperties": false,
61
61
  "properties": {
62
62
  "class" : {
63
63
  "description": "The class name of the main application class (it typically inherits from `qx.application.Standalone` for web applications)",
@@ -105,6 +105,10 @@
105
105
  "type": "boolean",
106
106
  "default": true
107
107
  },
108
+ "default": {
109
+ "description": "This browser application is written into the root of the target dir. If not set the first application is used instead",
110
+ "type": "boolean"
111
+ },
108
112
  "standalone": {
109
113
  "description": "Whether this application can be opened in a browser on its own (true) or is part of a different application (false)",
110
114
  "type": "boolean",
@@ -168,6 +172,12 @@
168
172
  },
169
173
  "parts": {
170
174
  "$ref": "#/properties/parts"
175
+ },
176
+ "localModules": {
177
+ "type": "object",
178
+ "additionalProperties": {
179
+ "type": "string"
180
+ }
171
181
  }
172
182
  }
173
183
  }