@qooxdoo/framework 7.0.0-beta.3 → 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 (105) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/Manifest.json +1 -1
  3. package/README.md +9 -3
  4. package/lib/compiler/compile-info.json +60 -58
  5. package/lib/compiler/index.js +3242 -1883
  6. package/lib/resource/qx/tool/cli/templates/skeleton/mobile/source/theme/custom/css/custom.css.map +1 -1
  7. package/lib/resource/qx/tool/loadsass.js +6 -4
  8. package/lib/resource/qx/tool/schema/compile-1-0-0.json +6 -11
  9. package/package.json +17 -3
  10. package/source/class/qx/Bootstrap.js +22 -1
  11. package/source/class/qx/bom/Blocker.js +2 -1
  12. package/source/class/qx/core/Environment.js +3 -12
  13. package/source/class/qx/core/MProperty.js +1 -1
  14. package/source/class/qx/dev/unit/Sinon.js +1 -1
  15. package/source/class/qx/io/__init__.js +5 -3
  16. package/source/class/qx/io/exception/Cancel.js +34 -0
  17. package/source/class/qx/io/exception/Exception.js +38 -0
  18. package/source/class/qx/io/exception/Protocol.js +26 -0
  19. package/source/class/qx/io/exception/Transport.js +39 -0
  20. package/source/class/qx/io/exception/__init__.js +4 -0
  21. package/source/class/qx/io/graphql/Client.js +112 -0
  22. package/source/class/qx/io/graphql/__init__.js +9 -0
  23. package/source/class/qx/io/graphql/protocol/Message.js +65 -0
  24. package/source/class/qx/io/graphql/protocol/Request.js +95 -0
  25. package/source/class/qx/io/graphql/protocol/Response.js +61 -0
  26. package/source/class/qx/io/graphql/protocol/__init__.js +6 -0
  27. package/source/class/qx/io/jsonrpc/Client.js +323 -0
  28. package/source/class/qx/io/jsonrpc/__init__.js +15 -0
  29. package/source/class/qx/io/jsonrpc/protocol/Batch.js +97 -0
  30. package/source/class/qx/io/jsonrpc/protocol/Error.js +63 -0
  31. package/source/class/qx/io/jsonrpc/protocol/Message.js +48 -0
  32. package/source/class/qx/io/jsonrpc/protocol/Notification.js +45 -0
  33. package/source/class/qx/io/jsonrpc/protocol/Parser.js +81 -0
  34. package/source/class/qx/io/jsonrpc/protocol/Request.js +93 -0
  35. package/source/class/qx/io/jsonrpc/protocol/Result.js +48 -0
  36. package/source/class/qx/io/jsonrpc/protocol/__init__.js +5 -0
  37. package/source/class/qx/io/request/authentication/Bearer.js +52 -0
  38. package/source/class/qx/io/transport/AbstractClient.js +100 -0
  39. package/source/class/qx/io/transport/AbstractTransport.js +41 -0
  40. package/source/class/qx/io/transport/Fetch.js +95 -0
  41. package/source/class/qx/io/transport/ITransport.js +40 -0
  42. package/source/class/qx/io/transport/PostMessage.js +55 -0
  43. package/source/class/qx/io/transport/Websocket.js +97 -0
  44. package/source/class/qx/io/transport/Xhr.js +139 -0
  45. package/source/class/qx/io/transport/__init__.js +18 -0
  46. package/source/class/qx/test/core/Assert.js +1 -1
  47. package/source/class/qx/test/core/Environment.js +0 -3
  48. package/source/class/qx/test/io/MAssert.js +46 -0
  49. package/source/class/qx/test/io/graphql/Client.js +169 -0
  50. package/source/class/qx/test/io/graphql/ClientFetch.js +34 -0
  51. package/source/class/qx/test/io/graphql/Request.js +42 -0
  52. package/source/class/qx/test/io/jsonrpc/Client.js +267 -0
  53. package/source/class/qx/test/io/jsonrpc/Protocol.js +80 -0
  54. package/source/class/qx/test/io/transport/PostMessage.js +56 -0
  55. package/source/class/qx/test/io/transport/Websocket.js +63 -0
  56. package/source/class/qx/test/ui/embed/Iframe.js +1 -1
  57. package/source/class/qx/test/util/DateFormat.js +45 -6
  58. package/source/class/qx/tool/cli/Cli.js +1 -0
  59. package/source/class/qx/tool/cli/commands/Compile.js +13 -3
  60. package/source/class/qx/tool/cli/commands/Es6ify.js +93 -0
  61. package/source/class/qx/tool/cli/commands/package/Install.js +1 -1
  62. package/source/class/qx/tool/cli/commands/package/Publish.js +14 -0
  63. package/source/class/qx/tool/compiler/ClassFile.js +67 -27
  64. package/source/class/qx/tool/compiler/Es6ify.js +368 -0
  65. package/source/class/qx/tool/compiler/makers/AppMaker.js +2 -1
  66. package/source/class/qx/tool/compiler/targets/Target.js +57 -47
  67. package/source/class/qx/tool/compiler/targets/meta/AbstractJavascriptMeta.js +25 -18
  68. package/source/class/qx/tool/compiler/targets/meta/BootJs.js +16 -16
  69. package/source/class/qx/tool/compiler/targets/meta/PolyfillJs.js +11 -3
  70. package/source/class/qx/tool/compiler/targets/meta/Uglify.js +10 -10
  71. package/source/class/qx/ui/core/Widget.js +70 -0
  72. package/source/class/qx/ui/decoration/MLinearBackgroundGradient.js +2 -1
  73. package/source/class/qx/ui/form/ComboBox.js +8 -3
  74. package/source/class/qx/ui/form/DateField.js +16 -1
  75. package/source/class/qx/ui/form/MenuButton.js +8 -4
  76. package/source/class/qx/ui/form/SelectBox.js +8 -3
  77. package/source/class/qx/ui/menu/AbstractButton.js +12 -8
  78. package/source/class/qx/ui/menu/Menu.js +18 -8
  79. package/source/class/qx/ui/table/pane/Model.js +10 -4
  80. package/source/class/qx/ui/window/Window.js +8 -0
  81. package/source/class/qx/util/format/DateFormat.js +44 -17
  82. package/source/resource/qx/tool/loadsass.js +6 -4
  83. package/source/resource/qx/tool/schema/compile-1-0-0.json +6 -11
  84. package/source/translation/hr.po +297 -0
  85. package/lib/resource/qx/static/blank.gif +0 -0
  86. package/source/class/qx/io/remote/Exchange.js +0 -1063
  87. package/source/class/qx/io/remote/Request.js +0 -1021
  88. package/source/class/qx/io/remote/RequestQueue.js +0 -521
  89. package/source/class/qx/io/remote/Response.js +0 -137
  90. package/source/class/qx/io/remote/Rpc.js +0 -1075
  91. package/source/class/qx/io/remote/RpcError.js +0 -198
  92. package/source/class/qx/io/remote/__init__.js +0 -88
  93. package/source/class/qx/io/remote/transport/Abstract.js +0 -513
  94. package/source/class/qx/io/remote/transport/Iframe.js +0 -652
  95. package/source/class/qx/io/remote/transport/Script.js +0 -475
  96. package/source/class/qx/io/remote/transport/XmlHttp.js +0 -1019
  97. package/source/class/qx/io/remote/transport/__init__.js +0 -3
  98. package/source/class/qx/test/io/remote/AbstractRequest.js +0 -150
  99. package/source/class/qx/test/io/remote/RequestIframe.js +0 -105
  100. package/source/class/qx/test/io/remote/RequestXhr.js +0 -151
  101. package/source/class/qx/test/io/remote/Rpc.js +0 -205
  102. package/source/class/qx/test/io/remote/__init__.js +0 -4
  103. package/source/class/qx/test/io/remote/transport/Iframe.js +0 -67
  104. package/source/class/qx/test/io/remote/transport/XmlHttp.js +0 -133
  105. package/source/class/qx/test/io/remote/transport/__init__.js +0 -4
