@modern-js/app-tools 3.8.1 → 3.8.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.
@@ -1,7 +1,7 @@
1
1
  import path from "path";
2
2
  import { findExists, fs } from "@modern-js/utils";
3
3
  import { HTML_PARTIALS_EXTENSIONS, HTML_PARTIALS_FOLDER } from "./constants.mjs";
4
- import * as __rspack_external__templates_mjs_4da4c6c8 from "./templates.mjs";
4
+ import * as __rspack_external__templates_mjs_ab577925 from "./templates.mjs";
5
5
  const findPartials = (dir, entryName, position)=>{
6
6
  if (fs.existsSync(dir)) {
7
7
  const base = findExists(HTML_PARTIALS_EXTENSIONS.map((ext)=>path.resolve(dir, `${position}${ext}`)));
@@ -70,7 +70,7 @@ const getHtmlTemplate = async (entrypoints, hooks, { appContext, config })=>{
70
70
  partials: getModifyHtmlPartials(partials)
71
71
  });
72
72
  const templatePath = path.resolve(internalDirectory, entryName, 'index.html');
73
- fs.outputFileSync(templatePath, __rspack_external__templates_mjs_4da4c6c8.html(partials), 'utf8');
73
+ fs.outputFileSync(templatePath, __rspack_external__templates_mjs_ab577925.html(partials), 'utf8');
74
74
  htmlTemplates[entryName] = templatePath.replace(/\\/g, '/');
75
75
  partialsByEntrypoint[entryName] = partials;
76
76
  const bottomTemplate = findPartials(htmlDir, name, "bottom");
@@ -1,8 +1,8 @@
1
1
  import fs from "fs";
2
2
  import { parse } from "@babel/parser";
3
3
  import traverse from "@babel/traverse";
4
- import * as __rspack_external__babel_types_69e65b52 from "@babel/types";
5
- const isFunction = (node)=>__rspack_external__babel_types_69e65b52.isFunctionDeclaration(node) || __rspack_external__babel_types_69e65b52.isFunctionExpression(node) || __rspack_external__babel_types_69e65b52.isArrowFunctionExpression(node);
4
+ import * as __rspack_external__babel_types_6e8337dd from "@babel/types";
5
+ const isFunction = (node)=>__rspack_external__babel_types_6e8337dd.isFunctionDeclaration(node) || __rspack_external__babel_types_6e8337dd.isFunctionExpression(node) || __rspack_external__babel_types_6e8337dd.isArrowFunctionExpression(node);
6
6
  const isDefaultExportFunction = (file)=>{
7
7
  if (!file || !fs.existsSync(file)) return false;
8
8
  const ast = parse(fs.readFileSync(file, 'utf8'), {
@@ -2,7 +2,7 @@ import "node:module";
2
2
  import path from "path";
3
3
  import { findExists, fs } from "@modern-js/utils";
4
4
  import { HTML_PARTIALS_EXTENSIONS, HTML_PARTIALS_FOLDER } from "./constants.mjs";
5
- import * as __rspack_external__templates_mjs_4da4c6c8 from "./templates.mjs";
5
+ import * as __rspack_external__templates_mjs_ab577925 from "./templates.mjs";
6
6
  const findPartials = (dir, entryName, position)=>{
7
7
  if (fs.existsSync(dir)) {
8
8
  const base = findExists(HTML_PARTIALS_EXTENSIONS.map((ext)=>path.resolve(dir, `${position}${ext}`)));
@@ -71,7 +71,7 @@ const getHtmlTemplate = async (entrypoints, hooks, { appContext, config })=>{
71
71
  partials: getModifyHtmlPartials(partials)
72
72
  });
73
73
  const templatePath = path.resolve(internalDirectory, entryName, 'index.html');
74
- fs.outputFileSync(templatePath, __rspack_external__templates_mjs_4da4c6c8.html(partials), 'utf8');
74
+ fs.outputFileSync(templatePath, __rspack_external__templates_mjs_ab577925.html(partials), 'utf8');
75
75
  htmlTemplates[entryName] = templatePath.replace(/\\/g, '/');
76
76
  partialsByEntrypoint[entryName] = partials;
77
77
  const bottomTemplate = findPartials(htmlDir, name, "bottom");
@@ -2,8 +2,8 @@ import "node:module";
2
2
  import fs from "fs";
3
3
  import { parse } from "@babel/parser";
4
4
  import traverse from "@babel/traverse";
5
- import * as __rspack_external__babel_types_69e65b52 from "@babel/types";
6
- const isFunction = (node)=>__rspack_external__babel_types_69e65b52.isFunctionDeclaration(node) || __rspack_external__babel_types_69e65b52.isFunctionExpression(node) || __rspack_external__babel_types_69e65b52.isArrowFunctionExpression(node);
5
+ import * as __rspack_external__babel_types_6e8337dd from "@babel/types";
6
+ const isFunction = (node)=>__rspack_external__babel_types_6e8337dd.isFunctionDeclaration(node) || __rspack_external__babel_types_6e8337dd.isFunctionExpression(node) || __rspack_external__babel_types_6e8337dd.isArrowFunctionExpression(node);
7
7
  const isDefaultExportFunction = (file)=>{
8
8
  if (!file || !fs.existsSync(file)) return false;
9
9
  const ast = parse(fs.readFileSync(file, 'utf8'), {
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.8.1",
18
+ "version": "3.8.3",
19
19
  "types": "./dist/types/index.d.ts",
20
20
  "main": "./dist/cjs/index.js",
21
21
  "exports": {
@@ -116,26 +116,26 @@
116
116
  "@babel/parser": "^7.29.7",
117
117
  "@babel/traverse": "^7.29.7",
118
118
  "@babel/types": "^7.29.7",
119
- "@rsbuild/core": "2.1.0",
119
+ "@rsbuild/core": "2.2.0-rc.0",
120
120
  "@swc/core": "1.15.41",
121
121
  "@swc/helpers": "^0.5.17",
122
122
  "es-module-lexer": "^1.7.0",
123
- "flatted": "^3.4.2",
123
+ "flatted": "^3.4.4",
124
124
  "import-meta-resolve": "^4.2.0",
125
125
  "mlly": "^1.8.2",
126
126
  "ndepe": "^0.1.13",
127
127
  "pkg-types": "^1.3.1",
128
128
  "std-env": "^3.10.0",
129
- "@modern-js/builder": "3.8.1",
130
- "@modern-js/i18n-utils": "3.8.1",
131
- "@modern-js/plugin": "3.8.1",
132
- "@modern-js/plugin-data-loader": "3.8.1",
133
- "@modern-js/prod-server": "3.8.1",
134
- "@modern-js/server": "3.8.1",
135
- "@modern-js/server-core": "3.8.1",
136
- "@modern-js/server-utils": "3.8.1",
137
- "@modern-js/types": "3.8.1",
138
- "@modern-js/utils": "3.8.1"
129
+ "@modern-js/builder": "3.8.3",
130
+ "@modern-js/i18n-utils": "3.8.3",
131
+ "@modern-js/plugin": "3.8.3",
132
+ "@modern-js/plugin-data-loader": "3.8.3",
133
+ "@modern-js/prod-server": "3.8.3",
134
+ "@modern-js/server-core": "3.8.3",
135
+ "@modern-js/server": "3.8.3",
136
+ "@modern-js/server-utils": "3.8.3",
137
+ "@modern-js/types": "3.8.3",
138
+ "@modern-js/utils": "3.8.3"
139
139
  },
140
140
  "devDependencies": {
141
141
  "@rslib/core": "0.23.2",
package/rslib.config.mts CHANGED
@@ -19,11 +19,22 @@ export default defineConfig({
19
19
  },
20
20
  output: {
21
21
  ...libConfig.output,
22
+ // `src/esm` is also matched by the `./src/**` entry, so the bundler
23
+ // emits these files itself. The ESM outputs keep the `.mjs` extension,
24
+ // which means bundle and copy write the very same paths — two writers
25
+ // for one file, occasionally leaving it truncated and unparsable, which
26
+ // takes down every `"type": "module"` project. The CJS output emits
27
+ // `.js`, so there the copy is the only thing providing the `.mjs`
28
+ // loaders that `register()` resolves by name; keep it for that alone.
22
29
  copy: [
23
- {
24
- from: './src/esm',
25
- to: './esm',
26
- },
30
+ ...(libConfig.format === 'esm'
31
+ ? []
32
+ : [
33
+ {
34
+ from: './src/esm',
35
+ to: './esm',
36
+ },
37
+ ]),
27
38
  {
28
39
  from: 'plugins/deploy/platforms/templates/*.cjs',
29
40
  context: path.join(__dirname, 'src'),