@qooxdoo/framework 7.0.0-beta.6 → 7.0.0-beta.7

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 (47) hide show
  1. package/Manifest.json +1 -1
  2. package/README.md +3 -1
  3. package/lib/compiler/compile-info.json +57 -55
  4. package/lib/compiler/index.js +2440 -1860
  5. package/lib/resource/qx/tool/cli/templates/skeleton/mobile/source/theme/custom/css/custom.css.map +1 -1
  6. package/lib/resource/qx/tool/schema/compile-1-0-0.json +6 -11
  7. package/package.json +3 -2
  8. package/source/class/qx/Bootstrap.js +22 -1
  9. package/source/class/qx/bom/Blocker.js +2 -1
  10. package/source/class/qx/core/Environment.js +3 -12
  11. package/source/class/qx/core/MProperty.js +1 -1
  12. package/source/class/qx/dev/unit/Sinon.js +1 -1
  13. package/source/class/qx/test/core/Assert.js +1 -1
  14. package/source/class/qx/test/core/Environment.js +0 -3
  15. package/source/class/qx/tool/cli/Cli.js +1 -0
  16. package/source/class/qx/tool/cli/commands/Compile.js +10 -0
  17. package/source/class/qx/tool/cli/commands/Es6ify.js +93 -0
  18. package/source/class/qx/tool/cli/commands/package/Install.js +1 -1
  19. package/source/class/qx/tool/compiler/ClassFile.js +67 -27
  20. package/source/class/qx/tool/compiler/Es6ify.js +368 -0
  21. package/source/class/qx/tool/compiler/targets/Target.js +56 -47
  22. package/source/class/qx/tool/compiler/targets/meta/AbstractJavascriptMeta.js +25 -18
  23. package/source/class/qx/tool/compiler/targets/meta/BootJs.js +16 -16
  24. package/source/class/qx/tool/compiler/targets/meta/Uglify.js +10 -10
  25. package/source/class/qx/ui/decoration/MLinearBackgroundGradient.js +2 -1
  26. package/source/resource/qx/tool/schema/compile-1-0-0.json +6 -11
  27. package/lib/resource/qx/static/blank.gif +0 -0
  28. package/source/class/qx/io/remote/Exchange.js +0 -1063
  29. package/source/class/qx/io/remote/Request.js +0 -1021
  30. package/source/class/qx/io/remote/RequestQueue.js +0 -521
  31. package/source/class/qx/io/remote/Response.js +0 -137
  32. package/source/class/qx/io/remote/Rpc.js +0 -1075
  33. package/source/class/qx/io/remote/RpcError.js +0 -198
  34. package/source/class/qx/io/remote/__init__.js +0 -88
  35. package/source/class/qx/io/remote/transport/Abstract.js +0 -513
  36. package/source/class/qx/io/remote/transport/Iframe.js +0 -652
  37. package/source/class/qx/io/remote/transport/Script.js +0 -475
  38. package/source/class/qx/io/remote/transport/XmlHttp.js +0 -1019
  39. package/source/class/qx/io/remote/transport/__init__.js +0 -3
  40. package/source/class/qx/test/io/remote/AbstractRequest.js +0 -150
  41. package/source/class/qx/test/io/remote/RequestIframe.js +0 -105
  42. package/source/class/qx/test/io/remote/RequestXhr.js +0 -151
  43. package/source/class/qx/test/io/remote/Rpc.js +0 -205
  44. package/source/class/qx/test/io/remote/__init__.js +0 -4
  45. package/source/class/qx/test/io/remote/transport/Iframe.js +0 -67
  46. package/source/class/qx/test/io/remote/transport/XmlHttp.js +0 -133
  47. package/source/class/qx/test/io/remote/transport/__init__.js +0 -4
@@ -21,22 +21,23 @@
21
21
  * ************************************************************************/
22
22
 
23
23
  const fs = qx.tool.utils.Promisify.fs;
24
+ const path = require("upath");
24
25
  const sourceMap = require("source-map");
25
26
 
26
27
  /**
27
28
  * An AbstractJavascriptMeta provides an abstraction of some source code, and might be
28
29
  * compromised of a number of input files which are merged together as required.
29
- *
30
+ *
30
31
  * This object could represent a file which already exists on disk (eg a transpiled
31
32
  * source file), or something that is generated on the fly (such as a index.js), or
32
33
  * a compilation of files (eg a part)
33
34
  */
