@jsenv/core 28.6.0 → 29.0.0

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.
package/dist/main.js CHANGED
@@ -11119,20 +11119,6 @@ const jsenvPluginAsJsClassic = ({
11119
11119
  })] : [])];
11120
11120
  };
11121
11121
 
11122
- const jsenvPluginLeadingSlash = () => {
11123
- return {
11124
- name: "jsenv:leading_slash",
11125
- appliesDuring: "*",
11126
- resolveUrl: (reference, context) => {
11127
- if (reference.specifier[0] !== "/") {
11128
- return null;
11129
- }
11130
-
11131
- return new URL(reference.specifier.slice(1), context.rootDirectoryUrl).href;
11132
- }
11133
- };
11134
- };
11135
-
11136
11122
  // duplicated from @jsenv/log to avoid the dependency
11137
11123
  const createDetailedMessage = (message, details = {}) => {
11138
11124
  let string = `${message}`;
@@ -12022,48 +12008,6 @@ const jsenvPluginImportmap = () => {
12022
12008
  };
12023
12009
  };
12024
12010
 
12025
- const jsenvPluginUrlResolution = ({
12026
- clientMainFileUrl
12027
- }) => {
12028
- const urlResolver = reference => {
12029
- return new URL(reference.specifier, reference.baseUrl || reference.parentUrl).href;
12030
- };
12031
-
12032
- return {
12033
- name: "jsenv:url_resolution",
12034
- appliesDuring: "*",
12035
- resolveUrl: {
12036
- "http_request": reference => {
12037
- if (reference.specifier === "/") {
12038
- return String(clientMainFileUrl);
12039
- }
12040
-
12041
- return urlResolver(reference);
12042
- },
12043
- "entry_point": urlResolver,
12044
- // during build
12045
- "link_href": urlResolver,
12046
- "script_src": urlResolver,
12047
- "a_href": urlResolver,
12048
- "iframe_src": urlResolver,
12049
- "img_src": urlResolver,
12050
- "img_srcset": urlResolver,
12051
- "source_src": urlResolver,
12052
- "source_srcset": urlResolver,
12053
- "image_href": urlResolver,
12054
- "use_href": urlResolver,
12055
- "css_@import": urlResolver,
12056
- "css_url": urlResolver,
12057
- "sourcemap_comment": urlResolver,
12058
- "js_import_export": urlResolver,
12059
- "js_url_specifier": urlResolver,
12060
- "js_inline_content": urlResolver,
12061
- "webmanifest_icon_src": urlResolver,
12062
- "package_json": urlResolver
12063
- }
12064
- };
12065
- };
12066
-
12067
12011
  const isSpecifierForNodeBuiltin = specifier => {
12068
12012
  return specifier.startsWith("node:") || NODE_BUILTIN_MODULE_SPECIFIERS.includes(specifier);
12069
12013
  };
