@jsenv/core 40.0.0 → 40.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "40.0.0",
3
+ "version": "40.0.2",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -47,6 +47,10 @@
47
47
  "./packages/related/*",
48
48
  "./packages/related/cli/*"
49
49
  ],
50
+ "sideEffects": [
51
+ "./src/kitchen/client/inline_content.js",
52
+ "./tests/"
53
+ ],
50
54
  "scripts": {
51
55
  "eslint": "npx eslint .",
52
56
  "test": "node --conditions=development ./scripts/test/test.mjs",
@@ -74,23 +78,23 @@
74
78
  "dependencies": {
75
79
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
76
80
  "@jsenv/abort": "4.3.1",
77
- "@jsenv/ast": "6.6.0",
78
- "@jsenv/filesystem": "4.14.0",
79
- "@jsenv/humanize": "1.3.0",
80
- "@jsenv/importmap": "1.2.1",
81
+ "@jsenv/ast": "6.6.1",
82
+ "@jsenv/filesystem": "4.14.1",
83
+ "@jsenv/humanize": "1.3.1",
84
+ "@jsenv/importmap": "1.2.2",
81
85
  "@jsenv/integrity": "0.0.2",
82
- "@jsenv/js-module-fallback": "1.4.0",
86
+ "@jsenv/js-module-fallback": "1.4.1",
83
87
  "@jsenv/node-esm-resolution": "1.1.0",
84
- "@jsenv/plugin-bundling": "2.8.0",
88
+ "@jsenv/plugin-bundling": "2.8.1",
85
89
  "@jsenv/plugin-minification": "1.6.0",
86
- "@jsenv/plugin-supervisor": "1.6.7",
87
- "@jsenv/plugin-transpilation": "1.5.0",
88
- "@jsenv/runtime-compat": "1.3.3",
89
- "@jsenv/server": "16.0.0",
90
- "@jsenv/sourcemap": "1.3.0",
90
+ "@jsenv/plugin-supervisor": "1.6.8",
91
+ "@jsenv/plugin-transpilation": "1.5.1",
92
+ "@jsenv/runtime-compat": "1.3.4",
93
+ "@jsenv/server": "16.0.2",
94
+ "@jsenv/sourcemap": "1.3.1",
91
95
  "@jsenv/url-meta": "8.5.4",
92
- "@jsenv/urls": "2.6.1",
93
- "@jsenv/utils": "2.2.0",
96
+ "@jsenv/urls": "2.6.2",
97
+ "@jsenv/utils": "2.2.1",
94
98
  "string-width": "7.2.0"
95
99
  },
96
100
  "devDependencies": {
@@ -749,7 +749,8 @@ export const createBuildSpecifierManager = ({
749
749
  contentBeforeReplace,
750
750
  (placeholder) => {
751
751
  const reference = placeholderToReferenceMap.get(placeholder);
752
- return generateReplacement(reference);
752
+ const value = generateReplacement(reference);
753
+ return value;
753
754
  },
754
755
  );
755
756
  urlInfo.mutateContent({ content, sourcemap });
package/src/main.js CHANGED
@@ -1,8 +1,18 @@
1
1
  // dev
2
- export { startDevServer } from "./dev/start_dev_server.js";
2
+ export const startDevServer = async (...args) => {
3
+ const namespace = await import("./dev/start_dev_server.js");
4
+ return namespace.startDevServer(...args);
5
+ };
6
+
3
7
  // build
4
- export { build } from "./build/build.js";
5
- export { startBuildServer } from "./build/start_build_server.js";
8
+ export const build = async (...args) => {
9
+ const namespace = await import("./build/build.js");
10
+ return namespace.build(...args);
11
+ };
12
+ export const startBuildServer = async (...args) => {
13
+ const namespace = await import("./build/start_build_server.js");
14
+ return namespace.startBuildServer(...args);
15
+ };
6
16
 
7
17
  // others
8
18
  export { INJECTIONS } from "./plugins/injections/jsenv_plugin_injections.js";
@@ -13,6 +13,7 @@ import {
13
13
  defaultReadPackageJson,
14
14
  readCustomConditionsFromProcessArgs,
15
15
  } from "@jsenv/node-esm-resolution";
16
+ import { urlToBasename, urlToExtension } from "@jsenv/urls";
16
17
  import { readFileSync } from "node:fs";
17
18
 
18
19
  export const createNodeEsmResolver = ({
@@ -48,12 +49,27 @@ export const createNodeEsmResolver = ({
48
49
  if (!parentUrl.startsWith("file:")) {
49
50
  return null; // let it to jsenv_web_resolution
50
51
  }
51
- const { url, type, packageDirectoryUrl } = applyNodeEsmResolution({
52
+ const { url, type, isMain, packageDirectoryUrl } = applyNodeEsmResolution({
52
53
  conditions: packageConditions,
53
54
  parentUrl,
54
55
  specifier: reference.specifier,
55
56
  preservesSymlink,
56
57
  });
58
+ // try to give a more meaningful filename after build
59
+ if (isMain && packageDirectoryUrl) {
60
+ const basename = urlToBasename(url);
61
+ if (basename === "main" || basename === "index") {
62
+ const parentBasename = urlToBasename(new URL("../../", url));
63
+ const dirname = urlToBasename(packageDirectoryUrl);
64
+ let filenameHint = "";
65
+ if (parentBasename[0] === "@") {
66
+ filenameHint += `${parentBasename}_`;
67
+ }
68
+ const extension = urlToExtension(url);
69
+ filenameHint += `${dirname}_${basename}${extension}`;
70
+ reference.filenameHint = filenameHint;
71
+ }
72
+ }
57
73
  if (ownerUrlInfo.context.build) {
58
74
  return url;
59
75
  }