34
35
  qx.Class.define("qx.tool.compiler.targets.meta.AbstractJavascriptMeta", {
35
36
  extend: qx.core.Object,
36
-
37
+
37
38
  /**
38
39
  * Constructor
39
- *
40
+ *
40
41
  * @param appMeta {qx.tool.compiler.targets.meta.ApplicationMeta}
41
42
  * @param filename {String} the sourcefile
42
43
  * @param originalSourceFile {String?} the URI to give to the source map
@@ -47,7 +48,7 @@ qx.Class.define("qx.tool.compiler.targets.meta.AbstractJavascriptMeta", {
47
48
  this.__filename = filename;
48
49
  this.__originalSourceFile = originalSourceFile;
49
50
  },
50
-
51
+
51
52
  properties: {
52
53
  /** If true, this is generated on the fly and needs to be output */
53
54
  needsWriteToDisk: {
@@ -55,7 +56,7 @@ qx.Class.define("qx.tool.compiler.targets.meta.AbstractJavascriptMeta", {
55
56
  check: "Boolean"
56
57
  }
57
58
  },
58
-
59
+
59
60
  members: {
60
61
  _appMeta: null,
61
62
  __filename: null,
@@ -64,37 +65,37 @@ qx.Class.define("qx.tool.compiler.targets.meta.AbstractJavascriptMeta", {
64
65
 
65
66
  /**
66
67
  * Returns the ApplicationMeta
67
- *
68
+ *
68
69
  * @return {ApplicationMeta}
69
70
  */
70
71
  getAppMeta() {
71
72
  return this._appMeta;
72
73
  },
73
-
74
+
74
75
  /**
75
76
  * Returns the filename for the output of this JS
76
- *
77
+ *
77
78
  * @return {String}
78
79
  */
79
80
  getFilename() {
80
81
  return this.__filename;
81
82
  },
82
-
83
+
83
84
  wrap(jsMeta) {
84
85
  this.__wrapper = jsMeta;
85
86
  },
86
-
87
+
87
88
  getWrapper() {
88
89
  return this.__wrapper;
89
90
  },
90
-
91
+
91
92
  unwrap() {
92
93
  if (this.__wrapper) {
93
94
  return this.__wrapper.unwrap();
94
95
  }
95
96
  return this;
96
97
  },
97
-
98
+
98
99
  /**
99
100
  * Writes the file to disk, if appropriate
100
101
  */
@@ -107,31 +108,31 @@ qx.Class.define("qx.tool.compiler.targets.meta.AbstractJavascriptMeta", {
107
108
  await this.writeSourceCodeToStream(ws);
108
109
  ws.end();
109
110
  });
110
-
111
+
111
112
  let map = await this.getSourceMap();
112
113
  if (map) {
113
114
  await fs.writeFileAsync(this.__filename + ".map", JSON.stringify(map, null, 2), "utf8");
114
115
  }
115
116
  }
116
117
  },
117
-
118
+
118
119
  /**
119
120
  * Writes the source code as a stream, merging source files etc
120
121
  * as necessary
121
- *
122
+ *
122
123
  * @param ws {WriteStream} the stream to write to
123
124
  */
124
125
  async writeSourceCodeToStream(ws) {
125
126
  throw new Error(`No implementation for ${this.classname}.writeSourceCodeToStream`);
126
127
  },
127
-
128
+
128
129
  /**
129
130
  * Reads the source map as a string
130
131
  */
131
132
  async getSourceMap() {
132
133
  return null;
133
134
  },
134
-
135
+
135
136
  /**
136
137
  * Utility method that merges multiple source maps
137
138
  */
@@ -164,7 +165,13 @@ qx.Class.define("qx.tool.compiler.targets.meta.AbstractJavascriptMeta", {
164
165
  }
165
166
  }
166
167
  }
167
- return JSON.parse(generator.toString());
168
+ let res = JSON.parse(generator.toString());
169
+ if (this._appMeta.getTarget().getSourceMapRelativePaths && this._appMeta.getTarget().getSourceMapRelativePaths()) {
170
+ for (let i = 0; i < res.sources.length; i++) {
171
+ res.sources[i] = path.relative("", res.sources[i]);
172
+ }
173
+ }
174
+ return res;
168
175
  }
169
176
  }
170
177
  });
@@ -25,24 +25,24 @@ const fs = qx.tool.utils.Promisify.fs;
25
25
  const path = require("upath");
26
26
 
27
27
  /**
28
- * Represents a "index.js" that is generated as part of a compile
28
+ * Represents a "index.js" that is generated as part of a compile
29
29
  */