@@ -13354,136 +13298,208 @@ const getExtensionsToTry = (magicExtensions, importer) => {
13354
13298
  * if that comes from node resolution or anything else (not even magic resolution)
13355
13299
  * it should likely be an other plugin happening after the others
13356
13300
  */
13357
- const jsenvPluginNodeEsmResolution = ({
13301
+ const createNodeEsmResolver = ({
13302
+ runtimeCompat,
13358
13303
  packageConditions
13359
13304
  }) => {
13360
- const addRelationshipWithPackageJson = ({
13361
- context,
13362
- packageJsonUrl,
13363
- field,
13364
- hasVersioningEffect = false
13365
- }) => {
13366
- const referenceFound = context.referenceUtils.find(ref => ref.type === "package_json" && ref.subtype === field);
13305
+ const nodeRuntimeEnabled = Object.keys(runtimeCompat).includes("node"); // https://nodejs.org/api/esm.html#resolver-algorithm-specification
13367
13306
 
13368
- if (referenceFound) {
13369
- return;
13370
- }
13371
-
13372
- const [, packageJsonUrlInfo] = context.referenceUtils.inject({
13373
- type: "package_json",
13374
- subtype: field,
13375
- specifier: packageJsonUrl,
13376
- isImplicit: true,
13377
- hasVersioningEffect
13307
+ packageConditions = packageConditions || [...readCustomConditionsFromProcessArgs(), nodeRuntimeEnabled ? "node" : "browser", "import"];
13308
+ return (reference, context) => {
13309
+ const {
13310
+ parentUrl,
13311
+ specifier
13312
+ } = reference;
13313
+ const {
13314
+ url,
13315
+ type,
13316
+ packageUrl
13317
+ } = applyNodeEsmResolution({
13318
+ conditions: packageConditions,
13319
+ parentUrl,
13320
+ specifier
13378
13321
  });
13379
13322
 
13380
- if (packageJsonUrlInfo.type === undefined) {
13381
- const packageJsonContentAsBuffer = readFileSync$1(new URL(packageJsonUrl));
13382
- packageJsonUrlInfo.type = "json";
13383
- packageJsonUrlInfo.content = String(packageJsonContentAsBuffer);
13384
- packageJsonUrlInfo.originalContentEtag = packageJsonUrlInfo.contentEtag = bufferToEtag$1(packageJsonContentAsBuffer);
13385
- }
13386
- };
13387
-
13388
- return {
13389
- name: "jsenv:node_esm_resolution",
13390
- appliesDuring: "*",
13391
- init: context => {
13392
- const nodeRuntimeEnabled = Object.keys(context.runtimeCompat).includes("node"); // https://nodejs.org/api/esm.html#resolver-algorithm-specification
13323
+ if (context.scenarios.dev) {
13324
+ const dependsOnPackageJson = type !== "relative_specifier" && type !== "absolute_specifier" && type !== "node_builtin_specifier";
13393
13325
 
13394
- packageConditions = packageConditions || [...readCustomConditionsFromProcessArgs(), nodeRuntimeEnabled ? "node" : "browser", "import"];
13395
- },
13396
- resolveUrl: {
13397
- js_import_export: (reference, context) => {
13398
- const {
13399
- parentUrl,
13400
- specifier
13401
- } = reference;
13402
- const {
13403
- url,
13404
- type,
13405
- packageUrl
13406
- } = applyNodeEsmResolution({
13407
- conditions: packageConditions,
13408
- parentUrl,
13409
- specifier
13326
+ if (dependsOnPackageJson) {
13327
+ // this reference depends on package.json and node_modules
13328
+ // to be resolved. Each file using this specifier
13329
+ // must be invalidated when corresponding package.json changes
13330
+ addRelationshipWithPackageJson({
13331
+ reference,
13332
+ context,
13333
+ packageJsonUrl: `${packageUrl}package.json`,
13334
+ field: type.startsWith("field:") ? `#${type.slice("field:".length)}` : ""
13410
13335
  });
13336
+ }
13337
+ }
13411
13338
 
13412
- if (context.scenarios.dev) {
13413
- const dependsOnPackageJson = type !== "relative_specifier" && type !== "absolute_specifier" && type !== "node_builtin_specifier";
13339
+ if (context.scenarios.dev) {
13340
+ // without this check a file inside a project without package.json
13341
+ // could be considered as a node module if there is a ancestor package.json
13342
+ // but we want to version only node modules
13343
+ if (url.includes("/node_modules/")) {
13344
+ const packageDirectoryUrl = defaultLookupPackageScope(url);
13414
13345
 
13415
- if (dependsOnPackageJson) {
13416
- // this reference depends on package.json and node_modules
13417
- // to be resolved. Each file using this specifier
13418
- // must be invalidated when corresponding package.json changes
13346
+ if (packageDirectoryUrl && packageDirectoryUrl !== context.rootDirectoryUrl) {
13347
+ const packageVersion = defaultReadPackageJson(packageDirectoryUrl).version; // package version can be null, see https://github.com/babel/babel/blob/2ce56e832c2dd7a7ed92c89028ba929f874c2f5c/packages/babel-runtime/helpers/esm/package.json#L2
13348
+
13349
+ if (packageVersion) {
13419
13350
  addRelationshipWithPackageJson({
13420
13351
  reference,
13421
13352
  context,
13422
- packageJsonUrl: `${packageUrl}package.json`,
13423
- field: type.startsWith("field:") ? `#${type.slice("field:".length)}` : ""
13353
+ packageJsonUrl: `${packageDirectoryUrl}package.json`,
13354
+ field: "version",
13355
+ hasVersioningEffect: true
13424
13356
  });
13425
13357
  }
13426
- }
13427
13358
 
13428
- return url;
13429
- }
13430
- },
13431
- transformUrlSearchParams: (reference, context) => {
13432
- if (reference.type === "package_json") {
13433
- return null;
13359
+ reference.version = packageVersion;
13360
+ }
13434
13361
  }
13362
+ }
13435
13363
 
13436
- if (context.scenarios.build) {
13437
- return null;
13438
- }
13364
+ return url;
13365
+ };
13366
+ };
13439
13367
 
13440
- if (!reference.url.startsWith("file:")) {
13441
- return null;
13442
- } // without this check a file inside a project without package.json
13443
- // could be considered as a node module if there is a ancestor package.json
13444
- // but we want to version only node modules
13368
+ const addRelationshipWithPackageJson = ({
13369
+ context,
13370
+ packageJsonUrl,
13371
+ field,
13372
+ hasVersioningEffect = false
13373
+ }) => {
13374
+ const referenceFound = context.referenceUtils.find(ref => ref.type === "package_json" && ref.subtype === field);
13375
+
13376
+ if (referenceFound) {
13377
+ return;
13378
+ }
13445
13379
 
13380
+ const [, packageJsonUrlInfo] = context.referenceUtils.inject({
13381
+ type: "package_json",
13382
+ subtype: field,
13383
+ specifier: packageJsonUrl,
13384
+ isImplicit: true,
13385
+ hasVersioningEffect
13386
+ });
13446
13387
 
13447
- if (!reference.url.includes("/node_modules/")) {
13448
- return null;
13449
- }
13388
+ if (packageJsonUrlInfo.type === undefined) {
13389
+ const packageJsonContentAsBuffer = readFileSync$1(new URL(packageJsonUrl));
13390
+ packageJsonUrlInfo.type = "json";
13391
+ packageJsonUrlInfo.content = String(packageJsonContentAsBuffer);
13392
+ packageJsonUrlInfo.originalContentEtag = packageJsonUrlInfo.contentEtag = bufferToEtag$1(packageJsonContentAsBuffer);
13393
+ }
13394
+ };
13450
13395
 
13451
- if (reference.searchParams.has("v")) {
13452
- return null;
13453
- }
13396
+ /*
13397
+ * This plugin is responsible to resolve urls except for a few cases:
13398
+ * - A custom plugin implements a resolveUrl hook returning something
13399
+ * - The reference.type is "filesystem" -> it is handled by jsenv_plugin_file_urls.js
13400
+ *
13401
+ * By default node esm resolution applies inside js modules
13402
+ * and the rest uses the web standard url resolution (new URL):
13403
+ * - "http_request"
13404
+ * - "entry_point"
13405
+ * - "js_import_export"
13406
+ * - "link_href"
13407
+ * - "script_src"
13408
+ * - "a_href"
13409
+ * - "iframe_src
13410
+ * - "img_src"
13411
+ * - "img_srcset"
13412
+ * - "source_src"
13413
+ * - "source_srcset"
13414
+ * - "image_href"
13415
+ * - "use_href"
13416
+ * - "css_@import"
13417
+ * - "css_url"
13418
+ * - "sourcemap_comment"
13419
+ * - "js_url_specifier"
13420
+ * - "js_inline_content"
13421
+ * - "webmanifest_icon_src"
13422
+ * - "package_json"
13423
+ */
13424
+ const jsenvPluginUrlResolution = ({
13425
+ runtimeCompat,
13426
+ clientMainFileUrl,
13427
+ urlResolution
13428
+ }) => {
13429
+ const resolveUrlUsingWebResolution = reference => {
13430
+ return new URL(reference.specifier, reference.baseUrl || reference.parentUrl).href;
13431
+ };
13454
13432
 
13455
- const packageDirectoryUrl = defaultLookupPackageScope(reference.url);
13433
+ const resolvers = {};
13434
+ Object.keys(urlResolution).forEach(referenceType => {
13435
+ const resolver = urlResolution[referenceType];
13456
13436
 
13457
- if (!packageDirectoryUrl) {
13458
- return null;
13459
- }
13437
+ if (typeof resolver !== "object") {
13438
+ throw new Error(`Unexpected urlResolution configuration:
13439
+ "${referenceType}" resolution value must be an object, got ${resolver}`);
13440
+ }
13460
13441
 
13461
- if (packageDirectoryUrl === context.rootDirectoryUrl) {
13462
- return null;
13463
- } // there is a dependency between this file and the package.json version field
13442
+ let {
13443
+ web,
13444
+ node_esm,
13445
+ ...rest
13446
+ } = resolver;
13447
+ const unexpectedKey = Object.keys(rest)[0];
13464
13448
 
13449
+ if (unexpectedKey) {
13450
+ throw new Error(`Unexpected urlResolution configuration:
13451
+ "${referenceType}" resolution key must be "web" or "node_esm", found "${Object.keys(rest)[0]}"`);
13452
+ }
13465
13453
 
13466
- const packageVersion = defaultReadPackageJson(packageDirectoryUrl).version;
13454
+ if (node_esm === undefined) {
13455
+ node_esm = referenceType === "js_import_export";
13456
+ }
13467
13457
 
13468
- if (!packageVersion) {
13469
- // example where it happens: https://github.com/babel/babel/blob/2ce56e832c2dd7a7ed92c89028ba929f874c2f5c/packages/babel-runtime/helpers/esm/package.json#L2
13470
- return null;
13458
+ if (web === undefined) {
13459
+ web = true;
13460
+ }
13461
+
13462
+ if (node_esm) {
13463
+ if (node_esm === true) node_esm = {};
13464
+ const {
13465
+ packageConditions
13466
+ } = node_esm;
13467
+ resolvers[referenceType] = createNodeEsmResolver({
13468
+ runtimeCompat,
13469
+ packageConditions
13470
+ });
13471
+ } else if (web) {
13472
+ resolvers[referenceType] = resolveUrlUsingWebResolution;
13473
+ }
13474
+ });
13475
+
13476
+ if (!resolvers["js_import_export"]) {
13477
+ resolvers.js_import_export = createNodeEsmResolver({
13478
+ runtimeCompat
13479
+ });
13480
+ }
13481
+
13482
+ if (!resolvers["*"]) {
13483
+ resolvers["*"] = resolveUrlUsingWebResolution;
13484
+ }
13485
+
13486
+ return {
13487
+ name: "jsenv:url_resolution",
13488
+ appliesDuring: "*",
13489
+ resolveUrl: (reference, context) => {
13490
+ if (reference.specifier === "/") {
13491
+ return String(clientMainFileUrl);
13471
13492
  }
13472
13493
 
13473
- if (reference.type === "js_import_export") {
13474
- addRelationshipWithPackageJson({
13475
- reference,
13476
- context,
13477
- packageJsonUrl: `${packageDirectoryUrl}package.json`,
13478
- field: "version",
13479
- hasVersioningEffect: true
13480
- });
13494
+ if (reference.specifier[0] === "/") {
13495
+ return new URL(reference.specifier.slice(1), context.rootDirectoryUrl).href;
13481
13496
  }
13482
13497
 
13483
- return {
13484
- v: packageVersion
13485
- };
13498
+ const resolver = resolvers[reference.type] || resolvers["*"];
13499
+ return resolver(reference, context);
13486
13500
  },
13501
+ // when specifier is prefixed by "file:///@ignore/"
13502
+ // we return an empty js module (used by node esm)
13487
13503
  fetchUrlContent: urlInfo => {
13488
13504
  if (urlInfo.url.startsWith("file:///@ignore/")) {
13489
13505
  return {
@@ -13509,12 +13525,19 @@ const jsenvPluginUrlVersion = () => {
13509
13525
  // this goal is achieved when we reach this part of the code
13510
13526
  // We get rid of this params so that urlGraph and other parts of the code
13511
13527
  // recognize the url (it is not considered as a different url)
13512
- const urlObject = new URL(reference.url);
13513
- urlObject.searchParams.delete("v");
13514
- return urlObject.href;
13528
+ const version = reference.searchParams.get("v");
13529
+
13530
+ if (version) {
13531
+ const urlObject = new URL(reference.url);
13532
+ urlObject.searchParams.delete("v");
13533
+ reference.version = version;
13534
+ return urlObject.href;
13535
+ }
13536
+
13537
+ return null;
13515
13538
  },
13516
13539
  transformUrlSearchParams: reference => {
13517
- if (!reference.data.version) {
13540
+ if (!reference.version) {
13518
13541
  return null;
13519
13542
  }
13520
13543
 
@@ -13523,7 +13546,7 @@ const jsenvPluginUrlVersion = () => {
13523
13546
  }
13524
13547
 
13525
13548
  return {
13526
- v: reference.data.version
13549
+ v: reference.version
13527
13550
  };
13528
13551
  }
13529
13552
  };
@@ -17144,18 +17167,7 @@ const jsenvPluginCacheControl = () => {
17144
17167
  appliesDuring: "dev",
17145
17168
  augmentResponse: ({
17146
17169
  reference
17147
- }, context) => {
17148
- if (context.scenarios.test) {
17149
- // During dev, all files are put into browser cache for 1 hour because:
17150
- // 1: Browser cache is a temporary directory created by playwright
17151
- // 2: We assume source files won't be modified while tests are running
17152
- return {
17153
- headers: {
17154
- "cache-control": `private,max-age=3600,immutable`
17155
- }
17156
- };
17157
- }
17158
-
17170
+ }) => {
17159
17171
  if (reference.searchParams.has("v") && !reference.searchParams.has("hmr")) {
17160
17172
  return {
17161
17173
  headers: {
@@ -17179,7 +17191,8 @@ const jsenvPluginExplorer = ({
17179
17191
  tests: {
17180
17192
  "./tests/**/*.test.html": true
17181
17193
  }
17182
- }
17194
+ },
17195
+ clientMainFileUrl
17183
17196
  }) => {
17184
17197
  const faviconClientFileUrl = new URL("./other/jsenv.png", import.meta.url);
17185
17198
  return {
@@ -17187,45 +17200,52 @@ const jsenvPluginExplorer = ({
17187
17200
  appliesDuring: "dev",
17188
17201
  transformUrlContent: {
17189
17202
  html: async (urlInfo, context) => {
17190
- if (urlInfo.url !== explorerHtmlFileUrl) {
17203
+ if (urlInfo.url !== clientMainFileUrl) {
17191
17204
  return null;
17192
17205
  }
17193
17206
 
17194
- const associationsForExplorable = {};
17195
- Object.keys(groups).forEach(groupName => {
17196
- const groupConfig = groups[groupName];
17197
- associationsForExplorable[groupName] = {
17198
- "**/.jsenv/": false,
17199
- // avoid visting .jsenv directory in jsenv itself
17200
- ...groupConfig
17201
- };
17202
- });
17203
- const matchingFileResultArray = await collectFiles({
17204
- directoryUrl: context.rootDirectoryUrl,
17205
- associations: associationsForExplorable,
17206
- predicate: meta => Object.keys(meta).some(group => Boolean(meta[group]))
17207
- });
17208
- const files = matchingFileResultArray.map(({
17209
- relativeUrl,
17210
- meta
17211
- }) => ({
17212
- relativeUrl,
17213
- meta
17214
- }));
17215
17207
  let html = urlInfo.content;
17216
- html = html.replace("ignore:FAVICON_HREF", DATA_URL.stringify({
17217
- contentType: CONTENT_TYPE.fromUrlExtension(faviconClientFileUrl),
17218
- base64Flag: true,
17219
- data: readFileSync$1(new URL(faviconClientFileUrl)).toString("base64")
17220
- }));
17221
- html = html.replace("SERVER_PARAMS", JSON.stringify({
17222
- rootDirectoryUrl: context.rootDirectoryUrl,
17223
- groups,
17224
- files
17225
- }, null, " "));
17226
- Object.assign(urlInfo.headers, {
17227
- "cache-control": "no-store"
17228
- });
17208
+
17209
+ if (html.includes("ignore:FAVICON_HREF")) {
17210
+ html = html.replace("ignore:FAVICON_HREF", DATA_URL.stringify({
17211
+ contentType: CONTENT_TYPE.fromUrlExtension(faviconClientFileUrl),
17212
+ base64Flag: true,
17213
+ data: readFileSync$1(new URL(faviconClientFileUrl)).toString("base64")
17214
+ }));
17215
+ }
17216
+
17217
+ if (html.includes("SERVER_PARAMS")) {
17218
+ const associationsForExplorable = {};
17219
+ Object.keys(groups).forEach(groupName => {
17220
+ const groupConfig = groups[groupName];
17221
+ associationsForExplorable[groupName] = {
17222
+ "**/.jsenv/": false,
17223
+ // avoid visting .jsenv directory in jsenv itself
17224
+ ...groupConfig
17225
+ };
17226
+ });
17227
+ const matchingFileResultArray = await collectFiles({
17228
+ directoryUrl: context.rootDirectoryUrl,
17229
+ associations: associationsForExplorable,
17230
+ predicate: meta => Object.keys(meta).some(group => Boolean(meta[group]))
17231
+ });
17232
+ const files = matchingFileResultArray.map(({
17233
+ relativeUrl,
17234
+ meta
17235
+ }) => ({
17236
+ relativeUrl,
17237
+ meta
17238
+ }));
17239
+ html = html.replace("SERVER_PARAMS", JSON.stringify({
17240
+ rootDirectoryUrl: context.rootDirectoryUrl,
17241
+ groups,
17242
+ files
17243
+ }, null, " "));
17244
+ Object.assign(urlInfo.headers, {
17245
+ "cache-control": "no-store"
17246
+ });
17247
+ }
17248
+
17229
17249
  return html;
17230
17250
  }
17231
17251
  }
@@ -17236,10 +17256,10 @@ const getCorePlugins = ({
17236
17256
  rootDirectoryUrl,
17237
17257
  runtimeCompat,
17238
17258
  urlAnalysis = {},
17239
- supervisor,
17240
- nodeEsmResolution = true,
17241
- fileSystemMagicResolution,
17259
+ urlResolution = {},
17260
+ fileSystemMagicRedirection,
17242
17261
  directoryReferenceAllowed,
17262
+ supervisor,
17243
17263
  transpilation = true,
17244
17264
  minification = false,
17245
17265
  bundling = false,
@@ -17257,19 +17277,20 @@ const getCorePlugins = ({
17257
17277
  supervisor = {};
17258
17278
  }
17259
17279
 
17260
- if (nodeEsmResolution === true) {
17261
- nodeEsmResolution = {};
17262
- }
17263
-
17264
- if (fileSystemMagicResolution === true) {
17265
- fileSystemMagicResolution = {};
17280
+ if (fileSystemMagicRedirection === true) {
17281
+ fileSystemMagicRedirection = {};
17266
17282
  }
17267
17283
 
17268
17284
  if (clientAutoreload === true) {
17269
17285
  clientAutoreload = {};
17270
17286
  }
17271
17287
 
17272
- clientMainFileUrl = clientMainFileUrl || explorer ? explorerHtmlFileUrl : new URL("./index.html", rootDirectoryUrl);
17288
+ if (clientMainFileUrl === undefined) {
17289
+ clientMainFileUrl = explorer ? String(explorerHtmlFileUrl) : String(new URL("./index.html", rootDirectoryUrl));
17290
+ } else {
17291
+ clientMainFileUrl = String(clientMainFileUrl);
17292
+ }
17293
+
17273
17294
  return [jsenvPluginUrlAnalysis({
17274
17295
  rootDirectoryUrl,
17275
17296
  ...urlAnalysis
@@ -17279,16 +17300,19 @@ const getCorePlugins = ({
17279
17300
  jsenvPluginInline(), // before "file urls" to resolve and load inline urls
17280
17301
  jsenvPluginFileUrls({
17281
17302
  directoryReferenceAllowed,
17282
- ...fileSystemMagicResolution
17283
- }), jsenvPluginHttpUrls(), jsenvPluginLeadingSlash(), // before url resolution to handle "js_import_export" resolution
17284
- jsenvPluginNodeEsmResolution(nodeEsmResolution), jsenvPluginUrlResolution({
17303
+ ...fileSystemMagicRedirection
17304
+ }), jsenvPluginHttpUrls(), jsenvPluginUrlResolution({
17305
+ runtimeCompat,
17306
+ urlResolution,
17285
17307
  clientMainFileUrl
17286
17308
  }), jsenvPluginUrlVersion(), jsenvPluginCommonJsGlobals(), jsenvPluginImportMetaScenarios(), jsenvPluginNodeRuntime({
17287
17309
  runtimeCompat
17288
17310
  }), jsenvPluginBundling(bundling), jsenvPluginMinification(minification), jsenvPluginImportMetaHot(), ...(clientAutoreload ? [jsenvPluginAutoreload({ ...clientAutoreload,
17289
17311
  clientFileChangeCallbackList,
17290
17312
  clientFilesPruneCallbackList
17291
- })] : []), jsenvPluginCacheControl(), ...(explorer ? [jsenvPluginExplorer(explorer)] : [])];
17313
+ })] : []), jsenvPluginCacheControl(), ...(explorer ? [jsenvPluginExplorer({ ...explorer,
17314
+ clientMainFileUrl
17315
+ })] : [])];
17292
17316
  };
17293
17317
 
17294
17318
  const HOOK_NAMES$1 = ["init", "serve", // is called only during dev/tests
@@ -18403,6 +18427,7 @@ const createKitchen = ({
18403
18427
  isResourceHint,
18404
18428
  isImplicit,
18405
18429
  hasVersioningEffect,
18430
+ version: null,
18406
18431
  injected,
18407
18432
  timing: {},
18408
18433
  // for inline resources the reference contains the content
@@ -19199,55 +19224,7 @@ const determineFileUrlForOutDirectory = ({
19199
19224
  to: context.outDirectoryUrl,
19200
19225
  preferAbsolute: true
19201
19226
  });
19202
- }; // import { getOriginalPosition } from "@jsenv/core/src/utils/sourcemap/original_position.js"
19203
- // const getUrlSite = async (
19204
- // urlInfo,
19205
- // { line, column, originalLine, originalColumn },
19206
- // ) => {
19207
- // if (typeof originalLine === "number") {
19208
- // return {
19209
- // url: urlInfo.url,
19210
- // line: originalLine,
19211
- // column: originalColumn,
19212
- // }
19213
- // }
19214
- // if (urlInfo.content === urlInfo.originalContent) {
19215
- // return {
19216
- // url: urlInfo.url,
19217
- // line,
19218
- // column,
19219
- // }
19220
- // }
19221
- // // at this point things were transformed: line and column are generated
19222
- // // no sourcemap -> cannot map back to original file
19223
- // const { sourcemap } = urlInfo
19224
- // if (!sourcemap) {
19225
- // return {
19226
- // url: urlInfo.generatedUrl,
19227
- // content: urlInfo.content,
19228
- // line,
19229
- // column,
19230
- // }
19231
- // }
19232
- // const originalPosition = await getOriginalPosition({
19233
- // sourcemap,
19234
- // line,
19235
- // column,
19236
- // })
19237
- // // cannot map back to original file
19238
- // if (!originalPosition || originalPosition.line === null) {
19239
- // return {
19240
- // url: urlInfo.generatedUrl,
19241
- // line,
19242
- // column,
19243
- // }
19244
- // }
19245
- // return {
19246
- // url: urlInfo.url,
19247
- // line: originalPosition.line,
19248
- // column: originalPosition.column,
19249
- // }
19250
- // }
19227
+ };
19251
19228
 
19252
19229
  const createUrlGraphSummary = (urlGraph, {
19253
19230
  title = "graph summary"
@@ -19847,8 +19824,8 @@ const build = async ({
19847
19824
  sourcemaps = false,
19848
19825
  sourcemapsSourcesContent,
19849
19826
  urlAnalysis = {},
19850
- nodeEsmResolution = true,
19851
- fileSystemMagicResolution,
19827
+ urlResolution,
19828
+ fileSystemMagicRedirection,
19852
19829
  directoryReferenceAllowed,
19853
19830
  transpilation = {},
19854
19831
  bundling = true,
@@ -19944,8 +19921,8 @@ build ${entryPointKeys.length} entry points`);
19944
19921
  urlGraph: rawGraph,
19945
19922
  runtimeCompat,
19946
19923
  urlAnalysis,
19947
- nodeEsmResolution,
19948
- fileSystemMagicResolution,
19924
+ urlResolution,
19925
+ fileSystemMagicRedirection,
19949
19926
  directoryReferenceAllowed,
19950
19927
  transpilation: { ...transpilation,
19951
19928
  babelHelpersAsImport: !useExplicitJsClassicConversion,
@@ -20051,11 +20028,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
20051
20028
  return true;
20052
20029
  }
20053
20030
 
20054
- if (rawUrlInfo.originalContent === reference.content) {
20055
- return true;
20056
- }
20057
-
20058
- return false;
20031
+ return rawUrlInfo.originalContent === reference.content;
20059
20032
  });
20060
20033
  const parentUrlInfo = finalGraph.getUrlInfo(reference.parentUrl);
20061
20034
 
@@ -20357,7 +20330,6 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
20357
20330
 
20358
20331
  if (bundler) {
20359
20332
  bundler.urlInfos.push(rawUrlInfo);
20360
- return;
20361
20333
  }
20362
20334
  };
20363
20335
 
@@ -21232,11 +21204,7 @@ const isUsed = urlInfo => {
21232
21204
  return true;
21233
21205
  }
21234
21206
 
21235
- if (urlInfo.dependents.size > 0) {
21236
- return true;
21237
- }
21238
-
21239
- return false;
21207
+ return urlInfo.dependents.size > 0;
21240
21208
  };
21241
21209
 
21242
21210
  const canUseVersionedUrl = urlInfo => {
@@ -21244,11 +21212,7 @@ const canUseVersionedUrl = urlInfo => {
21244
21212
  return false;
21245
21213
  }
21246
21214
 
21247
- if (urlInfo.type === "webmanifest") {
21248
- return false;
21249
- }
21250
-
21251
- return true;
21215
+ return urlInfo.type !== "webmanifest";
21252
21216
  };
21253
21217
 
21254
21218
  const createReloadableWorker = (workerFileUrl, options = {}) => {
@@ -25274,9 +25238,9 @@ const createFileService = ({
25274
25238
  runtimeCompat,
25275
25239
  plugins,
25276
25240
  urlAnalysis,
25241
+ urlResolution,
25242
+ fileSystemMagicRedirection,
25277
25243
  supervisor,
25278
- nodeEsmResolution,
25279
- fileSystemMagicResolution,
25280
25244
  transpilation,
25281
25245
  clientAutoreload,
25282
25246
  clientFiles,
@@ -25385,9 +25349,9 @@ const createFileService = ({
25385
25349
  rootDirectoryUrl,
25386
25350
  runtimeCompat,
25387
25351
  urlAnalysis,
25352
+ urlResolution,
25353
+ fileSystemMagicRedirection,
25388
25354
  supervisor,
25389
- nodeEsmResolution,
25390
- fileSystemMagicResolution,
25391
25355
  transpilation,
25392
25356
  clientMainFileUrl,
25393
25357
  clientAutoreload,
@@ -25721,9 +25685,9 @@ const startOmegaServer = async ({
25721
25685
  runtimeCompat,
25722
25686
  plugins,
25723
25687
  urlAnalysis,
25688
+ urlResolution,
25689
+ fileSystemMagicRedirection,
25724
25690
  supervisor,
25725
- nodeEsmResolution,
25726
- fileSystemMagicResolution,
25727
25691
  transpilation,
25728
25692
  clientAutoreload,
25729
25693
  clientFiles,
@@ -25775,9 +25739,9 @@ const startOmegaServer = async ({
25775
25739
  runtimeCompat,
25776
25740
  plugins,
25777
25741
  urlAnalysis,
25742
+ urlResolution,
25743
+ fileSystemMagicRedirection,
25778
25744
  supervisor,
25779
- nodeEsmResolution,
25780
- fileSystemMagicResolution,
25781
25745
  transpilation,
25782
25746
  clientAutoreload,
25783
25747
  clientFiles,
@@ -25886,9 +25850,9 @@ const startDevServer = async ({
25886
25850
  runtimeCompat = defaultRuntimeCompat,
25887
25851
  plugins = [],
25888
25852
  urlAnalysis = {},
25853
+ urlResolution,
25889
25854
  supervisor = true,
25890
- nodeEsmResolution,
25891
- fileSystemMagicResolution,
25855
+ fileSystemMagicRedirection,
25892
25856
  transpilation,
25893
25857
  explorer = true,
25894
25858
  // see jsenv_plugin_explorer.js
@@ -26003,9 +25967,9 @@ const startDevServer = async ({
26003
25967
  runtimeCompat,
26004
25968
  plugins,
26005
25969
  urlAnalysis,
25970
+ urlResolution,
25971
+ fileSystemMagicRedirection,
26006
25972
  supervisor,
26007
- nodeEsmResolution,
26008
- fileSystemMagicResolution,
26009
25973
  transpilation,
26010
25974
  clientFiles,
26011
25975
  clientMainFileUrl,