@jsenv/core 24.4.1 → 24.4.3

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 (33) hide show
  1. package/dist/browser_runtime/asset-manifest.json +3 -0
  2. package/dist/browser_runtime/{browser_runtime-fbd309a1.js → browser_runtime-015d0fc5.js} +94 -1
  3. package/dist/browser_runtime/{browser_runtime-fbd309a1.js.map → browser_runtime-015d0fc5.js.map} +11 -3
  4. package/dist/build_manifest.js +5 -5
  5. package/dist/compile_proxy/asset-manifest.json +4 -0
  6. package/dist/compile_proxy/assets/{s.js-749702e8.map → s.js-55849eca.map} +14 -4
  7. package/dist/compile_proxy/{compile_proxy-405777e6.html → compile_proxy-2eabd1f7.html} +99 -4
  8. package/dist/compile_proxy/{compile_proxy.html__inline__20-39c0801c.js.map → compile_proxy.html__inline__20-672ba17c.js.map} +0 -0
  9. package/dist/event_source_client/asset-manifest.json +3 -0
  10. package/dist/redirector/asset-manifest.json +4 -0
  11. package/dist/{toolbar/assets/s.js-749702e8.map → redirector/assets/s.js-55849eca.map} +14 -4
  12. package/dist/redirector/{redirector-237cd168.html → redirector-3029c4d3.html} +99 -4
  13. package/dist/redirector/{redirector.html__inline__15-33acb0b9.js.map → redirector.html__inline__15-4d453af0.js.map} +0 -0
  14. package/dist/toolbar/asset-manifest.json +13 -0
  15. package/dist/{redirector/assets/s.js-749702e8.map → toolbar/assets/s.js-55849eca.map} +14 -4
  16. package/dist/toolbar/{toolbar-29e91dcd.html → toolbar-40bcd3a0.html} +94 -1
  17. package/dist/toolbar_injector/asset-manifest.json +4 -0
  18. package/dist/toolbar_injector/{toolbar_injector-0af91b43.js → toolbar_injector-0a9d5d4c.js} +2 -2
  19. package/dist/toolbar_injector/{toolbar_injector-0af91b43.js.map → toolbar_injector-0a9d5d4c.js.map} +2 -2
  20. package/package.json +10 -18
  21. package/src/internal/building/buildUsingRollup.js +2 -2
  22. package/src/internal/building/createJsenvRollupPlugin.js +67 -41
  23. package/src/internal/building/css/parseCssRessource.js +4 -1
  24. package/src/internal/building/html/parseHtmlRessource.js +16 -3
  25. package/src/internal/building/js/parseJsRessource.js +2 -0
  26. package/src/internal/building/ressource_builder.js +27 -37
  27. package/src/internal/building/ressource_builder_util.js +10 -137
  28. package/src/internal/building/svg/parseSvgRessource.js +2 -0
  29. package/src/internal/building/url_loader.js +3 -1
  30. package/src/internal/building/webmanifest/parseWebmanifestRessource.js +2 -1
  31. package/src/internal/runtime/s.js +83 -1
  32. package/dist/browser_system/browser_system-29eda202.js +0 -5160
  33. package/dist/browser_system/browser_system-29eda202.js.map +0 -1065