@@ -81,7 +81,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
81
81
  inheritable: true,
82
82
  nullable: true
83
83
  },
84
-
84
+
85
85
  /**
86
86
  * List of environment keys to preserve in code, ie reserve for runtime detection
87
87
  * and exclude from code elimination
@@ -98,7 +98,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
98
98
  analyser: {
99
99
  nullable: false
100
100
  },
101
-
101
+
102
102
  /**
103
103
  * Whether to inline external scripts
104
104
  */
@@ -121,7 +121,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
121
121
  init: [ "en" ],
122
122
  transform: "_transformLocales"
123
123
  },
124
-
124
+
125
125
  /** Whether to break locale & translation data out into separate parts */
126
126
  i18nAsParts: {
127
127
  init: false,
@@ -142,7 +142,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
142
142
  nullable: false,
143
143
  check: "Boolean"
144
144
  },
145
-
145
+
146
146
  /** What to do with library transation strings */
147
147
  libraryPoPolicy: {
148
148
  init: "ignore",
@@ -166,6 +166,15 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
166
166
  init: true,
167
167
  nullable: false,
168
168
  check: "Boolean"
169
+ },
170
+
171
+ /**
172
+ * Whether to use relative paths in source maps
173
+ */
174
+ sourceMapRelativePaths: {
175
+ init: false,
176
+ nullable: false,
177
+ check: "Boolean"
169
178
  }
