@nocobase/build 1.4.0-alpha.8 → 1.4.0-beta.1
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/lib/buildClient.js +134 -26
- package/lib/buildEsm.js +126 -22
- package/lib/buildPlugin.js +176 -56
- package/lib/utils/buildPluginUtils.js +1 -1
- package/package.json +11 -2
package/lib/buildClient.js
CHANGED
|
@@ -31,15 +31,14 @@ __export(buildClient_exports, {
|
|
|
31
31
|
buildLocale: () => buildLocale
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(buildClient_exports);
|
|
34
|
-
var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
|
|
35
34
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
36
35
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
37
36
|
var import_path = __toESM(require("path"));
|
|
38
37
|
var import_tsup = require("tsup");
|
|
39
38
|
var import_vite = require("vite");
|
|
40
|
-
var import_vite_plugin_lib_inject_css = require("vite-plugin-lib-inject-css");
|
|
41
39
|
var import_constant = require("./constant");
|
|
42
40
|
var import_utils = require("./utils");
|
|
41
|
+
var import_core = require("@rspack/core");
|
|
43
42
|
async function buildClient(cwd, userConfig, sourcemap = false, log) {
|
|
44
43
|
log("build client");
|
|
45
44
|
const cwdWin = cwd.replaceAll(/\\/g, "/");
|
|
@@ -51,38 +50,147 @@ async function buildClient(cwd, userConfig, sourcemap = false, log) {
|
|
|
51
50
|
return true;
|
|
52
51
|
};
|
|
53
52
|
await buildClientEsm(cwd, userConfig, sourcemap, external, log);
|
|
54
|
-
await buildClientLib(cwd, userConfig, sourcemap, external, log);
|
|
55
53
|
await buildLocale(cwd, userConfig, log);
|
|
56
54
|
}
|
|
57
55
|
function buildClientEsm(cwd, userConfig, sourcemap, external, log) {
|
|
58
56
|
log("build client esm");
|
|
59
57
|
const entry = import_path.default.join(cwd, "src/index.ts").replaceAll(/\\/g, "/");
|
|
60
58
|
const outDir = import_path.default.resolve(cwd, "es");
|
|
61
|
-
return (0,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
59
|
+
return (0, import_core.rspack)({
|
|
60
|
+
entry: {
|
|
61
|
+
index: entry
|
|
62
|
+
},
|
|
63
|
+
output: {
|
|
64
|
+
path: outDir,
|
|
65
|
+
library: {
|
|
66
|
+
type: "module"
|
|
67
|
+
},
|
|
68
|
+
clean: true
|
|
69
|
+
},
|
|
70
|
+
target: ["es2015", "web"],
|
|
71
|
+
mode: process.env.NODE_ENV === "production" ? "production" : "development",
|
|
72
|
+
optimization: {
|
|
73
|
+
minimize: process.env.NODE_ENV === "production",
|
|
74
|
+
moduleIds: "deterministic",
|
|
75
|
+
sideEffects: true
|
|
76
|
+
},
|
|
77
|
+
resolve: {
|
|
78
|
+
tsConfig: import_path.default.join(process.cwd(), "tsconfig.json"),
|
|
79
|
+
extensions: [".js", ".jsx", ".ts", ".tsx", ".json", ".less", ".css"]
|
|
80
|
+
},
|
|
81
|
+
module: {
|
|
82
|
+
rules: [
|
|
83
|
+
{
|
|
84
|
+
test: /\.less$/,
|
|
85
|
+
use: [
|
|
86
|
+
{ loader: "style-loader" },
|
|
87
|
+
{ loader: "css-loader" },
|
|
88
|
+
{ loader: require.resolve("less-loader") },
|
|
89
|
+
{
|
|
90
|
+
loader: "postcss-loader",
|
|
91
|
+
options: {
|
|
92
|
+
postcssOptions: {
|
|
93
|
+
plugins: {
|
|
94
|
+
"postcss-preset-env": {
|
|
95
|
+
browsers: ["last 2 versions", "> 1%", "cover 99.5%", "not dead"]
|
|
96
|
+
},
|
|
97
|
+
autoprefixer: {}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
type: "javascript/auto"
|
|
75
104
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
105
|
+
{
|
|
106
|
+
test: /\.css$/,
|
|
107
|
+
use: [
|
|
108
|
+
"style-loader",
|
|
109
|
+
"css-loader",
|
|
110
|
+
{
|
|
111
|
+
loader: "postcss-loader",
|
|
112
|
+
options: {
|
|
113
|
+
postcssOptions: {
|
|
114
|
+
plugins: {
|
|
115
|
+
"postcss-preset-env": {
|
|
116
|
+
browsers: ["last 2 versions", "> 1%", "cover 99.5%", "not dead"]
|
|
117
|
+
},
|
|
118
|
+
autoprefixer: {}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
type: "javascript/auto"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
test: /\.(png|jpe?g|gif)$/i,
|
|
128
|
+
type: "asset"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
test: /\.svg$/i,
|
|
132
|
+
issuer: /\.[jt]sx?$/,
|
|
133
|
+
use: ["@svgr/webpack"]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
test: /\.jsx$/,
|
|
137
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
138
|
+
loader: "builtin:swc-loader",
|
|
139
|
+
options: {
|
|
140
|
+
sourceMap: true,
|
|
141
|
+
jsc: {
|
|
142
|
+
parser: {
|
|
143
|
+
syntax: "ecmascript",
|
|
144
|
+
jsx: true
|
|
145
|
+
},
|
|
146
|
+
target: "es5"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
test: /\.tsx$/,
|
|
152
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
153
|
+
loader: "builtin:swc-loader",
|
|
154
|
+
options: {
|
|
155
|
+
sourceMap: true,
|
|
156
|
+
jsc: {
|
|
157
|
+
parser: {
|
|
158
|
+
syntax: "typescript",
|
|
159
|
+
tsx: true
|
|
160
|
+
},
|
|
161
|
+
target: "es5"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
test: /\.ts$/,
|
|
167
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
168
|
+
loader: "builtin:swc-loader",
|
|
169
|
+
options: {
|
|
170
|
+
sourceMap: true,
|
|
171
|
+
jsc: {
|
|
172
|
+
parser: {
|
|
173
|
+
syntax: "typescript"
|
|
174
|
+
},
|
|
175
|
+
target: "es5"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
81
178
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
externals: [
|
|
182
|
+
function({ request }, callback) {
|
|
183
|
+
if (external(request)) {
|
|
184
|
+
return callback(null, true);
|
|
185
|
+
}
|
|
186
|
+
callback();
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
plugins: [
|
|
190
|
+
new import_core.rspack.DefinePlugin((0, import_utils.getEnvDefine)())
|
|
191
|
+
],
|
|
192
|
+
stats: "errors-warnings"
|
|
193
|
+
});
|
|
86
194
|
}
|
|
87
195
|
async function buildClientLib(cwd, userConfig, sourcemap, external, log) {
|
|
88
196
|
log("build client lib");
|
package/lib/buildEsm.js
CHANGED
|
@@ -32,8 +32,8 @@ __export(buildEsm_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(buildEsm_exports);
|
|
33
33
|
var import_path = __toESM(require("path"));
|
|
34
34
|
var import_utils = require("./utils");
|
|
35
|
-
var import_vite = require("vite");
|
|
36
35
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
36
|
+
var import_core = require("@rspack/core");
|
|
37
37
|
const clientExt = ".{ts,tsx,js,jsx}";
|
|
38
38
|
function getSingleEntry(file, cwd) {
|
|
39
39
|
return import_fast_glob.default.sync([`${file}${clientExt}`], { cwd, absolute: true, onlyFiles: true })?.[0]?.replaceAll(/\\/g, "/");
|
|
@@ -67,30 +67,134 @@ function build(cwd, entry, outDir, userConfig, sourcemap = false, log) {
|
|
|
67
67
|
}
|
|
68
68
|
return true;
|
|
69
69
|
};
|
|
70
|
-
return (0,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
return (0, import_core.rspack)({
|
|
71
|
+
entry: {
|
|
72
|
+
index: entry
|
|
73
|
+
},
|
|
74
|
+
output: {
|
|
75
|
+
path: outDir,
|
|
76
|
+
library: {
|
|
77
|
+
type: "module"
|
|
78
|
+
},
|
|
79
|
+
clean: true
|
|
80
|
+
},
|
|
81
|
+
target: ["node16"],
|
|
82
|
+
mode: process.env.NODE_ENV === "production" ? "production" : "development",
|
|
83
|
+
resolve: {
|
|
84
|
+
tsConfig: import_path.default.join(process.cwd(), "tsconfig.json"),
|
|
85
|
+
extensions: [".js", ".jsx", ".ts", ".tsx", ".json", ".less", ".css"]
|
|
86
|
+
},
|
|
87
|
+
module: {
|
|
88
|
+
rules: [
|
|
89
|
+
{
|
|
90
|
+
test: /\.less$/,
|
|
91
|
+
use: [
|
|
92
|
+
{ loader: "style-loader" },
|
|
93
|
+
{ loader: "css-loader" },
|
|
94
|
+
{ loader: require.resolve("less-loader") },
|
|
95
|
+
{
|
|
96
|
+
loader: "postcss-loader",
|
|
97
|
+
options: {
|
|
98
|
+
postcssOptions: {
|
|
99
|
+
plugins: {
|
|
100
|
+
"postcss-preset-env": {
|
|
101
|
+
browsers: ["last 2 versions", "> 1%", "cover 99.5%", "not dead"]
|
|
102
|
+
},
|
|
103
|
+
autoprefixer: {}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
type: "javascript/auto"
|
|
84
110
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
111
|
+
{
|
|
112
|
+
test: /\.css$/,
|
|
113
|
+
use: [
|
|
114
|
+
"style-loader",
|
|
115
|
+
"css-loader",
|
|
116
|
+
{
|
|
117
|
+
loader: "postcss-loader",
|
|
118
|
+
options: {
|
|
119
|
+
postcssOptions: {
|
|
120
|
+
plugins: {
|
|
121
|
+
"postcss-preset-env": {
|
|
122
|
+
browsers: ["last 2 versions", "> 1%", "cover 99.5%", "not dead"]
|
|
123
|
+
},
|
|
124
|
+
autoprefixer: {}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
type: "javascript/auto"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
test: /\.(png|jpe?g|gif)$/i,
|
|
134
|
+
type: "asset"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
test: /\.svg$/i,
|
|
138
|
+
issuer: /\.[jt]sx?$/,
|
|
139
|
+
use: ["@svgr/webpack"]
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
test: /\.jsx$/,
|
|
143
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
144
|
+
loader: "builtin:swc-loader",
|
|
145
|
+
options: {
|
|
146
|
+
sourceMap: true,
|
|
147
|
+
jsc: {
|
|
148
|
+
parser: {
|
|
149
|
+
syntax: "ecmascript",
|
|
150
|
+
jsx: true
|
|
151
|
+
},
|
|
152
|
+
target: "es5"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
test: /\.tsx$/,
|
|
158
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
159
|
+
loader: "builtin:swc-loader",
|
|
160
|
+
options: {
|
|
161
|
+
sourceMap: true,
|
|
162
|
+
jsc: {
|
|
163
|
+
parser: {
|
|
164
|
+
syntax: "typescript",
|
|
165
|
+
tsx: true
|
|
166
|
+
},
|
|
167
|
+
target: "es5"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
test: /\.ts$/,
|
|
173
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
174
|
+
loader: "builtin:swc-loader",
|
|
175
|
+
options: {
|
|
176
|
+
sourceMap: true,
|
|
177
|
+
jsc: {
|
|
178
|
+
parser: {
|
|
179
|
+
syntax: "typescript"
|
|
180
|
+
},
|
|
181
|
+
target: "es5"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
externals: [
|
|
188
|
+
function({ request }, callback) {
|
|
189
|
+
if (external(request)) {
|
|
190
|
+
return callback(null, true);
|
|
90
191
|
}
|
|
192
|
+
callback();
|
|
91
193
|
}
|
|
92
|
-
|
|
93
|
-
|
|
194
|
+
],
|
|
195
|
+
plugins: [new import_core.rspack.DefinePlugin((0, import_utils.getEnvDefine)())],
|
|
196
|
+
stats: "errors-warnings"
|
|
197
|
+
});
|
|
94
198
|
}
|
|
95
199
|
// Annotate the CommonJS export names for ESM import in node:
|
|
96
200
|
0 && (module.exports = {
|
package/lib/buildPlugin.js
CHANGED
|
@@ -36,14 +36,12 @@ __export(buildPlugin_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(buildPlugin_exports);
|
|
38
38
|
var import_ncc = __toESM(require("@vercel/ncc"));
|
|
39
|
-
var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
|
|
40
39
|
var import_chalk = __toESM(require("chalk"));
|
|
41
40
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
42
41
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
43
42
|
var import_path = __toESM(require("path"));
|
|
44
43
|
var import_tsup = require("tsup");
|
|
45
|
-
var
|
|
46
|
-
var import_vite_plugin_css_injected_by_js = __toESM(require("vite-plugin-css-injected-by-js"));
|
|
44
|
+
var import_core = require("@rspack/core");
|
|
47
45
|
var import_constant = require("./constant");
|
|
48
46
|
var import_utils = require("./utils");
|
|
49
47
|
var import_buildPluginUtils = require("./utils/buildPluginUtils");
|
|
@@ -133,7 +131,8 @@ const external = [
|
|
|
133
131
|
"@emotion/css",
|
|
134
132
|
"ahooks",
|
|
135
133
|
"lodash",
|
|
136
|
-
"china-division"
|
|
134
|
+
"china-division",
|
|
135
|
+
"file-saver"
|
|
137
136
|
];
|
|
138
137
|
const pluginPrefix = (process.env.PLUGIN_PACKAGE_PREFIX || "@nocobase/plugin-,@nocobase/preset-,@nocobase/plugin-pro-").split(",");
|
|
139
138
|
const target_dir = "dist";
|
|
@@ -187,7 +186,9 @@ async function buildServerDeps(cwd, serverFiles, log) {
|
|
|
187
186
|
if (excludePackages.length) {
|
|
188
187
|
tips.push(`These packages ${import_chalk.default.yellow(excludePackages.join(", "))} will be ${import_chalk.default.italic("exclude")}.`);
|
|
189
188
|
}
|
|
190
|
-
tips.push(
|
|
189
|
+
tips.push(
|
|
190
|
+
`For more information, please refer to: ${import_chalk.default.blue("https://docs.nocobase.com/development/others/deps")}.`
|
|
191
|
+
);
|
|
191
192
|
log(tips.join(" "));
|
|
192
193
|
if (!includePackages.length) return;
|
|
193
194
|
const deps = (0, import_getDepsConfig.getDepsConfig)(cwd, outDir, includePackages, external);
|
|
@@ -247,28 +248,32 @@ async function buildPluginServer(cwd, userConfig, sourcemap, log) {
|
|
|
247
248
|
const packageJson = (0, import_utils.getPackageJson)(cwd);
|
|
248
249
|
const serverFiles = import_fast_glob.default.globSync(serverGlobalFiles, { cwd, absolute: true });
|
|
249
250
|
(0, import_buildPluginUtils.buildCheck)({ cwd, packageJson, entry: "server", files: serverFiles, log });
|
|
250
|
-
const otherExts = Array.from(
|
|
251
|
+
const otherExts = Array.from(
|
|
252
|
+
new Set(serverFiles.map((item) => import_path.default.extname(item)).filter((item) => !import_constant.EsbuildSupportExts.includes(item)))
|
|
253
|
+
);
|
|
251
254
|
if (otherExts.length) {
|
|
252
255
|
log("%s will not be processed, only be copied to the dist directory.", import_chalk.default.yellow(otherExts.join(",")));
|
|
253
256
|
}
|
|
254
257
|
deleteServerFiles(cwd, log);
|
|
255
|
-
await (0, import_tsup.build)(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
258
|
+
await (0, import_tsup.build)(
|
|
259
|
+
userConfig.modifyTsupConfig({
|
|
260
|
+
entry: serverFiles,
|
|
261
|
+
splitting: false,
|
|
262
|
+
clean: false,
|
|
263
|
+
bundle: false,
|
|
264
|
+
silent: true,
|
|
265
|
+
treeshake: false,
|
|
266
|
+
target: "node16",
|
|
267
|
+
sourcemap,
|
|
268
|
+
outDir: import_path.default.join(cwd, target_dir),
|
|
269
|
+
format: "cjs",
|
|
270
|
+
skipNodeModulesBundle: true,
|
|
271
|
+
loader: {
|
|
272
|
+
...otherExts.reduce((prev, cur) => ({ ...prev, [cur]: "copy" }), {}),
|
|
273
|
+
".json": "copy"
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
);
|
|
272
277
|
await buildServerDeps(cwd, serverFiles, log);
|
|
273
278
|
}
|
|
274
279
|
async function buildPluginClient(cwd, userConfig, sourcemap, log) {
|
|
@@ -283,49 +288,164 @@ async function buildPluginClient(cwd, userConfig, sourcemap, log) {
|
|
|
283
288
|
const outDir = import_path.default.join(cwd, target_dir, "client");
|
|
284
289
|
const globals = excludePackages.reduce((prev, curr) => {
|
|
285
290
|
if (curr.startsWith("@nocobase")) {
|
|
286
|
-
prev[`${curr}/client`] = curr
|
|
291
|
+
prev[`${curr}/client`] = `${curr}/client`;
|
|
287
292
|
}
|
|
288
293
|
prev[curr] = curr;
|
|
289
294
|
return prev;
|
|
290
295
|
}, {});
|
|
291
|
-
const entry = import_fast_glob.default.globSync("
|
|
296
|
+
const entry = import_fast_glob.default.globSync("index.{ts,tsx,js,jsx}", { absolute: false, cwd: import_path.default.join(cwd, "src/client") });
|
|
292
297
|
const outputFileName = "index.js";
|
|
293
|
-
|
|
294
|
-
mode:
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
formats: ["umd"],
|
|
298
|
+
const compiler = (0, import_core.rspack)({
|
|
299
|
+
mode: "production",
|
|
300
|
+
// mode: "development",
|
|
301
|
+
context: cwd,
|
|
302
|
+
entry: "./src/client/" + entry[0],
|
|
303
|
+
target: ["web", "es5"],
|
|
304
|
+
output: {
|
|
305
|
+
path: outDir,
|
|
306
|
+
filename: outputFileName,
|
|
307
|
+
publicPath: `/static/plugins/${packageJson.name}/dist/client/`,
|
|
308
|
+
clean: true,
|
|
309
|
+
library: {
|
|
306
310
|
name: packageJson.name,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
311
|
+
type: "umd",
|
|
312
|
+
umdNamedDefine: true
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
resolve: {
|
|
316
|
+
tsConfig: import_path.default.join(process.cwd(), "tsconfig.json"),
|
|
317
|
+
extensions: [".js", ".jsx", ".ts", ".tsx", ".json", ".less", ".css"]
|
|
318
|
+
},
|
|
319
|
+
module: {
|
|
320
|
+
rules: [
|
|
321
|
+
{
|
|
322
|
+
test: /\.less$/,
|
|
323
|
+
use: [
|
|
324
|
+
{ loader: "style-loader" },
|
|
325
|
+
{ loader: "css-loader" },
|
|
326
|
+
{ loader: require.resolve("less-loader") },
|
|
327
|
+
{
|
|
328
|
+
loader: "postcss-loader",
|
|
329
|
+
options: {
|
|
330
|
+
postcssOptions: {
|
|
331
|
+
plugins: {
|
|
332
|
+
"postcss-preset-env": {
|
|
333
|
+
browsers: ["last 2 versions", "> 1%", "cover 99.5%", "not dead"]
|
|
334
|
+
},
|
|
335
|
+
autoprefixer: {}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
type: "javascript/auto"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
test: /\.css$/,
|
|
345
|
+
use: [
|
|
346
|
+
"style-loader",
|
|
347
|
+
"css-loader",
|
|
348
|
+
{
|
|
349
|
+
loader: "postcss-loader",
|
|
350
|
+
options: {
|
|
351
|
+
postcssOptions: {
|
|
352
|
+
plugins: {
|
|
353
|
+
"postcss-preset-env": {
|
|
354
|
+
browsers: ["last 2 versions", "> 1%", "cover 99.5%", "not dead"]
|
|
355
|
+
},
|
|
356
|
+
autoprefixer: {}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
],
|
|
362
|
+
type: "javascript/auto"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
test: /\.(png|jpe?g|gif)$/i,
|
|
366
|
+
type: "asset"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
test: /\.svg$/i,
|
|
370
|
+
issuer: /\.[jt]sx?$/,
|
|
371
|
+
use: ["@svgr/webpack"]
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
test: /\.jsx$/,
|
|
375
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
376
|
+
loader: "builtin:swc-loader",
|
|
377
|
+
options: {
|
|
378
|
+
sourceMap: true,
|
|
379
|
+
jsc: {
|
|
380
|
+
parser: {
|
|
381
|
+
syntax: "ecmascript",
|
|
382
|
+
jsx: true
|
|
383
|
+
},
|
|
384
|
+
target: "es5"
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
test: /\.tsx$/,
|
|
390
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
391
|
+
loader: "builtin:swc-loader",
|
|
392
|
+
options: {
|
|
393
|
+
sourceMap: true,
|
|
394
|
+
jsc: {
|
|
395
|
+
parser: {
|
|
396
|
+
syntax: "typescript",
|
|
397
|
+
tsx: true
|
|
398
|
+
},
|
|
399
|
+
target: "es5"
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
test: /\.ts$/,
|
|
405
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
406
|
+
loader: "builtin:swc-loader",
|
|
407
|
+
options: {
|
|
408
|
+
sourceMap: true,
|
|
409
|
+
jsc: {
|
|
410
|
+
parser: {
|
|
411
|
+
syntax: "typescript"
|
|
412
|
+
},
|
|
413
|
+
target: "es5"
|
|
414
|
+
}
|
|
319
415
|
}
|
|
320
416
|
}
|
|
321
|
-
|
|
417
|
+
]
|
|
322
418
|
},
|
|
323
419
|
plugins: [
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
420
|
+
new import_core.rspack.DefinePlugin({
|
|
421
|
+
"process.env.NODE_ENV": JSON.stringify("production")
|
|
422
|
+
})
|
|
423
|
+
],
|
|
424
|
+
node: {
|
|
425
|
+
global: true
|
|
426
|
+
},
|
|
427
|
+
externals: {
|
|
428
|
+
react: "React",
|
|
429
|
+
lodash: "lodash",
|
|
430
|
+
// 'react/jsx-runtime': 'jsxRuntime',
|
|
431
|
+
...globals
|
|
432
|
+
},
|
|
433
|
+
stats: "errors-warnings"
|
|
434
|
+
});
|
|
435
|
+
return new Promise((resolve, reject) => {
|
|
436
|
+
compiler.run((err, stats) => {
|
|
437
|
+
const compilationErrors = stats?.compilation.errors;
|
|
438
|
+
const infos = stats.toString({
|
|
439
|
+
colors: true
|
|
440
|
+
});
|
|
441
|
+
if (err || compilationErrors?.length) {
|
|
442
|
+
reject(err || infos);
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
console.log(infos);
|
|
446
|
+
resolve(null);
|
|
447
|
+
});
|
|
448
|
+
});
|
|
329
449
|
}
|
|
330
450
|
async function buildPlugin(cwd, userConfig, sourcemap, log) {
|
|
331
451
|
await buildPluginClient(cwd, userConfig, sourcemap, log);
|
|
@@ -107,7 +107,7 @@ function checkDependencies(packageJson, log) {
|
|
|
107
107
|
import_chalk.default.yellow(packages.join(", ")),
|
|
108
108
|
import_chalk.default.yellow("dependencies"),
|
|
109
109
|
import_chalk.default.yellow("devDependencies"),
|
|
110
|
-
import_chalk.default.blue(import_chalk.default.blue("https://docs.nocobase.com/development/deps"))
|
|
110
|
+
import_chalk.default.blue(import_chalk.default.blue("https://docs.nocobase.com/development/others/deps"))
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
function getFileSize(filePath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/build",
|
|
3
|
-
"version": "1.4.0-
|
|
3
|
+
"version": "1.4.0-beta.1",
|
|
4
4
|
"description": "Library build tool based on rollup.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -14,16 +14,25 @@
|
|
|
14
14
|
"@babel/preset-env": "7.25.4",
|
|
15
15
|
"@hapi/topo": "^6.0.0",
|
|
16
16
|
"@lerna/project": "4.0.0",
|
|
17
|
+
"@rspack/core": "1.0.14",
|
|
18
|
+
"@svgr/webpack": "^8.1.0",
|
|
17
19
|
"@types/gulp": "^4.0.13",
|
|
18
20
|
"@types/lerna__package": "5.1.0",
|
|
19
21
|
"@types/lerna__project": "5.1.0",
|
|
20
22
|
"@types/tar": "^6.1.5",
|
|
21
23
|
"@vercel/ncc": "0.36.1",
|
|
22
24
|
"chalk": "2.4.2",
|
|
25
|
+
"css-loader": "^6.8.1",
|
|
23
26
|
"esbuild-register": "^3.4.2",
|
|
24
27
|
"fast-glob": "^3.3.1",
|
|
25
28
|
"gulp": "4.0.2",
|
|
26
29
|
"gulp-typescript": "6.0.0-alpha.1",
|
|
30
|
+
"less": "^4.1.3",
|
|
31
|
+
"less-loader": "11.1.0",
|
|
32
|
+
"postcss": "^8.4.29",
|
|
33
|
+
"postcss-loader": "^7.3.3",
|
|
34
|
+
"postcss-preset-env": "^9.1.2",
|
|
35
|
+
"style-loader": "^3.3.3",
|
|
27
36
|
"tar": "^6.2.0",
|
|
28
37
|
"tsup": "8.2.4",
|
|
29
38
|
"typescript": "5.1.3",
|
|
@@ -36,5 +45,5 @@
|
|
|
36
45
|
"scripts": {
|
|
37
46
|
"build": "tsup"
|
|
38
47
|
},
|
|
39
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "1ece4e558ba445088dbb658bd458eb0004295326"
|
|
40
49
|
}
|