@jsenv/core 27.0.0-alpha.65 → 27.0.0-alpha.66

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 (97) hide show
  1. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/AsyncGenerator/AsyncGenerator.js +0 -0
  2. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/AwaitValue/AwaitValue.js +0 -0
  3. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/applyDecoratorDescriptor/applyDecoratorDescriptor.js +0 -0
  4. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/arrayLikeToArray/arrayLikeToArray.js +0 -0
  5. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/arrayWithHoles/arrayWithHoles.js +0 -0
  6. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/arrayWithoutHoles/arrayWithoutHoles.js +0 -0
  7. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/assertThisInitialized/assertThisInitialized.js +0 -0
  8. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/asyncGeneratorDelegate/asyncGeneratorDelegate.js +0 -0
  9. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/asyncIterator/asyncIterator.js +0 -0
  10. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/asyncToGenerator/asyncToGenerator.js +0 -0
  11. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/awaitAsyncGenerator/awaitAsyncGenerator.js +0 -0
  12. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +0 -0
  13. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classApplyDescriptorGet/classApplyDescriptorGet.js +0 -0
  14. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classApplyDescriptorSet/classApplyDescriptorSet.js +0 -0
  15. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classCallCheck/classCallCheck.js +0 -0
  16. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +0 -0
  17. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +0 -0
  18. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classExtractFieldDescriptor/classExtractFieldDescriptor.js +0 -0
  19. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classNameTDZError/classNameTDZError.js +0 -0
  20. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +0 -0
  21. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateFieldGet/classPrivateFieldGet.js +0 -0
  22. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +0 -0
  23. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +0 -0
  24. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateFieldSet/classPrivateFieldSet.js +0 -0
  25. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateMethodGet/classPrivateMethodGet.js +0 -0
  26. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateMethodSet/classPrivateMethodSet.js +0 -0
  27. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +0 -0
  28. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +0 -0
  29. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +0 -0
  30. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +0 -0
  31. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/construct/construct.js +0 -0
  32. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/createClass/createClass.js +0 -0
  33. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/createForOfIteratorHelper/createForOfIteratorHelper.js +0 -0
  34. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +0 -0
  35. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/createRawReactElement/createRawReactElement.js +0 -0
  36. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/createSuper/createSuper.js +0 -0
  37. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/decorate/decorate.js +0 -0
  38. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/defaults/defaults.js +0 -0
  39. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/defineEnumerableProperties/defineEnumerableProperties.js +0 -0
  40. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/defineProperty/defineProperty.js +0 -0
  41. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/extends/extends.js +0 -0
  42. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/get/get.js +0 -0
  43. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/getPrototypeOf/getPrototypeOf.js +0 -0
  44. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/inherits/inherits.js +0 -0
  45. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/inheritsLoose/inheritsLoose.js +0 -0
  46. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/initializerDefineProperty/initializerDefineProperty.js +0 -0
  47. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/initializerWarningHelper/initializerWarningHelper.js +0 -0
  48. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/instanceof/instanceof.js +0 -0
  49. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/interopRequireDefault/interopRequireDefault.js +0 -0
  50. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/interopRequireWildcard/interopRequireWildcard.js +0 -0
  51. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/isNativeFunction/isNativeFunction.js +0 -0
  52. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/isNativeReflectConstruct/isNativeReflectConstruct.js +0 -0
  53. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/iterableToArray/iterableToArray.js +0 -0
  54. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/iterableToArrayLimit/iterableToArrayLimit.js +0 -0
  55. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +0 -0
  56. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/jsx/jsx.js +0 -0
  57. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/maybeArrayLike/maybeArrayLike.js +0 -0
  58. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/newArrowCheck/newArrowCheck.js +0 -0
  59. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/nonIterableRest/nonIterableRest.js +0 -0
  60. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/nonIterableSpread/nonIterableSpread.js +0 -0
  61. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/objectDestructuringEmpty/objectDestructuringEmpty.js +0 -0
  62. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/objectSpread/objectSpread.js +0 -0
  63. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/objectSpread2/objectSpread2.js +0 -0
  64. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/objectWithoutProperties/objectWithoutProperties.js +0 -0
  65. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +0 -0
  66. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/possibleConstructorReturn/possibleConstructorReturn.js +0 -0
  67. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/readOnlyError/readOnlyError.js +0 -0
  68. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/readme.md +0 -0
  69. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/set/set.js +0 -0
  70. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/setPrototypeOf/setPrototypeOf.js +0 -0
  71. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/skipFirstGeneratorNext/skipFirstGeneratorNext.js +0 -0
  72. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/slicedToArray/slicedToArray.js +0 -0
  73. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/slicedToArrayLoose/slicedToArrayLoose.js +0 -0
  74. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/superPropBase/superPropBase.js +0 -0
  75. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/taggedTemplateLiteral/taggedTemplateLiteral.js +0 -0
  76. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +0 -0
  77. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/tdz/tdz.js +0 -0
  78. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/temporalRef/temporalRef.js +0 -0
  79. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/temporalUndefined/temporalUndefined.js +0 -0
  80. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/toArray/toArray.js +0 -0
  81. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/toConsumableArray/toConsumableArray.js +0 -0
  82. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/toPrimitive/toPrimitive.js +0 -0
  83. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/toPropertyKey/toPropertyKey.js +0 -0
  84. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/typeof/typeof.js +0 -0
  85. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/unsupportedIterableToArray/unsupportedIterableToArray.js +0 -0
  86. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/wrapAsyncGenerator/wrapAsyncGenerator.js +0 -0
  87. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/wrapNativeSuper/wrapNativeSuper.js +0 -0
  88. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/wrapRegExp/wrapRegExp.js +0 -0
  89. package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/writeOnlyError/writeOnlyError.js +0 -0
  90. package/dist/html/explorer.html +1 -1
  91. package/dist/main.js +29 -8
  92. package/package.json +2 -2
  93. package/src/build/build.js +6 -0
  94. package/src/dev/plugins/explorer/client/explorer.html +1 -1
  95. package/src/dev/plugins/explorer/jsenv_plugin_explorer.js +1 -1
  96. package/src/plugins/file_urls/jsenv_plugin_file_urls.js +11 -4
  97. package/src/plugins/url_analysis/jsenv_plugin_url_analysis.js +11 -4
