@jsenv/core 35.0.2 → 35.0.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.
@@ -17713,7 +17713,7 @@ const addRelationshipWithPackageJson = ({
17713
17713
  */
17714
17714
  const jsenvPluginUrlResolution = ({
17715
17715
  runtimeCompat,
17716
- mainFileUrl,
17716
+ defaultFileUrl,
17717
17717
  urlResolution
17718
17718
  }) => {
17719
17719
  const resolveUrlUsingWebResolution = reference => {
@@ -17781,7 +17781,7 @@ const jsenvPluginUrlResolution = ({
17781
17781
  appliesDuring: "*",
17782
17782
  resolveUrl: (reference, context) => {
17783
17783
  if (reference.specifier === "/") {
17784
- return String(mainFileUrl);
17784
+ return String(defaultFileUrl);
17785
17785
  }
17786
17786
  if (reference.specifier[0] === "/") {
17787
17787
  return new URL(reference.specifier.slice(1), context.rootDirectoryUrl).href;
@@ -21137,7 +21137,7 @@ const jsenvPluginCacheControl = ({
21137
21137
  };
21138
21138
  const SECONDS_IN_30_DAYS$1 = 60 * 60 * 24 * 30;
21139
21139
 
21140
- const explorerHtmlFileUrl = new URL("./html/explorer.html", import.meta.url);
21140
+ const explorerHtmlFileUrl = String(new URL("./html/explorer.html", import.meta.url));
21141
21141
  const jsenvPluginExplorer = ({
21142
21142
  groups = {
21143
21143
  src: {
@@ -21147,8 +21147,7 @@ const jsenvPluginExplorer = ({
21147
21147
  tests: {
21148
21148
  "./**/*.test.html": true
21149
21149
  }
21150
- },
21151
- mainFileUrl
21150
+ }
21152
21151
  }) => {
21153
21152
  const faviconClientFileUrl = new URL("./other/jsenv.png", import.meta.url);
21154
21153
  return {
@@ -21156,7 +21155,7 @@ const jsenvPluginExplorer = ({
21156
21155
  appliesDuring: "dev",
21157
21156
  transformUrlContent: {
21158
21157
  html: async (urlInfo, context) => {
21159
- if (urlInfo.url !== mainFileUrl) {
21158
+ if (urlInfo.url !== explorerHtmlFileUrl) {
21160
21159
  return null;
21161
21160
  }
21162
21161
  let html = urlInfo.content;
@@ -21256,7 +21255,7 @@ injectRibbon(${paramsJson});`
21256
21255
 
21257
21256
  const getCorePlugins = ({
21258
21257
  rootDirectoryUrl,
21259
- mainFileUrl,
21258
+ defaultFileUrl,
21260
21259
  runtimeCompat,
21261
21260
  urlAnalysis = {},
21262
21261
  urlResolution = {},
@@ -21306,7 +21305,7 @@ const getCorePlugins = ({
21306
21305
  ...fileSystemMagicRedirection
21307
21306
  }), jsenvPluginHttpUrls(), jsenvPluginUrlResolution({
21308
21307
  runtimeCompat,
21309
- mainFileUrl,
21308
+ defaultFileUrl,
21310
21309
  urlResolution
21311
21310
  }), jsenvPluginUrlVersion(), jsenvPluginCommonJsGlobals(), jsenvPluginImportMetaScenarios(), ...(scenarioPlaceholders ? [jsenvPluginGlobalScenarios()] : []), jsenvPluginNodeRuntime({
21312
21311
  runtimeCompat
@@ -21314,10 +21313,7 @@ const getCorePlugins = ({
21314
21313
  ...clientAutoreload,
21315
21314
  clientFileChangeCallbackList,
21316
21315
  clientFilesPruneCallbackList
21317
- })] : []), ...(cacheControl ? [jsenvPluginCacheControl(cacheControl)] : []), ...(explorer ? [jsenvPluginExplorer({
21318
- ...explorer,
21319
- mainFileUrl
21320
- })] : []), ...(ribbon ? [jsenvPluginRibbon({
21316
+ })] : []), ...(cacheControl ? [jsenvPluginCacheControl(cacheControl)] : []), ...(explorer ? [jsenvPluginExplorer(explorer)] : []), ...(ribbon ? [jsenvPluginRibbon({
21321
21317
  rootDirectoryUrl,
21322
21318
  ...ribbon
21323
21319
  })] : [])];
@@ -23286,11 +23282,13 @@ const createFileService = ({
23286
23282
  const clientRuntimeCompat = {
23287
23283
  [runtimeName]: runtimeVersion
23288
23284
  };
23289
- let mainFileUrl;
23290
- if (sourceMainFilePath === undefined) {
23291
- mainFileUrl = explorer ? String(explorerHtmlFileUrl) : String(new URL("./index.html", sourceDirectoryUrl));
23285
+ let defaultFileUrl;
23286
+ if (explorer) {
23287
+ defaultFileUrl = String(explorerHtmlFileUrl);
23288
+ } else if (sourceMainFilePath) {
23289
+ defaultFileUrl = String(new URL(sourceMainFilePath, sourceDirectoryUrl));
23292
23290
  } else {
23293
- mainFileUrl = String(new URL(sourceMainFilePath, sourceDirectoryUrl));
23291
+ defaultFileUrl = String(new URL("./index.html", sourceDirectoryUrl));
23294
23292
  }
23295
23293
  const kitchen = createKitchen({
23296
23294
  signal,
@@ -23303,7 +23301,7 @@ const createFileService = ({
23303
23301
  systemJsTranspilation: !RUNTIME_COMPAT.isSupported(clientRuntimeCompat, "script_type_module") || !RUNTIME_COMPAT.isSupported(clientRuntimeCompat, "import_dynamic") || !RUNTIME_COMPAT.isSupported(clientRuntimeCompat, "import_meta"),
23304
23302
  plugins: [...plugins, ...getCorePlugins({
23305
23303
  rootDirectoryUrl: sourceDirectoryUrl,
23306
- mainFileUrl,
23304
+ defaultFileUrl,
23307
23305
  runtimeCompat,
23308
23306
  urlAnalysis,
23309
23307
  urlResolution,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "35.0.2",
3
+ "version": "35.0.3",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -93,14 +93,15 @@ export const createFileService = ({
93
93
  })
94
94
  const clientRuntimeCompat = { [runtimeName]: runtimeVersion }
95
95
 
96
- let mainFileUrl
97
- if (sourceMainFilePath === undefined) {
98
- mainFileUrl = explorer
99
- ? String(explorerHtmlFileUrl)
100
- : String(new URL("./index.html", sourceDirectoryUrl))
96
+ let defaultFileUrl
97
+ if (explorer) {
98
+ defaultFileUrl = String(explorerHtmlFileUrl)
99
+ } else if (sourceMainFilePath) {
100
+ defaultFileUrl = String(new URL(sourceMainFilePath, sourceDirectoryUrl))
101
101
  } else {
102
- mainFileUrl = String(new URL(sourceMainFilePath, sourceDirectoryUrl))
102
+ defaultFileUrl = String(new URL("./index.html", sourceDirectoryUrl))
103
103
  }
104
+
104
105
  const kitchen = createKitchen({
105
106
  signal,
106
107
  logLevel,
@@ -120,7 +121,7 @@ export const createFileService = ({
120
121
  ...plugins,
121
122
  ...getCorePlugins({
122
123
  rootDirectoryUrl: sourceDirectoryUrl,
123
- mainFileUrl,
124
+ defaultFileUrl,
124
125
  runtimeCompat,
125
126
 
126
127
  urlAnalysis,
@@ -3,9 +3,8 @@ import { DATA_URL } from "@jsenv/urls"
3
3
  import { collectFiles } from "@jsenv/filesystem"
4
4
  import { CONTENT_TYPE } from "@jsenv/utils/src/content_type/content_type.js"
5
5
 
6
- export const explorerHtmlFileUrl = new URL(
7
- "./client/explorer.html",
8
- import.meta.url,
6
+ export const explorerHtmlFileUrl = String(
7
+ new URL("./client/explorer.html", import.meta.url),
9
8
  )
10
9
 
11
10
  export const jsenvPluginExplorer = ({
@@ -18,7 +17,6 @@ export const jsenvPluginExplorer = ({
18
17
  "./**/*.test.html": true,
19
18
  },
20
19
  },
21
- mainFileUrl,
22
20
  }) => {
23
21
  const faviconClientFileUrl = new URL("./client/jsenv.png", import.meta.url)
24
22
 
@@ -27,7 +25,7 @@ export const jsenvPluginExplorer = ({
27
25
  appliesDuring: "dev",
28
26
  transformUrlContent: {
29
27
  html: async (urlInfo, context) => {
30
- if (urlInfo.url !== mainFileUrl) {
28
+ if (urlInfo.url !== explorerHtmlFileUrl) {
31
29
  return null
32
30
  }
33
31
  let html = urlInfo.content
@@ -23,7 +23,7 @@ import { jsenvPluginRibbon } from "./ribbon/jsenv_plugin_ribbon.js"
23
23
 
24
24
  export const getCorePlugins = ({
25
25
  rootDirectoryUrl,
26
- mainFileUrl,
26
+ defaultFileUrl,
27
27
  runtimeCompat,
28
28
 
29
29
  urlAnalysis = {},
@@ -78,7 +78,7 @@ export const getCorePlugins = ({
78
78
  jsenvPluginHttpUrls(),
79
79
  jsenvPluginUrlResolution({
80
80
  runtimeCompat,
81
- mainFileUrl,
81
+ defaultFileUrl,
82
82
  urlResolution,
83
83
  }),
84
84
  jsenvPluginUrlVersion(),
@@ -99,7 +99,7 @@ export const getCorePlugins = ({
99
99
  ]
100
100
  : []),
101
101
  ...(cacheControl ? [jsenvPluginCacheControl(cacheControl)] : []),
102
- ...(explorer ? [jsenvPluginExplorer({ ...explorer, mainFileUrl })] : []),
102
+ ...(explorer ? [jsenvPluginExplorer(explorer)] : []),
103
103
  ...(ribbon ? [jsenvPluginRibbon({ rootDirectoryUrl, ...ribbon })] : []),
104
104
  ]
105
105
  }
@@ -33,7 +33,7 @@ import { createNodeEsmResolver } from "./node_esm_resolver.js"
33
33
 
34
34
  export const jsenvPluginUrlResolution = ({
35
35
  runtimeCompat,
36
- mainFileUrl,
36
+ defaultFileUrl,
37
37
  urlResolution,
38
38
  }) => {
39
39
  const resolveUrlUsingWebResolution = (reference) => {
@@ -105,7 +105,7 @@ export const jsenvPluginUrlResolution = ({
105
105
  appliesDuring: "*",
106
106
  resolveUrl: (reference, context) => {
107
107
  if (reference.specifier === "/") {
108
- return String(mainFileUrl)
108
+ return String(defaultFileUrl)
109
109
  }
110
110
  if (reference.specifier[0] === "/") {
111
111
  return new URL(reference.specifier.slice(1), context.rootDirectoryUrl)