@qooxdoo/framework 7.0.0-beta.9 → 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 (85) hide show
  1. package/CHANGELOG.md +10 -2
  2. package/Manifest.json +23 -23
  3. package/README.md +2 -4
  4. package/lib/compiler/compile-info.json +87 -85
  5. package/lib/compiler/index.js +1997 -1649
  6. package/lib/resource/qx/tool/cli/templates/loader/loader-browser.tmpl.js +1 -2
  7. package/lib/resource/qx/tool/schema/compile-1-0-0.json +11 -1
  8. package/npm-shrinkwrap.json +12394 -584
  9. package/package.json +6 -4
  10. package/source/class/qx/Mixin.js +6 -0
  11. package/source/class/qx/event/handler/Focus.js +1 -1
  12. package/source/class/qx/test/Mixin.js +32 -1
  13. package/source/class/qx/theme/iconfont/LoadMaterialIcons.js +4 -4
  14. package/source/class/qx/theme/iconfont/LoadMaterialIconsOutlined.js +4 -4
  15. package/source/class/qx/theme/iconfont/LoadMaterialIconsRound.js +4 -4
  16. package/source/class/qx/theme/iconfont/LoadMaterialIconsSharp.js +4 -4
  17. package/source/class/qx/theme/iconfont/LoadMaterialIconsTwoTone.js +4 -4
  18. package/source/class/qx/theme/tangible/ColorEngine.js +3 -3
  19. package/source/class/qx/theme/tangible/Decoration.js +3 -3
  20. package/source/class/qx/tool/cli/api/AbstractApi.js +4 -1
  21. package/source/class/qx/tool/cli/commands/Compile.js +11 -2
  22. package/source/class/qx/tool/cli/commands/Lint.js +29 -18
  23. package/source/class/qx/tool/compiler/ClassFile.js +70 -0
  24. package/source/class/qx/tool/compiler/Es6ify.js +7 -4
  25. package/source/class/qx/tool/compiler/TargetError.js +27 -0
  26. package/source/class/qx/tool/compiler/app/Application.js +14 -0
  27. package/source/class/qx/tool/compiler/targets/Target.js +7 -0
  28. package/source/class/qx/tool/compiler/targets/meta/AbstractJavascriptMeta.js +1 -1
  29. package/source/class/qx/tool/compiler/targets/meta/Browserify.js +185 -0
  30. package/source/class/qx/tool/compiler/targets/meta/Uglify.js +4 -25
  31. package/source/class/qx/tool/utils/Json.js +1 -1
  32. package/source/class/qx/ui/form/AbstractSelectBox.js +4 -1
  33. package/source/class/qx/ui/form/DateField.js +4 -1
  34. package/source/class/qx/ui/progressive/renderer/table/Row.js +2 -1
  35. package/source/class/qx/ui/progressive/renderer/table/cell/Boolean.js +24 -26
  36. package/source/class/qx/ui/progressive/renderer/table/cell/Icon.js +9 -7
  37. package/source/class/qx/ui/progressive/renderer/table/cell/Image.js +16 -13
  38. package/source/class/qx/ui/table/Table.js +0 -1
  39. package/source/class/qx/ui/table/model/Abstract.js +31 -1
  40. package/source/class/qx/ui/table/model/Remote.js +1 -0
  41. package/source/class/qx/ui/table/model/Simple.js +14 -3
  42. package/source/class/qx/ui/table/pane/Pane.js +3 -1
  43. package/source/class/qx/ui/treevirtual/MNode.js +60 -5
  44. package/source/class/qx/ui/treevirtual/SimpleTreeDataModel.js +11 -3
  45. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v126.eot +0 -0
  46. package/source/resource/qx/iconfont/MaterialIcons/{materialicons-v70.ttf → materialicons-v126.ttf} +0 -0
  47. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v126.woff +0 -0
  48. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v126.woff2 +0 -0
  49. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v101.eot +0 -0
  50. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v101.otf +0 -0
  51. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v101.woff +0 -0
  52. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v101.woff2 +0 -0
  53. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v100.eot +0 -0
  54. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v100.otf +0 -0
  55. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v100.woff +0 -0
  56. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v100.woff2 +0 -0
  57. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v101.eot +0 -0
  58. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v101.otf +0 -0
  59. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v101.woff +0 -0
  60. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v101.woff2 +0 -0
  61. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v104.eot +0 -0
  62. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v104.otf +0 -0
  63. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v104.woff +0 -0
  64. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v104.woff2 +0 -0
  65. package/source/resource/qx/tool/cli/templates/loader/loader-browser.tmpl.js +1 -2
  66. package/source/resource/qx/tool/schema/compile-1-0-0.json +11 -1
  67. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v70.eot +0 -0
  68. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v70.woff +0 -0
  69. package/source/resource/qx/iconfont/MaterialIcons/materialicons-v70.woff2 +0 -0
  70. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v38.eot +0 -0
  71. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v38.otf +0 -0
  72. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v38.woff +0 -0
  73. package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined-v38.woff2 +0 -0
  74. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v37.eot +0 -0
  75. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v37.otf +0 -0
  76. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v37.woff +0 -0
  77. package/source/resource/qx/iconfont/MaterialIcons/materialiconsround-v37.woff2 +0 -0
  78. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v38.eot +0 -0
  79. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v38.otf +0 -0
  80. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v38.woff +0 -0
  81. package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp-v38.woff2 +0 -0
  82. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v36.eot +0 -0
  83. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v36.otf +0 -0
  84. package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone-v36.woff +0 -0
  85. 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.0.0-beta.9",