@@ -120,156 +120,29 @@ export const formatFoundReference = ({
120
120
  reference,
121
121
  showReferenceSourceLocation,
122
122
  referenceEffects,
123
+ shortenUrl,
123
124
  }) => {
124
- const { isRessourceHint } = reference
125
- if (isRessourceHint) {
126
- return formatFoundRessourceHint({
127
- reference,
128
- showReferenceSourceLocation,
129
- referenceEffects,
130
- })
131
- }
132
-
133
125
  const { ressource } = reference
134
126
  const { isEntryPoint } = ressource
135
127
  if (isEntryPoint) {
136
- return formatCreateReferenceForEntry({
137
- reference,
138
- showReferenceSourceLocation,
139
- referenceEffects,
140
- })
141
- }
142
-
143
- const { isExternal } = ressource
144
- if (isExternal) {
145
- return formatFoundReferenceToExternalRessource({
146
- reference,
147
- showReferenceSourceLocation,
128
+ return `
129
+ Start from entry file ${reference.ressource.relativeUrl}${appendEffects(
148
130
  referenceEffects,
149
- })
131
+ )}`
150
132
  }
151
133
 
152
134
  const { isPlaceholder } = ressource
153
135
  if (isPlaceholder) {
154
- return formatCreateRessourcePlaceholder({
155
- reference,
156
- showReferenceSourceLocation,
157
- referenceEffects,
158
- })
159
- }
160
-
161
- const { isInline, isJsModule } = ressource
162
- if (isInline && !isJsModule) {
163
- return formatFoundReferenceToInlineRessource({
164
- reference,
165
- showReferenceSourceLocation,
136
+ return `
137
+ Create placeholder for ${showReferenceSourceLocation(reference)}${appendEffects(
166
138
  referenceEffects,
167
- })
139
+ )}`
168
140
  }
169
141
 
170
- if (isInline && isJsModule) {
171
- return formatFoundReferenceToInlineModule({
172
- reference,
173
- showReferenceSourceLocation,
174
- referenceEffects,
175
- })
176
- }
177
-
178
- if (!isJsModule) {
179
- return formatFoundReferenceToRessource({
180
- reference,
181
- showReferenceSourceLocation,
182
- referenceEffects,
183
- })
184
- }
185
-
186
- return formatFoundReferenceToModule({
187
- reference,
188
- showReferenceSourceLocation,
189
- referenceEffects,
190
- })
191
- }
192
-
193
- const formatCreateReferenceForEntry = ({ reference, referenceEffects }) => {
194
- return `
195
- Start from entry file ${reference.ressource.relativeUrl}${appendEffects(
196
- referenceEffects,
197
- )}`
198
- }
199
-
200
- const formatFoundRessourceHint = ({
201
- reference,
202
- showReferenceSourceLocation,
203
- referenceEffects,
204
- }) => {
205
- return `
206
- Found ressource hint in ${showReferenceSourceLocation(
207
- reference,
208
- )}${appendEffects(referenceEffects)}`
209
- }
210
-
211
- const formatFoundReferenceToExternalRessource = ({
212
- reference,
213
- showReferenceSourceLocation,
214
- referenceEffects,
215
- }) => {
216
- return `
217
- Found external url in ${showReferenceSourceLocation(reference)}${appendEffects(
218
- referenceEffects,
219
- )}`
220
- }
221
-
222
- const formatCreateRessourcePlaceholder = ({
223
- reference,
224
- showReferenceSourceLocation,
225
- referenceEffects,
226
- }) => {
227
- return `
228
- Create placeholder for ressource in ${showReferenceSourceLocation(
229
- reference,
230
- )}${appendEffects(referenceEffects)}`
231
- }
232
-
233
- const formatFoundReferenceToInlineRessource = ({
234
- reference,
235
- showReferenceSourceLocation,
236
- referenceEffects,
237
- }) => {
238
- return `
239
- Found inline ressource in ${showReferenceSourceLocation(
240
- reference,
241
- )}${appendEffects(referenceEffects)}`
242
- }
243
-
244
- const formatFoundReferenceToInlineModule = ({
245
- reference,
246
- showReferenceSourceLocation,
247
- referenceEffects,
248
- }) => {
249
- return `
250
- Found inline module in ${showReferenceSourceLocation(reference)}${appendEffects(
251
- referenceEffects,
252
- )}`
253
- }
254
-
255
- const formatFoundReferenceToRessource = ({
256
- reference,
257
- showReferenceSourceLocation,
258
- referenceEffects,
259
- }) => {
260
- return `
261
- Found ressource in ${showReferenceSourceLocation(reference)}${appendEffects(
262
- referenceEffects,
263
- )}`
264
- }
265
-
266
- const formatFoundReferenceToModule = ({
267
- reference,
268
- showReferenceSourceLocation,
269
- referenceEffects,
270
- }) => {
142
+ const { referenceLabel = "unlabelled reference" } = reference
271
143
  return `
272
- Found module script in ${showReferenceSourceLocation(reference)}${appendEffects(
144
+ Found "${referenceLabel}" referencing "${shortenUrl(reference.ressource.url)}"
145
+ in ${showReferenceSourceLocation(reference)}${appendEffects(
273
146
  referenceEffects,
274
147
  )}`
275
148
  }
@@ -60,6 +60,7 @@ const imageHrefVisitor = (image, { notifyReferenceFound }) => {
60
60
  }
61
61
 
62
62
  const hrefReference = notifyReferenceFound({
63
+ referenceLabel: "svg image href",
63
64
  ressourceSpecifier: hrefAttribute.value,
64
65
  ...referenceLocationFromHtmlNode(image, "href"),
65
66
  })
@@ -81,6 +82,7 @@ const useHrefVisitor = (use, { notifyReferenceFound }) => {
81
82
 
82
83
  const { hash } = new URL(href, "file://")
83
84
  const hrefReference = notifyReferenceFound({
85
+ referenceLabel: "svg use href",
84
86
  ressourceSpecifier: href,
85
87
  ...referenceLocationFromHtmlNode(use, "href"),
86
88
  })
@@ -30,6 +30,7 @@ export const createUrlLoader = ({
30
30
  const importer = urlImporterMap[url]
31
31
  const cssReference =
32
32
  await ressourceBuilder.createReferenceFoundInJsModule({
33
+ referenceLabel: "css import assertion",
33
34
  // If all references to a ressource are only import assertions
34
35
  // the file referenced do not need to be written on filesystem
35
36
  // as it was converted to a js file
@@ -84,6 +85,7 @@ export const createUrlLoader = ({
84
85
  const importer = urlImporterMap[url]
85
86
  const jsonReference =
86
87
  await ressourceBuilder.createReferenceFoundInJsModule({
88
+ referenceLabel: "json import assertion",
87
89
  // If all references to a ressource are only import assertions
88
90
  // the file referenced do not need to be written on filesystem
89
91
  // as it was converted to a js file
@@ -114,7 +116,7 @@ export const createUrlLoader = ({
114
116
 
115
117
  if (url in inlineModuleScripts) {
116
118
  const transformResult = await transformJs({
117
- code: inlineModuleScripts[url],
119
+ code: String(inlineModuleScripts[url].bufferBeforeBuild),
118
120
  url: asOriginalUrl(url), // transformJs expect a file:// url
119
121
  projectDirectoryUrl,
120
122
  babelPluginMap,
@@ -9,8 +9,9 @@ export const parseWebmanifestRessource = (
9
9
  const manifest = JSON.parse(manifestString)
10
10
  const { icons = [] } = manifest
11
11
 
12
- const iconReferences = icons.map((icon) => {
12
+ const iconReferences = icons.map((icon, index) => {
13
13
  const iconReference = notifyReferenceFound({
14
+ referenceLabel: `web manifest icon ${index}`,
14
15
  ressourceSpecifier: icon.src,
15
16
  })
16
17
  return iconReference
@@ -725,4 +725,86 @@
725
725
  });
726
726
  };
727
727
 
728
- }());
728
+ }());
729
+
730
+ (function(){/*
731
+ * SystemJS named register extension
732
+ * Supports System.register('name', [..deps..], function (_export, _context) { ... })
733
+ *
734
+ * Names are written to the registry as-is
735
+ * System.register('x', ...) can be imported as System.import('x')
736
+ */
737
+ (function (global) {
738
+ var System = global.System;
739
+ setRegisterRegistry(System);
740
+ var systemJSPrototype = System.constructor.prototype;
741
+ var constructor = System.constructor;
742
+ var SystemJS = function () {
743
+ constructor.call(this);
744
+ setRegisterRegistry(this);
745
+ };
746
+ SystemJS.prototype = systemJSPrototype;
747
+ System.constructor = SystemJS;
748
+
749
+ var firstNamedDefine, firstName;
750
+
751
+ function setRegisterRegistry(systemInstance) {
752
+ systemInstance.registerRegistry = Object.create(null);
753
+ systemInstance.namedRegisterAliases = Object.create(null);
754
+ }
755
+
756
+ var register = systemJSPrototype.register;
757
+ systemJSPrototype.register = function (name, deps, declare) {
758
+ if (typeof name !== 'string')
759
+ return register.apply(this, arguments);
760
+ var define = [deps, declare];
761
+ this.registerRegistry[name] = define;
762
+ if (!firstNamedDefine) {
763
+ firstNamedDefine = define;
764
+ firstName = name;
765
+ }
766
+ Promise.resolve().then(function () {
767
+ firstNamedDefine = null;
768
+ firstName = null;
769
+ });
770
+ return register.apply(this, [deps, declare]);
771
+ };
772
+
773
+ var resolve = systemJSPrototype.resolve;
774
+ systemJSPrototype.resolve = function (id, parentURL) {
775
+ try {
776
+ // Prefer import map (or other existing) resolution over the registerRegistry
777
+ return resolve.call(this, id, parentURL);
778
+ } catch (err) {
779
+ if (id in this.registerRegistry) {
780
+ return this.namedRegisterAliases[id] || id;
781
+ }
782
+ throw err;
783
+ }
784
+ };
785
+
786
+ var instantiate = systemJSPrototype.instantiate;
787
+ systemJSPrototype.instantiate = function (url, firstParentUrl) {
788
+ var result = this.registerRegistry[url];
789
+ if (result) {
790
+ this.registerRegistry[url] = null;
791
+ return result;
792
+ } else {
793
+ return instantiate.call(this, url, firstParentUrl);
794
+ }
795
+ };
796
+
797
+ var getRegister = systemJSPrototype.getRegister;
798
+ systemJSPrototype.getRegister = function (url) {
799
+ // Calling getRegister() because other extras need to know it was called so they can perform side effects
800
+ var register = getRegister.call(this, url);
801
+
802
+ if (firstName && url) {
803
+ this.namedRegisterAliases[firstName] = url;
804
+ }
805
+ var result = firstNamedDefine || register;
806
+ firstNamedDefine = null;
807
+ firstName = null;
808
+ return result;
809
+ };
810
+ })(typeof self !== 'undefined' ? self : global);}());