170
179
 
171
180
  },
@@ -178,15 +187,15 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
178
187
  * enviroment: {Object} enviroment data
179
188
  */
180
189
  "checkEnvironment": "qx.event.type.Data",
181
-
182
- /**
190
+
191
+ /**
183
192
  * Fired when an application is about to be serialized to disk; the appMeta is fully
184
193
  * populated, and this is an opportunity to amend the meta data before it is serialized
185
- * into files on disk
194
+ * into files on disk
186
195
  */
187
196
  "writingApplication": "qx.event.type.Event",
188
-
189
- /**
197
+
198
+ /**
190
199
  * Fired when an application has been serialized to disk
191
200
  */
192
201
  "writtenApplication": "qx.event.type.Event"
@@ -196,10 +205,10 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
196
205
  members: {
197
206
  /** @type {Map} maps filenames to uris */
198
207
  __pathMappings: null,
199
-
208
+
200
209
  /** @type {qx.tool.compiler.targets.meta.ApplicationMeta} for the current application */
201
210
  __appMeta: null,
202
-
211
+
203
212
  /**
204
213
  * Initialises the target, creating directories etc
205
214
  */
@@ -221,7 +230,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
221
230
  }
222
231
  return value;
223
232
  },
224
-
233
+
225
234
  /**
226
235
  * Returns the root for applications
227
236
  */
@@ -237,7 +246,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
237
246
  getProjectDir: function (application) {
238
247
  return application.getOutputPath() || application.getName();
239
248
  },
240
-
249
+
241
250
  /**
242
251
  * Returns the URI for the root of the output, relative to the application
243
252
  */
@@ -331,22 +340,22 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
331
340
 
332
341
  let appMeta = this.__appMeta = new qx.tool.compiler.targets.meta.ApplicationMeta(this, application);
333
342
  appMeta.setAddTimestampsToUrls(this.getAddTimestampsToUrls());
334
- /*
343
+ /*
335
344
  if (!appMeta.getAppLibrary()) {
336
345
  qx.tool.compiler.Console.print("qx.tool.compiler.target.missingAppLibrary", application.getClassName());
337
346
  return;
338
347
  }
339
- */
348
+ */
340
349
  let targetUri = t._getOutputRootUri(application);
341
350
  var appRootDir = this.getApplicationRoot(application);
342
-
351
+
343
352
  let mapTo = this.getPathMapping(path.join(appRootDir, this.getOutputDir(), "transpiled/"));
344
353
  appMeta.setSourceUri(mapTo ? mapTo : targetUri + "transpiled/");
345
354
  mapTo = this.getPathMapping(path.join(appRootDir, this.getOutputDir(), "resource"));
346
355
  appMeta.setResourceUri(mapTo ? mapTo : targetUri + "resource");
347
-
356
+
348
357
  const requiredLibs = application.getRequiredLibraries();
349
-
358
+
350
359
  await qx.tool.utils.Utils.makeDirs(appRootDir);
351
360
 
352
361
  appMeta.setEnvironment({
@@ -357,7 +366,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
357
366
  "qx.compiler.targetType": this.getType(),
358
367
  "qx.compiler.outputDir": this.getOutputDir()
359
368
  });
360
-
369
+
361
370
  let externals = {};
362
371
  const addExternal = (arr, type) => {
363
372
  if (arr) {
@@ -380,7 +389,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
380
389
  });
381
390
  }
382
391
  };