30
30
  qx.Class.define("qx.tool.compiler.targets.meta.BootJs", {
31
31
  extend: qx.tool.compiler.targets.meta.AbstractJavascriptMeta,
32
-
32
+
33
33
  construct(appMeta) {
34
34
  this.base(arguments, appMeta, `${appMeta.getApplicationRoot()}index.js`);
35
35
  this.__embeddedJs = [];
36
36
  this.__embeddedJsLookup = {};
37
37
  },
38
-
38
+
39
39
  properties: {
40
40
  needsWriteToDisk: {
41
41
  init: true,
42
42
  refine: true
43
43
  }
44
44
  },
45
-
45
+
46
46
  members: {
47
47
  __embeddedJs: null,
48
48
  __sourceMapOffsets: null,
@@ -50,7 +50,7 @@ qx.Class.define("qx.tool.compiler.targets.meta.BootJs", {
50
50
  /**
51
51
  * Adds Javascript which is to be added to the end of the index.js, just before the app
52
52
  * is finalised
53
- *
53
+ *
54
54
  * @param jsMeta {AbstractJavascriptMeta} the jaavscript to add
55
55
  */
56
56
  addEmbeddedJs(jsMeta) {
@@ -59,7 +59,7 @@ qx.Class.define("qx.tool.compiler.targets.meta.BootJs", {
59
59
  this.__embeddedJsLookup[jsMeta.toHashCode()] = jsMeta;
60
60
  }
61
61
  },
62
-
62
+
63
63
  /*
64
64
  * @Override
65
65
  */
@@ -78,13 +78,13 @@ qx.Class.define("qx.tool.compiler.targets.meta.BootJs", {
78
78
  if (uri.startsWith("__external__:")) {
79
79
  return true;
80
80
  }
81
-
81
+
82
82
  inlines.push(uri);
83
83
  return false;
84
84
  });
85
85
  for (let i = 0; i < inlines.length; i++) {
86
86
  let uri = inlines[i];
87
-
87
+
88
88
  let filename = path.join(target.getOutputDir(), "resources", uri);
89
89
  try {
90
90
  var data = await fs.readFileAsync(filename, { encoding: "utf-8" });
@@ -92,12 +92,12 @@ qx.Class.define("qx.tool.compiler.targets.meta.BootJs", {
92
92
  ws.write("\n");
93
93
  } catch (ex) {
94
94
  if (ex.code != "ENOENT") {
95
- throw ex;
95
+ throw ex;
96
96
  }
97
97
  }
98
98
  }
99
99
  }
100
-
100
+
101
101
  var MAP = {
102
102
  EnvSettings: appMeta.getEnvironment(),
103
103
  Libraries: appMeta.getLibraries().map(library => library.getNamespace()),
@@ -140,7 +140,7 @@ qx.Class.define("qx.tool.compiler.targets.meta.BootJs", {
140
140
  while ((match = line.match(/\%\{([^}]+)\}/))) {
141
141
  var keyword = match[1];
142
142
  var replace = "";
143
-
143
+
144
144
  if (keyword == "BootPart") {
145
145
  for (let j = 0; j < this.__embeddedJs.length; j++) {
146
146
  this.__sourceMapOffsets.push(ws.getLineNumber());
@@ -154,7 +154,7 @@ qx.Class.define("qx.tool.compiler.targets.meta.BootJs", {
154
154
  replace = JSON.stringify(MAP[keyword], null, 2);
155
155
  }
156
156
  }
157
-
157
+
158
158
  var newLine = line.substring(0, match.index) + replace + line.substring(match.index + keyword.length + 3);
159
159
  line = newLine;
160
160
  }
@@ -164,19 +164,19 @@ qx.Class.define("qx.tool.compiler.targets.meta.BootJs", {
164
164
  ws.write(line + "\n");
165
165
  }
166
166
  },
167
-
167
+
168
168
  /*
169
169
  * @Override
170
170
  */
171
171
  async getSourceMap() {
172
172
  if (this.__sourceMapOffsets === null) {
173
- throw new Error(`Cannot get the source map for ${this} until the stream has been written`);
173
+ throw new Error(`Cannot get the source map for ${this} until the stream has been written`);
174
174
  }
175
175
  let res = await this._copySourceMap(this.__embeddedJs, this.__sourceMapOffsets);
176
176
  let target = this._appMeta.getTarget();
177
177
  for (let i = 0; i < res.sources.length; i++) {
178
- res.sources[i] = path.relative("", res.sources[i]);
179
- let mapTo = target.getPathMapping(res.sources[i]);
178
+ let s = path.relative("", res.sources[i]);
179
+ let mapTo = target.getPathMapping(s);
180
180
  res.sources[i] = mapTo ? mapTo : res.sources[i];
181
181
  }
182
182
  return res;
@@ -22,14 +22,14 @@
22
22
 
23
23
  const fs = qx.tool.utils.Promisify.fs;
24
24
  const path = require("upath");
25
- const UglifyJS = require("uglify-js");
25
+ const UglifyJS = require("terser");
26
26
 
27
27
  qx.Class.define("qx.tool.compiler.targets.meta.Uglify", {
28
28
  extend: qx.tool.compiler.targets.meta.AbstractJavascriptMeta,
29
-
29
+
30
30
  /**
31
31
  * Constructor
32
- *
32
+ *
33
33
  * @param appMeta {qx.tool.compiler.targets.meta.ApplicationMeta}
34
34
  * @param jsMeta {AbstractJavascriptMeta} the source
35
35
  */
@@ -37,17 +37,17 @@ qx.Class.define("qx.tool.compiler.targets.meta.Uglify", {
37
37
  this.base(arguments, appMeta, jsMeta.getFilename());
38
38
  this.__jsMeta = jsMeta;
39
39
  },
40
-
40
+
41
41
  properties: {
42
42
  needsWriteToDisk: {
43
43
  init: true,
44
44
  refine: true
45
45
  }
46
46
  },
47
-
47
+
48
48
  members: {
49
49
  __jsMeta: null,
50
-
50
+
51
51
  /*
52
52
  * @Override
53
53
  */
@@ -79,10 +79,10 @@ qx.Class.define("qx.tool.compiler.targets.meta.Uglify", {
79
79
  }
80
80
 
81
81
  var application = this._appMeta.getApplication();
82
-
82
+
83
83
  var outJsFilename = this.__jsMeta.getFilename();
84
84
  let baseJsFilename = path.basename(outJsFilename);
85
-
85
+
86
86
  let inSourceCode = await (async () => {
87
87
  let ss = new qx.tool.utils.Utils.ToStringWriteStream();
88
88
  let ws = new qx.tool.utils.Utils.LineCountingTransform();
@@ -96,7 +96,7 @@ qx.Class.define("qx.tool.compiler.targets.meta.Uglify", {
96
96
  })();
97
97
  await qx.tool.utils.files.Utils.safeUnlink(outJsFilename + ".unminified");
98
98
  await qx.tool.utils.files.Utils.safeRename(outJsFilename, outJsFilename + ".unminified");
99
-
99
+
100
100
  let inSourceMap = await this.__jsMeta.getSourceMap();
101
101
  await qx.tool.utils.files.Utils.safeUnlink(outJsFilename + ".unminified.map");
102
102
  await qx.tool.utils.files.Utils.safeRename(outJsFilename + ".map", outJsFilename + ".unminified.map");
@@ -107,7 +107,7 @@ qx.Class.define("qx.tool.compiler.targets.meta.Uglify", {
107
107
  url: baseJsFilename + ".map",
108
108
  includeSources: true
109
109
  };
110
- var result = UglifyJS.minify(inSourceCode, uglifyOpts);
110
+ var result = await UglifyJS.minify(inSourceCode, uglifyOpts);
111
111
  var err = result.error;
112
112
  if (err) {
113
113
  if (err.name == "SyntaxError") {
@@ -240,7 +240,8 @@ qx.Mixin.define("qx.ui.decoration.MLinearBackgroundGradient",
240
240
  *
241
241
  * @return {Boolean} Whether this implementation supports multiple gradients atop each other (true).
242
242
  */
243
- __styleLinearBackgroundGradientWithCanvas: function me(startColor, endColor, unit, orientation, startColorPosition, endColorPosition, styles, backgroundStyle) {
243
+ __styleLinearBackgroundGradientWithCanvas: function(startColor, endColor, unit, orientation, startColorPosition, endColorPosition, styles, backgroundStyle) {
244
+ const me = qx.ui.decoration.MLinearBackgroundGradient.__styleLinearBackgroundGradientWithCanvas;
244
245
  if (!me.__canvas) {
245
246
  me.__canvas = document.createElement("canvas");
246
247
  }
@@ -168,15 +168,6 @@
168
168
  },
169
169
  "parts": {
170
170
  "$ref": "#/properties/parts"
171
- },
172
- "minify": {
173
- "$ref": "#/properties/targets"
174
- },
175
- "save-source-in-map": {
176
- "$ref": "#/properties/targets"
177
- },
178
- "save-unminified": {
179
- "$ref": "#/properties/targets"
180
171
  }
181
172
  }
182
173
  }
@@ -266,11 +257,15 @@
266
257
  "type": "boolean"
267
258
  },
268
259
  "save-source-in-map": {
269
- "description": "If true, the source file will be saved in the map file if the target supports it. Can be overridden on a per application basis.",
260
+ "description": "If true, the source file will be saved in the map file if the target supports it.",
261
+ "type": "boolean"
262
+ },
263
+ "source-map-relative-paths": {
264
+ "description": "If true, the source map files will be saved with relative paths in the map file if the target supports it.",
270
265
  "type": "boolean"
271
266
  },
272
267
  "save-unminified": {
273
- "description": "If true, the unminified files will be saved if the target supports it. Can be overridden on a per application basis.",
268
+ "description": "If true, the unminified files will be saved if the target supports it.",
274
269
  "type": "boolean"
275
270
  },
276
271
  "inline-external-scripts": {
Binary file