@rsbuild/core 0.6.11 → 0.6.13
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/compiled/rspack-manifest-plugin/index.d.ts +1 -0
- package/compiled/rspack-manifest-plugin/index.js +7817 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/dist/cli/commands.js +1 -1
- package/dist/cli/prepare.js +1 -1
- package/dist/config.js +1 -0
- package/dist/createContext.js +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -1
- package/dist/plugins/manifest.d.ts +2 -0
- package/dist/plugins/manifest.js +142 -0
- package/dist/provider/provider.js +1 -0
- package/dist/rspack/preload/HtmlPreloadOrPrefetchPlugin.js +0 -1
- package/dist/rspack/preload/helpers/doesChunkBelongToHtml.d.ts +2 -2
- package/dist/rspack/preload/helpers/doesChunkBelongToHtml.js +4 -2
- package/dist/rspack/preload/helpers/extractChunks.d.ts +1 -2
- package/dist/rspack/preload/helpers/extractChunks.js +1 -2
- package/package.json +4 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Dane Thurber <dane.thurber@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"rspack-manifest-plugin","author":"Dane Thurber <dane.thurber@gmail.com>","version":"5.0.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
package/dist/cli/commands.js
CHANGED
|
@@ -39,7 +39,7 @@ const applyServerOptions = (command) => {
|
|
|
39
39
|
command.option("-o --open [url]", "open the page in browser on startup").option("--port <port>", "specify a port number for server to listen").option("--host <host>", "specify the host that the server listens to");
|
|
40
40
|
};
|
|
41
41
|
function runCli() {
|
|
42
|
-
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.6.
|
|
42
|
+
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.6.13");
|
|
43
43
|
const devCommand = import_commander.program.command("dev");
|
|
44
44
|
const buildCommand = import_commander.program.command("build");
|
|
45
45
|
const previewCommand = import_commander.program.command("preview");
|
package/dist/cli/prepare.js
CHANGED
|
@@ -34,7 +34,7 @@ function prepareCli() {
|
|
|
34
34
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
35
35
|
console.log();
|
|
36
36
|
}
|
|
37
|
-
import_rslog.logger.greet(` ${`Rsbuild v${"0.6.
|
|
37
|
+
import_rslog.logger.greet(` ${`Rsbuild v${"0.6.13"}`}
|
|
38
38
|
`);
|
|
39
39
|
}
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/config.js
CHANGED
package/dist/createContext.js
CHANGED
|
@@ -44,7 +44,7 @@ async function createContextByConfig(options, bundlerType, config = {}) {
|
|
|
44
44
|
const context = {
|
|
45
45
|
entry: (0, import_entry.getEntryObject)(config, "web"),
|
|
46
46
|
targets: config.output?.targets || [],
|
|
47
|
-
version: "0.6.
|
|
47
|
+
version: "0.6.13",
|
|
48
48
|
rootPath,
|
|
49
49
|
distPath,
|
|
50
50
|
cachePath,
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ var import_config = require("./config");
|
|
|
40
40
|
var import_shared = require("@rsbuild/shared");
|
|
41
41
|
var import_mergeConfig = require("./mergeConfig");
|
|
42
42
|
var import_constants = require("./constants");
|
|
43
|
-
const version = "0.6.
|
|
43
|
+
const version = "0.6.13";
|
|
44
44
|
// Annotate the CommonJS export names for ESM import in node:
|
|
45
45
|
0 && (module.exports = {
|
|
46
46
|
PLUGIN_CSS_NAME,
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -22,4 +22,5 @@ export declare const plugins: {
|
|
|
22
22
|
define: () => Promise<import("@rsbuild/shared").RsbuildPlugin>;
|
|
23
23
|
server: () => Promise<import("@rsbuild/shared").RsbuildPlugin>;
|
|
24
24
|
moduleFederation: () => Promise<import("@rsbuild/shared").RsbuildPlugin>;
|
|
25
|
+
manifest: () => Promise<import("@rsbuild/shared").RsbuildPlugin>;
|
|
25
26
|
};
|
package/dist/plugins/index.js
CHANGED
|
@@ -53,7 +53,8 @@ const plugins = {
|
|
|
53
53
|
performance: () => Promise.resolve().then(() => __toESM(require("./performance"))).then((m) => m.pluginPerformance()),
|
|
54
54
|
define: () => Promise.resolve().then(() => __toESM(require("./define"))).then((m) => m.pluginDefine()),
|
|
55
55
|
server: () => Promise.resolve().then(() => __toESM(require("./server"))).then((m) => m.pluginServer()),
|
|
56
|
-
moduleFederation: () => Promise.resolve().then(() => __toESM(require("./moduleFederation"))).then((m) => m.pluginModuleFederation())
|
|
56
|
+
moduleFederation: () => Promise.resolve().then(() => __toESM(require("./moduleFederation"))).then((m) => m.pluginModuleFederation()),
|
|
57
|
+
manifest: () => Promise.resolve().then(() => __toESM(require("./manifest"))).then((m) => m.pluginManifest())
|
|
57
58
|
};
|
|
58
59
|
// Annotate the CommonJS export names for ESM import in node:
|
|
59
60
|
0 && (module.exports = {
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var manifest_exports = {};
|
|
30
|
+
__export(manifest_exports, {
|
|
31
|
+
pluginManifest: () => pluginManifest
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(manifest_exports);
|
|
34
|
+
var import_helpers = require("../rspack/preload/helpers");
|
|
35
|
+
const generateManifest = (htmlPaths) => (_seed, files) => {
|
|
36
|
+
const chunkEntries = /* @__PURE__ */ new Map();
|
|
37
|
+
const licenseMap = /* @__PURE__ */ new Map();
|
|
38
|
+
const allFiles = files.map((file) => {
|
|
39
|
+
if (file.chunk) {
|
|
40
|
+
const names = (0, import_helpers.recursiveChunkEntryNames)(file.chunk);
|
|
41
|
+
for (const name of names) {
|
|
42
|
+
chunkEntries.set(name, [file, ...chunkEntries.get(name) || []]);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (file.path.endsWith(".LICENSE.txt")) {
|
|
46
|
+
const sourceFilePath = file.path.split(".LICENSE.txt")[0];
|
|
47
|
+
licenseMap.set(sourceFilePath, file.path);
|
|
48
|
+
}
|
|
49
|
+
return file.path;
|
|
50
|
+
});
|
|
51
|
+
const entries = {};
|
|
52
|
+
for (const [name, chunkFiles] of chunkEntries) {
|
|
53
|
+
const assets = /* @__PURE__ */ new Set();
|
|
54
|
+
const initialJS = [];
|
|
55
|
+
const asyncJS = [];
|
|
56
|
+
const initialCSS = [];
|
|
57
|
+
const asyncCSS = [];
|
|
58
|
+
for (const file of chunkFiles) {
|
|
59
|
+
if (file.isInitial) {
|
|
60
|
+
if (file.path.endsWith(".css")) {
|
|
61
|
+
initialCSS.push(file.path);
|
|
62
|
+
} else {
|
|
63
|
+
initialJS.push(file.path);
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
if (file.path.endsWith(".css")) {
|
|
67
|
+
asyncCSS.push(file.path);
|
|
68
|
+
} else {
|
|
69
|
+
asyncJS.push(file.path);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const relatedLICENSE = licenseMap.get(file.path);
|
|
73
|
+
if (relatedLICENSE) {
|
|
74
|
+
assets.add(relatedLICENSE);
|
|
75
|
+
}
|
|
76
|
+
for (const auxiliaryFile of file.chunk.auxiliaryFiles) {
|
|
77
|
+
assets.add(auxiliaryFile);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const entryManifest = {};
|
|
81
|
+
if (assets.size) {
|
|
82
|
+
entryManifest.assets = Array.from(assets);
|
|
83
|
+
}
|
|
84
|
+
const htmlPath = files.find((f) => f.name === htmlPaths[name])?.path;
|
|
85
|
+
if (htmlPath) {
|
|
86
|
+
entryManifest.html = [htmlPath];
|
|
87
|
+
}
|
|
88
|
+
if (initialJS.length) {
|
|
89
|
+
entryManifest.initial = {
|
|
90
|
+
js: initialJS
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (initialCSS.length) {
|
|
94
|
+
entryManifest.initial = {
|
|
95
|
+
...entryManifest.initial || {},
|
|
96
|
+
css: initialCSS
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (asyncJS.length) {
|
|
100
|
+
entryManifest.async = {
|
|
101
|
+
js: asyncJS
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
if (asyncCSS.length) {
|
|
105
|
+
entryManifest.async = {
|
|
106
|
+
...entries[name].async || {},
|
|
107
|
+
css: asyncCSS
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
entries[name] = entryManifest;
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
allFiles,
|
|
114
|
+
entries
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
const pluginManifest = () => ({
|
|
118
|
+
name: "rsbuild:manifest",
|
|
119
|
+
setup(api) {
|
|
120
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID }) => {
|
|
121
|
+
const htmlPaths = api.getHTMLPaths();
|
|
122
|
+
const {
|
|
123
|
+
output: { manifest }
|
|
124
|
+
} = api.getNormalizedConfig();
|
|
125
|
+
if (manifest === false) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const fileName = typeof manifest === "string" ? manifest : "manifest.json";
|
|
129
|
+
const { RspackManifestPlugin } = await Promise.resolve().then(() => __toESM(require("../../compiled/rspack-manifest-plugin")));
|
|
130
|
+
chain.plugin(CHAIN_ID.PLUGIN.MANIFEST).use(RspackManifestPlugin, [
|
|
131
|
+
{
|
|
132
|
+
fileName,
|
|
133
|
+
generate: generateManifest(htmlPaths)
|
|
134
|
+
}
|
|
135
|
+
]);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
140
|
+
0 && (module.exports = {
|
|
141
|
+
pluginManifest
|
|
142
|
+
});
|
|
@@ -98,6 +98,7 @@ const rspackProvider = async ({
|
|
|
98
98
|
import_plugins.plugins.performance(),
|
|
99
99
|
import_plugins.plugins.server(),
|
|
100
100
|
import_plugins.plugins.moduleFederation(),
|
|
101
|
+
import_plugins.plugins.manifest(),
|
|
101
102
|
Promise.resolve().then(() => __toESM(require("./plugins/rspackProfile"))).then((m) => m.pluginRspackProfile())
|
|
102
103
|
]);
|
|
103
104
|
pluginManager.addPlugins(allPlugins);
|
|
@@ -57,7 +57,6 @@ function filterResourceHints(resourceHints, scripts) {
|
|
|
57
57
|
}
|
|
58
58
|
function generateLinks(options, type, compilation, htmlPluginData, HTMLCount) {
|
|
59
59
|
const extractedChunks = (0, import_helpers.extractChunks)({
|
|
60
|
-
// @ts-expect-error compilation type mismatch
|
|
61
60
|
compilation,
|
|
62
61
|
includeType: options.type
|
|
63
62
|
});
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import type { PreloadOrPreFetchOption } from '@rsbuild/shared';
|
|
18
|
-
import type { Compilation } from '@rspack/core';
|
|
19
|
-
import type { Chunk } from 'webpack';
|
|
18
|
+
import type { Chunk, Compilation } from '@rspack/core';
|
|
20
19
|
import type { BeforeAssetTagGenerationHtmlPluginData } from './type';
|
|
21
20
|
interface DoesChunkBelongToHtmlOptions {
|
|
22
21
|
chunk: Chunk;
|
|
@@ -24,5 +23,6 @@ interface DoesChunkBelongToHtmlOptions {
|
|
|
24
23
|
htmlPluginData: BeforeAssetTagGenerationHtmlPluginData;
|
|
25
24
|
pluginOptions?: PreloadOrPreFetchOption;
|
|
26
25
|
}
|
|
26
|
+
export declare function recursiveChunkEntryNames(chunk: Chunk): string[];
|
|
27
27
|
export declare function doesChunkBelongToHtml({ chunk, htmlPluginData, }: DoesChunkBelongToHtmlOptions): boolean;
|
|
28
28
|
export {};
|
|
@@ -18,7 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var doesChunkBelongToHtml_exports = {};
|
|
20
20
|
__export(doesChunkBelongToHtml_exports, {
|
|
21
|
-
doesChunkBelongToHtml: () => doesChunkBelongToHtml
|
|
21
|
+
doesChunkBelongToHtml: () => doesChunkBelongToHtml,
|
|
22
|
+
recursiveChunkEntryNames: () => recursiveChunkEntryNames
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(doesChunkBelongToHtml_exports);
|
|
24
25
|
/**
|
|
@@ -71,5 +72,6 @@ function doesChunkBelongToHtml({
|
|
|
71
72
|
}
|
|
72
73
|
// Annotate the CommonJS export names for ESM import in node:
|
|
73
74
|
0 && (module.exports = {
|
|
74
|
-
doesChunkBelongToHtml
|
|
75
|
+
doesChunkBelongToHtml,
|
|
76
|
+
recursiveChunkEntryNames
|
|
75
77
|
});
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import type { PreloadIncludeType } from '@rsbuild/shared';
|
|
18
|
-
import type { Chunk, Compilation } from '
|
|
19
|
-
export type ChunkGroup = Compilation['chunkGroups'][0];
|
|
18
|
+
import type { Chunk, Compilation } from '@rspack/core';
|
|
20
19
|
interface ExtractChunks {
|
|
21
20
|
compilation: Compilation;
|
|
22
21
|
includeType?: PreloadIncludeType;
|
|
@@ -61,7 +61,7 @@ function extractChunks({
|
|
|
61
61
|
return chunks;
|
|
62
62
|
}
|
|
63
63
|
if (includeType === "all-assets") {
|
|
64
|
-
const licenseAssets = [...compilation.assetsInfo
|
|
64
|
+
const licenseAssets = [...compilation.assetsInfo?.values() || []].map((info) => {
|
|
65
65
|
if (info.related?.license) {
|
|
66
66
|
return info.related.license;
|
|
67
67
|
}
|
|
@@ -69,7 +69,6 @@ function extractChunks({
|
|
|
69
69
|
}).filter(Boolean);
|
|
70
70
|
return [
|
|
71
71
|
{
|
|
72
|
-
// @ts-expect-error ignore ts check for files
|
|
73
72
|
files: Object.keys(compilation.assets).filter(
|
|
74
73
|
(t) => !licenseAssets.includes(t)
|
|
75
74
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"types.d.ts"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@rspack/core": "0.6.
|
|
51
|
+
"@rspack/core": "0.6.5",
|
|
52
52
|
"@swc/helpers": "0.5.3",
|
|
53
53
|
"core-js": "~3.36.0",
|
|
54
54
|
"html-webpack-plugin": "npm:html-rspack-plugin@5.7.2",
|
|
55
55
|
"postcss": "^8.4.38",
|
|
56
|
-
"@rsbuild/shared": "0.6.
|
|
56
|
+
"@rsbuild/shared": "0.6.13"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "18.x",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"@types/ws": "^8.5.10",
|
|
62
62
|
"commander": "^12.0.0",
|
|
63
63
|
"connect-history-api-fallback": "^2.0.0",
|
|
64
|
+
"rspack-manifest-plugin": "5.0.0",
|
|
64
65
|
"dotenv": "16.4.5",
|
|
65
66
|
"dotenv-expand": "11.0.6",
|
|
66
67
|
"http-compression": "1.0.19",
|