383
-
392
+
384
393
  requiredLibs.forEach(libnamespace => {
385
394
  var library = analyser.findLibrary(libnamespace);
386
395
  appMeta.addLibrary(library);
@@ -400,7 +409,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
400
409
  }
401
410
  await t.fireDataEventAsync("checkEnvironment", { application: application, environment: appMeta.getEnvironment() });
402
411
 
403
-
412
+
404
413
  /*
405
414
  * Boot files
406
415
  */
@@ -408,7 +417,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
408
417
  let bootPackage = appMeta.createPackage();
409
418
  appMeta.setBootMetaJs(bootJs);
410
419
  bootPackage.addJavascriptMeta(new qx.tool.compiler.targets.meta.PolyfillJs(appMeta));
411
-
420
+
412
421
 
413
422
  /*
414
423
  * Assemble the Parts
@@ -425,7 +434,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
425
434
  if (index == 0) {
426
435
  partMeta.addPackage(bootPackage);
427
436
  }
428
-
437
+
429
438
  partData.classes.forEach(classname => {
430
439
  let classFilename = classname.replace(/\./g, "/") + ".js";
431
440
 
@@ -435,10 +444,10 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
435
444
  let library = analyser.findLibrary(dbClassInfo.libraryName);
436
445
  let sourcePath = library.getFilename(classFilename);
437
446
  let jsMeta = new qx.tool.compiler.targets.meta.Javascript(appMeta, transpiledClassFilename, sourcePath);
438
-
447
+
439
448
  let packageName = matchBundle(classname) ? "__bundle" : partData.name;
440
449
  let pkg = packages[packageName];
441
-
450
+
442
451
  if (!pkg || pkg !== lastPackage) {
443
452
  pkg = packages[packageName] = appMeta.createPackage();
444
453
  if (packageName == "__bundle") {
@@ -454,7 +463,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
454
463
  lastPackage = pkg;
455
464
  });
456
465
  });
457
-
466
+
458
467
  var assetUris = application.getAssetUris(t, rm, appMeta.getEnvironment()); // Save any changes that getAssets collected
459
468
  await rm.saveDatabase();
460
469
 
@@ -462,8 +471,8 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
462
471
  analyser.getCldr("en")
463
472
  .then(cldr => bootPackage.addLocale("C", cldr)),
464
473
  t._writeTranslations()
465
- ];
466
-
474
+ ];
475
+
467
476
  var fontCntr = 0;
468
477
  var assets = {};
469
478
  rm.getAssetsForPaths(assetUris).forEach(asset => {
@@ -475,7 +484,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
475
484
  // Get a list of all fonts to load; use the font name as a unique identifier, and
476
485
  // prioritise the application's library's definitions - this allows the application
477
486
  // the opportunity to override the font definitions. This is important when the
478
- // library uses the open source/free versions of a font but the application
487
+ // library uses the open source/free versions of a font but the application
479
488
  // developer has purchased the commercial/full version of the font (eg FontAwesome)
480
489
  let appLibrary = appMeta.getAppLibrary();
481
490
  let fontsToLoad = { };
@@ -507,7 +516,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
507
516
  return;
508
517
  }
509
518
  font.setResources(res);
510
-
519
+
511
520
  await font.generateForTarget(t);
512
521
  let resources = await font.generateForApplication(t, application);
513
522
  for (var key in resources) {
@@ -617,10 +626,10 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
617
626
  return accumulateCldr(localeId);
618
627
  }
619
628
 
620
- var promises = t.getLocales().map(async localeId => {
629
+ var promises = t.getLocales().map(async localeId => {
621
630
  let cldr = await loadLocaleData(localeId);
622
631
  let pkg = this.isI18nAsParts() ? appMeta.getLocalePackage(localeId) : bootPackage;
623
- pkg.addLocale(localeId, cldr);
632
+ pkg.addLocale(localeId, cldr);
624
633
  });
625
634
 
626
635
  await qx.Promise.all(promises);
@@ -656,8 +665,8 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
656
665
  promises.push(
657
666
  addTrans(library, localeId)
658
667
  );
659
- });
660
- // translation from main app should overwrite package translations
668
+ });
669
+ // translation from main app should overwrite package translations
661
670
  promises.push(
662
671
  addTrans(appMeta.getAppLibrary(), localeId)
663
672
  );
@@ -726,24 +735,24 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
726
735
  });
727
736
  });
728
737
  },
729
-
738
+
730
739
  /**
731
740
  * Writes the application
732
741
  */
733
742
  async _writeApplication() {
734
743
  var t = this;
735
-
744
+
736
745
  await this.fireEventAsync("writingApplication");
737
-
746
+
738
747
  let appMeta = this.getAppMeta();
739
748
  var application = appMeta.getApplication();
740
749
  var appRootDir = appMeta.getApplicationRoot();
741
-
750
+
742
751
  if (!appMeta.getAppLibrary()) {
743
752
  qx.tool.compiler.Console.print("qx.tool.compiler.target.missingAppLibrary", application.getName());
744
753
  return;
745
754
  }
746
-
755
+
747
756
  let bootMeta = appMeta.getBootMetaJs();
748
757
  for (let arr = appMeta.getPackages(), i = 0; i < arr.length; i++) {
749
758
  let pkg = arr[i];
@@ -753,16 +762,16 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
753
762
  }
754
763
  await pkg.getJavascript().unwrap().writeToDisk();
755
764
  }
756
-
765
+
757
766
  await appMeta.getBootMetaJs().unwrap().writeToDisk();
758
-
767
+
759
768
  await this._writeIndexHtml();
760
769
 
761
770
  if (!t.isWriteCompileInfo()) {
762
771
  await this.fireEventAsync("writtenApplication");
763
772
  return;
764
773
  }
765
-
774
+
766
775
  let bootPackage = appMeta.getPackages()[0];
767
776
  let appSummary = {
768
777
  appClass: application.getClassName(),
@@ -783,11 +792,11 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
783
792
  name: partData.name
784
793
  });