@@ -2,7 +2,7 @@
2
2
  <title>Exploring</title>
3
3
  <meta name="viewport" content="width=device-width, initial-scale=1">
4
4
  <meta charset="utf-8">
5
- <link rel="icon" href="../other/jsenv.png">
5
+ <link rel="icon" href="virtual:FAVICON_HREF">
6
6
  <style>button:focus, a:focus, input:focus, [data-contains-hidden-input] input:focus + * {
7
7
  outline-offset: -2px;
8
8
  outline-style: none;
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { parentPort } from "node:worker_threads";
2
- import { urlToRelativeUrl, normalizeStructuredMetaMap, urlToMeta, registerFileLifecycle, urlIsInsideOf, urlToExtension, urlToFilename, readFileSync as readFileSync$1, fileSystemPathToUrl, urlToFileSystemPath, isFileSystemPath, bufferToEtag, writeFileSync, ensureWindowsDriveLetter, moveUrl, collectFiles, assertAndNormalizeDirectoryUrl, registerDirectoryLifecycle, resolveUrl, writeFile, ensureEmptyDirectory, writeDirectory, resolveDirectoryUrl, urlToBasename } from "@jsenv/filesystem";
2
+ import { urlToRelativeUrl, normalizeStructuredMetaMap, urlToMeta, registerFileLifecycle, urlIsInsideOf, urlToFilename, urlToExtension, readFileSync as readFileSync$1, fileSystemPathToUrl, urlToFileSystemPath, isFileSystemPath, bufferToEtag, writeFileSync, ensureWindowsDriveLetter, moveUrl, collectFiles, assertAndNormalizeDirectoryUrl, registerDirectoryLifecycle, resolveUrl, writeFile, ensureEmptyDirectory, writeDirectory, resolveDirectoryUrl, urlToBasename } from "@jsenv/filesystem";
3
3
  import { createDetailedMessage, createLogger, loggerToLevels } from "@jsenv/logger";
4
4
  import { createTaskLog, ANSI, msAsDuration, msAsEllapsedTime, byteAsMemoryUsage, UNICODE, createLog, startSpinner, distributePercentages, byteAsFileSize } from "@jsenv/log";
5
5
  import { getCallerPosition } from "@jsenv/utils/src/caller_position.js";
@@ -530,7 +530,11 @@ const jsenvPluginUrlAnalysis = ({
530
530
  name: "jsenv:url_analysis",
531
531
  appliesDuring: "*",
532
532
  redirectUrl: reference => {
533
- if (reference.specifier[0] === "#") {
533
+ if (reference.specifier[0] === "#" && // For Html, css and in general "#" refer to a ressource in the page
534
+ // so that urls must be kept intact
535
+ // However for js import specifiers they have a different meaning and we want
536
+ // to resolve them (https://nodejs.org/api/packages.html#imports for instance)
537
+ reference.type !== "js_import_export") {
534
538
  reference.shouldHandle = false;
535
539
  return;
536
540
  }
@@ -566,12 +570,12 @@ const jsenvPluginUrlAnalysis = ({
566
570
  directory: (urlInfo, context) => {
567
571
  const originalDirectoryReference = findOriginalDirectoryReference(urlInfo, context);
568
572
  const directoryRelativeUrl = urlToRelativeUrl(urlInfo.url, context.rootDirectoryUrl);
569
- JSON.parse(urlInfo.content).forEach(directoryEntry => {
573
+ JSON.parse(urlInfo.content).forEach(directoryEntryName => {
570
574
  context.referenceUtils.found({
571
575
  type: "filesystem",
572
576
  subtype: "directory_entry",
573
- specifier: directoryEntry,
574
- trace: `"${directoryRelativeUrl}${directoryEntry}" entry in directory referenced by ${originalDirectoryReference.trace}`
577
+ specifier: directoryEntryName,
578
+ trace: `"${directoryRelativeUrl}${directoryEntryName}" entry in directory referenced by ${originalDirectoryReference.trace}`
575
579
  });
576
580
  });
577
581
  }
@@ -1206,11 +1210,20 @@ const jsenvPluginFileUrls = ({
1206
1210
  if (context.reference.expectedType === "directory") {
1207
1211
  if (directoryReferenceAllowed) {
1208
1212
  const directoryEntries = readdirSync(urlObject);
1213
+ let filename;
1214
+
1215
+ if (context.reference.type === "filesystem") {
1216
+ const parentUrlInfo = context.urlGraph.getUrlInfo(context.reference.parentUrl);
1217
+ filename = `${parentUrlInfo.filename}${context.reference.specifier}/`;
1218
+ } else {
1219
+ filename = `${urlToFilename(urlInfo.url)}/`;
1220
+ }
1221
+
1209
1222
  return {
1210
1223
  type: "directory",
1211
1224
  contentType: "application/json",
1212
1225
  content: JSON.stringify(directoryEntries, null, " "),
1213
- filename: urlToRelativeUrl(ensurePathnameTrailingSlash(urlInfo.url), context.rootDirectoryUrl)
1226
+ filename
1214
1227
  };
1215
1228
  }
1216
1229
 
@@ -2707,7 +2720,7 @@ export default inlineContent.text`
2707
2720
  // https://github.com/babel/babel/blob/99f4f6c3b03c7f3f67cf1b9f1a21b80cfd5b0224/packages/babel-core/src/tools/build-external-helpers.js
2708
2721
  // the list of possible helpers:
2709
2722
  // https://github.com/babel/babel/blob/99f4f6c3b03c7f3f67cf1b9f1a21b80cfd5b0224/packages/babel-helpers/src/helpers.js#L13
2710
- const babelHelperClientDirectoryUrl = new URL("./node_modules/@jsenv/babel-plugins/src/babel_helpers/", import.meta.url).href; // we cannot use "@jsenv/core/src/*" because babel helper might be injected
2723
+ const babelHelperClientDirectoryUrl = new URL("./babel_helpers/", import.meta.url).href; // we cannot use "@jsenv/core/src/*" because babel helper might be injected
2711
2724
  // into node_modules not depending on "@jsenv/core"
2712
2725
 
2713
2726
  const getBabelHelperFileUrl = babelHelperName => {
@@ -8287,7 +8300,7 @@ const jsenvPluginExplorer = ({
8287
8300
  meta
8288
8301
  }));
8289
8302
  let html = String(readFileSync(new URL(htmlClientFileUrl)));
8290
- html = html.replace("FAVICON_HREF", DataUrl.stringify({
8303
+ html = html.replace("virtual:FAVICON_HREF", DataUrl.stringify({
8291
8304
  contentType: CONTENT_TYPE.fromUrlExtension(faviconClientFileUrl),
8292
8305
  base64Flag: true,
8293
8306
  data: readFileSync(new URL(faviconClientFileUrl)).toString("base64")
@@ -12858,6 +12871,14 @@ const applyUrlVersioning = async ({
12858
12871
  return url;
12859
12872
  },
12860
12873
  formatUrl: reference => {
12874
+ if (!reference.shouldHandle) {
12875
+ if (reference.generatedUrl.startsWith("ignore:")) {
12876
+ return reference.generatedUrl.slice("ignore:".length);
12877
+ }
12878
+
12879
+ return null;
12880
+ }
12881
+
12861
12882
  if (reference.isInline || reference.url.startsWith("data:")) {
12862
12883
  return null;
12863
12884
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "27.0.0-alpha.65",
3
+ "version": "27.0.0-alpha.66",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -77,7 +77,7 @@
77
77
  "@jsenv/node-esm-resolution": "0.0.10",
78
78
  "@jsenv/server": "12.6.3",
79
79
  "@jsenv/uneval": "1.6.0",
80
- "@jsenv/utils": "1.8.1",
80
+ "@jsenv/utils": "1.8.2",
81
81
  "construct-style-sheets-polyfill": "3.1.0",
82
82
  "cssnano": "5.1.7",
83
83
  "cssnano-preset-default": "5.2.7",
@@ -1116,6 +1116,12 @@ const applyUrlVersioning = async ({
1116
1116
  return url
1117
1117
  },
1118
1118
  formatUrl: (reference) => {
1119
+ if (!reference.shouldHandle) {
1120
+ if (reference.generatedUrl.startsWith("ignore:")) {
1121
+ return reference.generatedUrl.slice("ignore:".length)
1122
+ }
1123
+ return null
1124
+ }
1119
1125
  if (reference.isInline || reference.url.startsWith("data:")) {
1120
1126
  return null
1121
1127
  }
@@ -4,7 +4,7 @@
4
4
  <title>Exploring</title>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <meta charset="utf-8" />
7
- <link rel="icon" href="./jsenv.png" />
7
+ <link rel="icon" href="virtual:FAVICON_HREF" />
8
8
  <style>
9
9
  button:focus,
10
10
  a:focus,
@@ -41,7 +41,7 @@ export const jsenvPluginExplorer = ({ groups }) => {
41
41
  }))
42
42
  let html = String(readFileSync(new URL(htmlClientFileUrl)))
43
43
  html = html.replace(
44
- "FAVICON_HREF",
44
+ "virtual:FAVICON_HREF",
45
45
  DataUrl.stringify({
46
46
  contentType: CONTENT_TYPE.fromUrlExtension(faviconClientFileUrl),
47
47
  base64Flag: true,
@@ -4,6 +4,7 @@ import {
4
4
  urlIsInsideOf,
5
5
  urlToRelativeUrl,
6
6
  urlToExtension,
7
+ urlToFilename,
7
8
  } from "@jsenv/filesystem"
8
9
 
9
10
  import { applyFileSystemMagicResolution } from "@jsenv/node-esm-resolution"
@@ -152,14 +153,20 @@ export const jsenvPluginFileUrls = ({
152
153
  if (context.reference.expectedType === "directory") {
153
154
  if (directoryReferenceAllowed) {
154
155
  const directoryEntries = readdirSync(urlObject)
156
+ let filename
157
+ if (context.reference.type === "filesystem") {
158
+ const parentUrlInfo = context.urlGraph.getUrlInfo(
159
+ context.reference.parentUrl,
160
+ )
161
+ filename = `${parentUrlInfo.filename}${context.reference.specifier}/`
162
+ } else {
163
+ filename = `${urlToFilename(urlInfo.url)}/`
164
+ }
155
165
  return {
156
166
  type: "directory",
157
167
  contentType: "application/json",
158
168
  content: JSON.stringify(directoryEntries, null, " "),
159
- filename: urlToRelativeUrl(
160
- ensurePathnameTrailingSlash(urlInfo.url),
161
- context.rootDirectoryUrl,
162
- ),
169
+ filename,
163
170
  }
164
171
  }
165
172
  const error = new Error("found a directory on filesystem")
@@ -31,7 +31,14 @@ export const jsenvPluginUrlAnalysis = ({ rootDirectoryUrl, include }) => {
31
31
  name: "jsenv:url_analysis",
32
32
  appliesDuring: "*",
33
33
  redirectUrl: (reference) => {
34
- if (reference.specifier[0] === "#") {
34
+ if (
35
+ reference.specifier[0] === "#" &&
36
+ // For Html, css and in general "#" refer to a ressource in the page
37
+ // so that urls must be kept intact
38
+ // However for js import specifiers they have a different meaning and we want
39
+ // to resolve them (https://nodejs.org/api/packages.html#imports for instance)
40
+ reference.type !== "js_import_export"
41
+ ) {
35
42
  reference.shouldHandle = false
36
43
  return
37
44
  }
@@ -68,12 +75,12 @@ export const jsenvPluginUrlAnalysis = ({ rootDirectoryUrl, include }) => {
68
75
  urlInfo.url,
69
76
  context.rootDirectoryUrl,
70
77
  )
71
- JSON.parse(urlInfo.content).forEach((directoryEntry) => {
78
+ JSON.parse(urlInfo.content).forEach((directoryEntryName) => {
72
79
  context.referenceUtils.found({
73
80
  type: "filesystem",
74
81
  subtype: "directory_entry",
75
- specifier: directoryEntry,
76
- trace: `"${directoryRelativeUrl}${directoryEntry}" entry in directory referenced by ${originalDirectoryReference.trace}`,
82
+ specifier: directoryEntryName,
83
+ trace: `"${directoryRelativeUrl}${directoryEntryName}" entry in directory referenced by ${originalDirectoryReference.trace}`,
77
84
  })
78
85
  })
79
86
  },