3
+ "version": "7.1.1",
4
4
  "description": "The JS Framework for Coders",
5
5
  "author": "The qooxdoo project",
6
6
  "keywords": [
@@ -36,7 +36,7 @@
36
36
  "scripts": {
37
37
  "devtools": "node source/resource/qx/tool/bin/build-devtools",
38
38
  "website": "node source/resource/qx/tool/bin/build-website",
39
- "pretest": "node bootstrap-compiler --target build",
39
+ "pretest": "node ./bootstrap-compiler",
40
40
  "test": "node ./bin/build/qx test --colorize=false --quiet",
41
41
  "prepack": "node ./bootstrap/qx deploy --clean"
42
42
  },
@@ -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,7 +73,9 @@
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",
78
+ "browserify": "^17.0.0",
77
79
  "chokidar": "^3.5.1",
78
80
  "cldr": "^7.1.1",
79
81
  "columnify": "^1.5.4",
@@ -370,6 +370,12 @@ qx.Bootstrap.define("qx.Mixin", {
370
370
  // Try looking in the class itself
371
371
  if (!fn && mixedInAt.prototype[methodName]) {
372
372
  fn = mixedInAt.prototype[methodName].base;
373
+ // if fn.self is set fn is an overloaded mixin method from
374
+ // another mixin. In this case fn.base contains the original
375
+ // class method.
376
+ if (fn && fn.self) {
377
+ fn = fn.base;
378
+ }
373
379
  }
374
380
  // Try looking in the superclass
375
381
  if (!fn && mixedInAt.superclass) {
@@ -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
@@ -574,8 +574,39 @@ qx.Class.define("qx.test.Mixin", {
574
574
  this.assertEquals("A MA B MB C MC", o.sayJuhu());
575
575
  o.dispose();
576
576
 
577
- }
577
+ },
578
+
579
+ testDoubleMixin() {
580
+ qx.Class.define("qx.D", {
581
+ extend: qx.core.Object,
582
+ members: {
583
+ sayJuhu() {
584
+ return "Double";
585
+ }
586
+ }
587
+ });
588
+ qx.Mixin.define("qx.MDA", {
589
+ members: {
590
+ sayJuhu() {
591
+ return super.sayJuhu() + " MA";
592
+ },
593
+ }
594
+ });
595
+ qx.Mixin.define("qx.MDB", {
596
+ members: {
597
+ sayJuhu() {
598
+ return super.sayJuhu() + " MB";
599
+ },
600
+ }
601
+ });
602
+ qx.Class.patch(qx.D, qx.MDA);
603
+ qx.Class.patch(qx.D, qx.MDB);
578
604
 
605
+ var o = new qx.D();
606
+ this.assertEquals("Double MA MB", o.sayJuhu());
607
+ o.dispose();
608
+
609
+ }
579
610
 
580
611
  }
581
612
  });
@@ -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": {
@@ -86,7 +86,10 @@ qx.Class.define("qx.tool.cli.api.AbstractApi", {
86
86
  */
87
87
  loadNpmModule(module) {
88
88
  const { execSync } = require("child_process");
89
- let s = `npm install --no-save --no-package-lock ${module}`;
89
+ // since npm 7 --no-save deletes the node_modules folder
90
+ // see https://github.com/npm/cli/pull/3907
91
+ // let s = `npm install --no-save --no-package-lock ${module}`;
92
+ let s = `npm install --no-package-lock ${module}`;
90
93
  qx.tool.compiler.Console.info(s);
91
94
  execSync(s, {
92
95
  stdio: "inherit"
@@ -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()}`);
@@ -915,6 +918,7 @@ Framework: v${await this.getQxVersion()} in ${await this.getQxPath()}`);
915
918
  */
916
919
  let targetOutputPaths = {};
917
920
  let makers = [];
921
+
918
922
  targetConfigs.forEach(targetConfig => {
919
923
  if (!targetConfig.appConfigs) {
920
924
  qx.tool.compiler.Console.print(
@@ -1203,7 +1207,8 @@ Framework: v${await this.getQxVersion()} in ${await this.getQxPath()}`);
1203
1207
  "loaderTemplate",
1204
1208
  "publish",
1205
1209
  "deploy",
1206
- "standalone"
1210
+ "standalone",
1211
+ "localModules"
1207
1212
  ].forEach(name => {
1208
1213
  if (appConfig[name] !== undefined) {
1209
1214
  var fname = "set" + qx.lang.String.firstUp(name);
@@ -1225,6 +1230,10 @@ Framework: v${await this.getQxVersion()} in ${await this.getQxPath()}`);
1225
1230
  app.setDescription(appConfig.description);
1226
1231
  }
1227
1232
 
1233
+ if (appConfig.localModules) {
1234
+ app.setLocalModules(appConfig.localModules);
1235
+ }
1236
+
1228
1237
  var parts = appConfig.parts || targetConfig.parts || data.parts;
1229
1238
  if (parts) {
1230
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, " "));
@@ -157,13 +159,23 @@ qx.Class.define("qx.tool.cli.commands.Lint", {
157
159
  }
158
160
  if (report.errorCount > 0 || report.warningCount > 0) {
159
161
  let outputFormat = this.argv.format || "codeframe";
160
-
161
- // If there are too many errors, the pretty formatter is appallingly slow
162
- if (report.errorCount + report.warningCount > 150) {
163
- outputFormat = "compact";
164
- }
165
162
  const formatter = await linter.loadFormatter(outputFormat);
166
163
  const s = formatter.format(report);
164
+ // If there are too many errors, the pretty formatter is appallingly slow so if the
165
+ // user has not specified a format, change to compact mode
166
+ const maxDefaultFormatErrorCount = 150;
167
+ if (report.errorCount + report.warningCount > maxDefaultFormatErrorCount) {
168
+ if (!this.argv.format) {
169
+ qx.tool.compiler.Console.info(
170
+ `Total errors and warnings exceed ${maxDefaultFormatErrorCount}, switching to "compact" style report`
171
+ );
172
+ outputFormat = "compact";
173
+ } else {
174
+ qx.tool.compiler.Console.info(
175
+ `Total errors and warnings exceed ${maxDefaultFormatErrorCount}, the report may take some time to generate.`
176
+ );
177
+ }
178
+ }
167
179
  if (this.argv.outputFile) {
168
180
  if (this.argv.verbose) {
169
181
  qx.tool.compiler.Console.info(
@@ -220,19 +232,18 @@ qx.Class.define("qx.tool.cli.commands.Lint", {
220
232
  * @return {Promise<void>}
221
233
  * @private
222
234
  */
223
- async __applyFixes() {
235
+ async __applyFixes(files) {
224
236
  const fixParams = this.argv.fixJsdocParams;
225
237
  if (fixParams && fixParams !== "off") {
226
- let replaceInFiles = [];
227
238
  const regex =
228
239
  fixParams === "type-first"
229
240
  ? /@param\s+([\w$]+)\s+({[\w|[\]{}<>?. ]+})/g
230
241
  : /@param\s+({[\w|[\]{}<>?. ]+})\s+([\w$]+)/g;
231
- replaceInFiles.push({
232
- files: "source/class/**/*.js",
242
+ let replaceInFiles = {
243
+ files: files,
233
244
  from: regex,
234
245
  to: "@param $2 $1"
235
- });
246
+ };
236
247
 
237
248
  await replaceInFile(replaceInFiles);
238
249
  }
@@ -223,6 +223,7 @@ qx.Class.define("qx.tool.compiler.ClassFile", {
223
223
  };
224
224
 
225
225
  this.__externals = [];
226
+ this.__commonjsModules = {};
226
227
 
227
228
  this.__taskQueueDrains = [];
228
229
  this.__taskQueue = async.queue(function (task, cb) {
@@ -281,6 +282,7 @@ qx.Class.define("qx.tool.compiler.ClassFile", {
281
282
  __privates: null,
282
283
  __blockedPrivates: null,
283
284
  __externals: null,
285
+ __commonjsModules: null,
284
286
 
285
287
  _onTaskQueueDrain() {
286
288
  var cbs = this.__taskQueueDrain;
@@ -496,6 +498,7 @@ qx.Class.define("qx.tool.compiler.ClassFile", {
496
498
  delete dbClassInfo.translations;
497
499
  delete dbClassInfo.markers;
498
500
  delete dbClassInfo.fatalCompileError;
501
+ delete dbClassInfo.commonjsModules;
499
502
  for (var key in this.__dbClassInfo) {
500
503
  dbClassInfo[key] = this.__dbClassInfo[key];
501
504
  }
@@ -667,6 +670,14 @@ qx.Class.define("qx.tool.compiler.ClassFile", {
667
670
  dbClassInfo.fatalCompileError = true;
668
671
  }
669
672
 
673
+ // CommonJS modules
674
+ if (Object.keys(this.__commonjsModules).length > 0) {
675
+ dbClassInfo.commonjsModules = {};
676
+ for (let moduleName in this.__commonjsModules) {
677
+ dbClassInfo.commonjsModules[moduleName] = [ ...this.__commonjsModules[moduleName] ];
678
+ }
679
+ }
680
+
670
681
  return dbClassInfo;
671
682
  },
672
683
 
@@ -1648,6 +1659,52 @@ qx.Class.define("qx.tool.compiler.ClassFile", {
1648
1659
  }
1649
1660
  }
1650
1661
 
1662
+ // Are we looking at the Identifier `require`, and is it a
1663
+ // function call (identified by having
1664
+ // `path.node.arguments`? If so, we'll add the discovered
1665
+ // module to the list of modules that must be browserified
1666
+ // if the application is destined for the browser.
1667
+ let scope;
1668
+ let applicationTypes = t.__analyser.getApplicationTypes();
1669
+
1670
+ if (path.node.callee.type == "Identifier" &&
1671
+ path.node?.callee?.name == "require" &&
1672
+ path.node.arguments?.length == 1 &&
1673
+ applicationTypes.includes("browser")) {
1674
+
1675
+ // See if this is a reference to global `require` or
1676
+ // something in the scope chain
1677
+ for (scope = t.__scope; scope; scope = scope.parent) {
1678
+ if (scope.vars["require"]) {
1679
+ // It's in the scope chain. Ignore it.
1680
+ break;
1681
+ }
1682
+ }
1683
+ // Did we reach top level without finding it in a local scope?
1684
+ if (! scope) {
1685
+ // Yup. It's the global one we're looking for. Ensure the argument is valid.
1686
+ let arg = path.node.arguments[0];
1687
+ if (types.isLiteral(arg)) {
1688
+ if (typeof arg.value != "string") {
1689
+ log.error(
1690
+ `${t.__className}: ` +
1691
+ "Only literal string arguments to require() are supported: " +
1692
+ arg.value
1693
+ );
1694
+ } else {
1695
+ qx.tool.compiler.Console.log(
1696
+ `${t.__className}:${path.node.loc.start.line}:` +
1697
+ ` automatically detected \'require(${arg.value})\``);
1698
+ t.addCommonjsModule(arg.value, t.__className, path.node.loc.start.line);
1699
+
1700
+ // Don't show "unresolved" error for `require` since the
1701
+ // browserified code defines it as a global
1702
+ t.addIgnore("require");
1703
+ }
1704
+ }
1705
+ }
1706
+ }
1707
+
1651
1708
  if (
1652
1709
  types.isMemberExpression(path.node.callee) ||
1653
1710
  (es6ClassDeclarations == 0 &&
@@ -2506,6 +2563,19 @@ qx.Class.define("qx.tool.compiler.ClassFile", {
2506
2563
  }
2507
2564
  },
2508
2565
 
2566
+ /**
2567
+ * Adds a CommonJS module to be browserified
2568
+ *
2569
+ * @param name {String} name of the module
2570
+ */
2571
+ addCommonjsModule(moduleName, className, linenum) {
2572
+ if (! this.__commonjsModules[moduleName]) {
2573
+ this.__commonjsModules[moduleName] = new Set();
2574
+ }
2575
+
2576
+ this.__commonjsModules[moduleName].add(`${className}:${linenum}`);
2577
+ },
2578
+
2509
2579
  /**
2510
2580
  * Adds an ignored symbol
2511
2581
  * @param name {String} name of the symbol
@@ -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" &&
@@ -0,0 +1,27 @@
1
+ /* ************************************************************************
2
+ *
3
+ * qooxdoo-compiler - node.js based replacement for the Qooxdoo python
4
+ * toolchain
5
+ *
6
+ * https://github.com/qooxdoo/qooxdoo-compiler
7
+ *
8
+ * Copyright:
9
+ * 3033 Derrell Lipman
10
+ *
11
+ * License:
12
+ * MIT: https://opensource.org/licenses/MIT
13
+ *
14
+ * This software is provided under the same licensing terms as Qooxdoo,
15
+ * please see the LICENSE file in the Qooxdoo project's top-level directory
16
+ * for details.
17
+ *
18
+ * Authors:
19
+ * * Derrell Lipman (@derrell)
20
+ *
21
+ * ************************************************************************/
22
+
23
+ qx.Class.define("qx.tool.compiler.TargetError",
24
+ {
25
+ // extend : qx.type.BaseError
26
+ extend : Error
27
+ });
@@ -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,6 +432,13 @@ 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. 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));
441
+
435
442
  /*
436
443
  * Assemble the Parts
437
444
  */
@@ -26,7 +26,7 @@ const sourceMap = require("source-map");
26
26
 
27
27
  /**
28
28
  * An AbstractJavascriptMeta provides an abstraction of some source code, and might be
29
- * compromised of a number of input files which are merged together as required.
29
+ * comprised of a number of input files which are merged together as required.
30
30
  *
31
31
  * This object could represent a file which already exists on disk (eg a transpiled
32
32
  * source file), or something that is generated on the fly (such as a index.js), or