785
794
  });
786
-
795
+
787
796
  await fs.writeFileAsync(appRootDir + "/compile-info.json",
788
797
  JSON.stringify(appSummary, null, 2) + "\n",
789
798
  { encoding: "utf8" });
790
-
799
+
791
800
  await this.fireEventAsync("writtenApplication");
792
801
  },
793
802
 
@@ -808,7 +817,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
808
817
  }
809
818
 
810
819
  var resDir = this.getApplicationRoot(application);
811
-
820
+
812
821
  let timeStamp = (new Date()).getTime();
813
822
  let pathToTarget = path.relative(path.join(t.getOutputDir(), t.getProjectDir(application)), t.getOutputDir()) + "/";
814
823
  let indexJsTimestamp = "";
@@ -894,12 +903,13 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
894
903
  "appPath": t.getProjectDir(application) + "/",
895
904
  "preBootJs": "",
896
905
  "appTitle": (application.getTitle()||"Qooxdoo Application"),
897
- "timeStamp": timeStamp
906
+ "timeStamp": timeStamp,
907
+ "indexJsTimestamp": indexJsTimestamp
898
908
  };
899
909
  await fs.writeFileAsync(t.getOutputDir() + "index.html", replaceVars(indexHtml), { encoding: "utf8" });
900
910
  }
901
911
  },
902
-
912
+
903
913
  getAppMeta() {
904
914
  return this.__appMeta;
905
915
  }
@@ -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;
@@ -42,11 +42,18 @@ qx.Class.define("qx.tool.compiler.targets.meta.PolyfillJs", {
42
42
 
43
43
  members: {
44
44
 
45
- /*
45
+ /**
46
46
  * @Override
47
47
  */
48
48
  async writeSourceCodeToStream(ws) {
49
- const srcFilename = path.join(require.resolve("core-js-bundle"), "../minified.js");
49
+ await this.__write(path.join(require.resolve("core-js-bundle"), "../minified.js"), ws);
50
+ await new Promise(resolve => {
51
+ ws.write("\n", resolve);
52
+ });
53
+ await this.__write(path.join(require.resolve("regenerator-runtime"), "../runtime.js"), ws);
54
+ },
55
+
56
+ async __write(srcFilename, ws) {
50
57
  let rs = fs.createReadStream(srcFilename, "utf8");
51
58
  await new Promise((resolve, reject) => {
52
59
  rs.on("end", resolve);
@@ -55,7 +62,8 @@ qx.Class.define("qx.tool.compiler.targets.meta.PolyfillJs", {
55
62
  });
56
63
  },
57
64
 
58
- /*
65
+
66
+ /**
59
67
  * @Override
60
68
  */
61
69
  async getSourceMap() {
@@ -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") {