@ohos-ports/rsbuild-core 1.7.2-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/LICENSE +21 -0
- package/README.md +27 -0
- package/bin/rsbuild.js +20 -0
- package/compiled/@jridgewell/remapping/index.d.ts +1 -0
- package/compiled/@jridgewell/remapping/index.js +1222 -0
- package/compiled/@jridgewell/remapping/license +19 -0
- package/compiled/@jridgewell/remapping/package.json +1 -0
- package/compiled/@jridgewell/trace-mapping/index.d.ts +194 -0
- package/compiled/@jridgewell/trace-mapping/index.js +1408 -0
- package/compiled/@jridgewell/trace-mapping/license +19 -0
- package/compiled/@jridgewell/trace-mapping/package.json +1 -0
- package/compiled/chokidar/index.d.ts +384 -0
- package/compiled/chokidar/index.js +1793 -0
- package/compiled/chokidar/license +21 -0
- package/compiled/chokidar/package.json +1 -0
- package/compiled/connect/index.d.ts +90 -0
- package/compiled/connect/index.js +1240 -0
- package/compiled/connect/license +25 -0
- package/compiled/connect/package.json +1 -0
- package/compiled/cors/index.d.ts +56 -0
- package/compiled/cors/index.js +371 -0
- package/compiled/cors/license +22 -0
- package/compiled/cors/package.json +1 -0
- package/compiled/css-loader/api.js +85 -0
- package/compiled/css-loader/getUrl.js +26 -0
- package/compiled/css-loader/index.d.ts +1 -0
- package/compiled/css-loader/index.js +2 -0
- package/compiled/css-loader/license +20 -0
- package/compiled/css-loader/noSourceMaps.js +5 -0
- package/compiled/css-loader/package.json +1 -0
- package/compiled/css-loader/sourceMaps.js +16 -0
- package/compiled/html-rspack-plugin/default_index.ejs +9 -0
- package/compiled/html-rspack-plugin/index.d.ts +290 -0
- package/compiled/html-rspack-plugin/index.js +1602 -0
- package/compiled/html-rspack-plugin/license +20 -0
- package/compiled/html-rspack-plugin/loader.js +166 -0
- package/compiled/html-rspack-plugin/package.json +1 -0
- package/compiled/http-proxy-middleware/index.d.ts +319 -0
- package/compiled/http-proxy-middleware/index.js +5284 -0
- package/compiled/http-proxy-middleware/license +22 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/launch-editor-middleware/index.d.ts +1 -0
- package/compiled/launch-editor-middleware/index.js +719 -0
- package/compiled/launch-editor-middleware/license +21 -0
- package/compiled/launch-editor-middleware/package.json +1 -0
- package/compiled/memfs/index.d.ts +1462 -0
- package/compiled/memfs/index.js +1 -0
- package/compiled/memfs/license +201 -0
- package/compiled/memfs/package.json +1 -0
- package/compiled/mrmime/index.d.ts +4 -0
- package/compiled/mrmime/index.js +456 -0
- package/compiled/mrmime/package.json +1 -0
- package/compiled/picocolors/index.d.ts +55 -0
- package/compiled/picocolors/index.js +108 -0
- package/compiled/picocolors/license +15 -0
- package/compiled/picocolors/package.json +1 -0
- package/compiled/postcss/index.js +1 -0
- package/compiled/postcss/lib/at-rule.d.ts +140 -0
- package/compiled/postcss/lib/comment.d.ts +68 -0
- package/compiled/postcss/lib/container.d.ts +483 -0
- package/compiled/postcss/lib/css-syntax-error.d.ts +248 -0
- package/compiled/postcss/lib/declaration.d.ts +151 -0
- package/compiled/postcss/lib/document.d.ts +69 -0
- package/compiled/postcss/lib/fromJSON.d.ts +9 -0
- package/compiled/postcss/lib/input.d.ts +227 -0
- package/compiled/postcss/lib/lazy-result.d.ts +190 -0
- package/compiled/postcss/lib/list.d.ts +60 -0
- package/compiled/postcss/lib/no-work-result.d.ts +46 -0
- package/compiled/postcss/lib/node.d.ts +556 -0
- package/compiled/postcss/lib/parse.d.ts +9 -0
- package/compiled/postcss/lib/postcss.d.ts +458 -0
- package/compiled/postcss/lib/previous-map.d.ts +81 -0
- package/compiled/postcss/lib/processor.d.ts +115 -0
- package/compiled/postcss/lib/result.d.ts +205 -0
- package/compiled/postcss/lib/root.d.ts +87 -0
- package/compiled/postcss/lib/rule.d.ts +126 -0
- package/compiled/postcss/lib/source-map-js.d.ts +4 -0
- package/compiled/postcss/lib/stringifier.d.ts +46 -0
- package/compiled/postcss/lib/stringify.d.ts +9 -0
- package/compiled/postcss/lib/warning.d.ts +147 -0
- package/compiled/postcss/license +20 -0
- package/compiled/postcss/package.json +1 -0
- package/compiled/postcss-loader/index.d.ts +1 -0
- package/compiled/postcss-loader/index.js +720 -0
- package/compiled/postcss-loader/license +20 -0
- package/compiled/postcss-loader/package.json +1 -0
- package/compiled/rslog/index.d.ts +67 -0
- package/compiled/rslog/license +21 -0
- package/compiled/rslog/package.json +1 -0
- package/compiled/rspack-chain/license +22 -0
- package/compiled/rspack-chain/package.json +1 -0
- package/compiled/rspack-chain/types/index.d.ts +545 -0
- package/compiled/rspack-manifest-plugin/index.d.ts +48 -0
- package/compiled/rspack-manifest-plugin/index.js +409 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/compiled/sirv/index.d.ts +1 -0
- package/compiled/sirv/index.js +274 -0
- package/compiled/sirv/package.json +1 -0
- package/compiled/style-loader/index.d.ts +1 -0
- package/compiled/style-loader/index.js +427 -0
- package/compiled/style-loader/license +20 -0
- package/compiled/style-loader/package.json +1 -0
- package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
- package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
- package/compiled/style-loader/runtime/insertBySelector.js +34 -0
- package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
- package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
- package/compiled/style-loader/runtime/isOldIE.js +17 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
- package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
- package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
- package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
- package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
- package/compiled/tinyglobby/index.d.ts +46 -0
- package/compiled/tinyglobby/index.js +2664 -0
- package/compiled/tinyglobby/license +21 -0
- package/compiled/tinyglobby/package.json +1 -0
- package/compiled/webpack-bundle-analyzer/index.d.ts +160 -0
- package/compiled/webpack-bundle-analyzer/index.js +23 -0
- package/compiled/webpack-bundle-analyzer/license +20 -0
- package/compiled/webpack-bundle-analyzer/package.json +1 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
- package/compiled/webpack-merge/index.d.ts +31 -0
- package/compiled/webpack-merge/index.js +1200 -0
- package/compiled/webpack-merge/license +20 -0
- package/compiled/webpack-merge/package.json +1 -0
- package/compiled/ws/index.d.ts +437 -0
- package/compiled/ws/index.js +3161 -0
- package/compiled/ws/license +20 -0
- package/compiled/ws/package.json +1 -0
- package/dist/0~open.js +427 -0
- package/dist/0~range-parser.js +49 -0
- package/dist/0~range-parser.js.LICENSE.txt +6 -0
- package/dist/131.js +9305 -0
- package/dist/131.js.LICENSE.txt +26 -0
- package/dist/136.mjs +42 -0
- package/dist/2~open.cjs +436 -0
- package/dist/2~range-parser.cjs +52 -0
- package/dist/2~range-parser.cjs.LICENSE.txt +6 -0
- package/dist/client/59.js +22 -0
- package/dist/client/hmr.js +206 -0
- package/dist/client/overlay.js +203 -0
- package/dist/ignoreCssLoader.mjs +3 -0
- package/dist/index.cjs +9456 -0
- package/dist/index.cjs.LICENSE.txt +26 -0
- package/dist/index.js +1 -0
- package/dist/rslib-runtime.js +44 -0
- package/dist/transformLoader.mjs +1 -0
- package/dist/transformRawLoader.mjs +4 -0
- package/dist-types/cli/commands.d.ts +28 -0
- package/dist-types/cli/index.d.ts +1 -0
- package/dist-types/cli/init.d.ts +7 -0
- package/dist-types/client/hmr.d.ts +3 -0
- package/dist-types/client/log.d.ts +13 -0
- package/dist-types/client/overlay.d.ts +1 -0
- package/dist-types/configChain.d.ts +154 -0
- package/dist-types/constants.d.ts +52 -0
- package/dist-types/createContext.d.ts +11 -0
- package/dist-types/createRsbuild.d.ts +5 -0
- package/dist-types/defaultConfig.d.ts +25 -0
- package/dist-types/helpers/compiler.d.ts +5 -0
- package/dist-types/helpers/exitHook.d.ts +3 -0
- package/dist-types/helpers/format.d.ts +2 -0
- package/dist-types/helpers/fs.d.ts +17 -0
- package/dist-types/helpers/index.d.ts +29 -0
- package/dist-types/helpers/path.d.ts +26 -0
- package/dist-types/helpers/stats.d.ts +18 -0
- package/dist-types/helpers/url.d.ts +11 -0
- package/dist-types/helpers/vendors.d.ts +29 -0
- package/dist-types/helpers/version.d.ts +7 -0
- package/dist-types/hooks.d.ts +44 -0
- package/dist-types/index.d.ts +22 -0
- package/dist-types/initPlugins.d.ts +6 -0
- package/dist-types/inspectConfig.d.ts +35 -0
- package/dist-types/loadConfig.d.ts +60 -0
- package/dist-types/loadEnv.d.ts +63 -0
- package/dist-types/loader/ignoreCssLoader.d.ts +3 -0
- package/dist-types/loader/transformLoader.d.ts +8 -0
- package/dist-types/loader/transformRawLoader.d.ts +3 -0
- package/dist-types/logger.d.ts +19 -0
- package/dist-types/mergeConfig.d.ts +2 -0
- package/dist-types/package.json +1 -0
- package/dist-types/pluginHelper.d.ts +12 -0
- package/dist-types/pluginManager.d.ts +21 -0
- package/dist-types/plugins/appIcon.d.ts +2 -0
- package/dist-types/plugins/asset.d.ts +3 -0
- package/dist-types/plugins/basic.d.ts +5 -0
- package/dist-types/plugins/bundleAnalyzer.d.ts +2 -0
- package/dist-types/plugins/cache.d.ts +2 -0
- package/dist-types/plugins/cleanOutput.d.ts +2 -0
- package/dist-types/plugins/css.d.ts +4 -0
- package/dist-types/plugins/define.d.ts +2 -0
- package/dist-types/plugins/entry.d.ts +2 -0
- package/dist-types/plugins/esm.d.ts +2 -0
- package/dist-types/plugins/externals.d.ts +2 -0
- package/dist-types/plugins/fileSize.d.ts +6 -0
- package/dist-types/plugins/html.d.ts +9 -0
- package/dist-types/plugins/inlineChunk.d.ts +6 -0
- package/dist-types/plugins/lazyCompilation.d.ts +2 -0
- package/dist-types/plugins/manifest.d.ts +2 -0
- package/dist-types/plugins/minimize.d.ts +10 -0
- package/dist-types/plugins/moduleFederation.d.ts +2 -0
- package/dist-types/plugins/moment.d.ts +2 -0
- package/dist-types/plugins/nodeAddons.d.ts +2 -0
- package/dist-types/plugins/nonce.d.ts +2 -0
- package/dist-types/plugins/output.d.ts +2 -0
- package/dist-types/plugins/performance.d.ts +5 -0
- package/dist-types/plugins/progress.d.ts +2 -0
- package/dist-types/plugins/resolve.d.ts +2 -0
- package/dist-types/plugins/resourceHints.d.ts +2 -0
- package/dist-types/plugins/rsdoctor.d.ts +2 -0
- package/dist-types/plugins/rspackProfile.d.ts +2 -0
- package/dist-types/plugins/server.d.ts +2 -0
- package/dist-types/plugins/sourceMap.d.ts +2 -0
- package/dist-types/plugins/splitChunks.d.ts +4 -0
- package/dist-types/plugins/sri.d.ts +2 -0
- package/dist-types/plugins/swc.d.ts +5 -0
- package/dist-types/plugins/target.d.ts +2 -0
- package/dist-types/plugins/wasm.d.ts +2 -0
- package/dist-types/provider/build.d.ts +4 -0
- package/dist-types/provider/createCompiler.d.ts +6 -0
- package/dist-types/provider/helpers.d.ts +12 -0
- package/dist-types/provider/initConfigs.d.ts +19 -0
- package/dist-types/provider/provider.d.ts +2 -0
- package/dist-types/provider/rspackConfig.d.ts +8 -0
- package/dist-types/restart.d.ts +18 -0
- package/dist-types/rspack-plugins/RsbuildHtmlPlugin.d.ts +38 -0
- package/dist-types/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +32 -0
- package/dist-types/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +28 -0
- package/dist-types/rspack-plugins/resource-hints/extractChunks.d.ts +23 -0
- package/dist-types/rspack-plugins/resource-hints/getResourceType.d.ts +22 -0
- package/dist-types/rspack.d.ts +2 -0
- package/dist-types/server/ansiHTML.d.ts +4 -0
- package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +12 -0
- package/dist-types/server/assets-middleware/index.d.ts +37 -0
- package/dist-types/server/assets-middleware/middleware.d.ts +2 -0
- package/dist-types/server/assets-middleware/parseTokenList.d.ts +1 -0
- package/dist-types/server/assets-middleware/setupOutputFileSystem.d.ts +3 -0
- package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +15 -0
- package/dist-types/server/browserLogs.d.ts +9 -0
- package/dist-types/server/buildManager.d.ts +33 -0
- package/dist-types/server/cliShortcuts.d.ts +10 -0
- package/dist-types/server/devMiddlewares.d.ts +21 -0
- package/dist-types/server/devServer.d.ts +79 -0
- package/dist-types/server/environment.d.ts +8 -0
- package/dist-types/server/gracefulShutdown.d.ts +10 -0
- package/dist-types/server/gzipMiddleware.d.ts +2 -0
- package/dist-types/server/helper.d.ts +91 -0
- package/dist-types/server/historyApiFallback.d.ts +2 -0
- package/dist-types/server/hmrFallback.d.ts +1 -0
- package/dist-types/server/httpServer.d.ts +7 -0
- package/dist-types/server/middlewares.d.ts +33 -0
- package/dist-types/server/open.d.ts +10 -0
- package/dist-types/server/overlay.d.ts +3 -0
- package/dist-types/server/prodServer.d.ts +24 -0
- package/dist-types/server/proxy.d.ts +6 -0
- package/dist-types/server/runner/asModule.d.ts +2 -0
- package/dist-types/server/runner/basic.d.ts +29 -0
- package/dist-types/server/runner/cjs.d.ts +10 -0
- package/dist-types/server/runner/esm.d.ts +6 -0
- package/dist-types/server/runner/index.d.ts +4 -0
- package/dist-types/server/runner/type.d.ts +42 -0
- package/dist-types/server/socketServer.d.ts +81 -0
- package/dist-types/server/watchFiles.d.ts +14 -0
- package/dist-types/types/config.d.ts +1882 -0
- package/dist-types/types/context.d.ts +110 -0
- package/dist-types/types/hooks.d.ts +275 -0
- package/dist-types/types/index.d.ts +8 -0
- package/dist-types/types/plugin.d.ts +585 -0
- package/dist-types/types/rsbuild.d.ts +286 -0
- package/dist-types/types/rspack.d.ts +16 -0
- package/dist-types/types/thirdParty.d.ts +186 -0
- package/dist-types/types/utils.d.ts +19 -0
- package/package.json +114 -0
- package/static/openChrome.applescript +95 -0
- package/types.d.ts +349 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Chunk, Compiler, RspackPluginInstance, Compilation } from '@rspack/core';
|
|
2
|
+
|
|
3
|
+
interface FileDescriptor {
|
|
4
|
+
chunk?: Chunk;
|
|
5
|
+
isAsset: boolean;
|
|
6
|
+
isChunk: boolean;
|
|
7
|
+
isInitial: boolean;
|
|
8
|
+
isModuleAsset: boolean;
|
|
9
|
+
name: string;
|
|
10
|
+
path: string;
|
|
11
|
+
integrity?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare const getCompilerHooks: (compiler: Compiler) => any;
|
|
15
|
+
|
|
16
|
+
type Manifest = Record<string, any>;
|
|
17
|
+
interface InternalOptions {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
assetHookStage: number;
|
|
20
|
+
basePath: string;
|
|
21
|
+
fileName: string;
|
|
22
|
+
filter: (file: FileDescriptor) => boolean;
|
|
23
|
+
generate: (seed: Record<any, any>, files: FileDescriptor[], entries: Record<string, string[]>, context: {
|
|
24
|
+
compilation: Compilation;
|
|
25
|
+
}) => Manifest;
|
|
26
|
+
map: (file: FileDescriptor) => FileDescriptor;
|
|
27
|
+
publicPath: string;
|
|
28
|
+
removeKeyHash: RegExp | false;
|
|
29
|
+
seed: Record<any, any>;
|
|
30
|
+
serialize: (manifest: Manifest) => string;
|
|
31
|
+
sort: (fileA: FileDescriptor, fileB: FileDescriptor) => Number;
|
|
32
|
+
transformExtensions: RegExp;
|
|
33
|
+
useEntryKeys: boolean;
|
|
34
|
+
useLegacyEmit: boolean;
|
|
35
|
+
writeToFileEmit: boolean;
|
|
36
|
+
}
|
|
37
|
+
type ManifestPluginOptions = Partial<InternalOptions>;
|
|
38
|
+
type EmitCountMap = Map<any, any>;
|
|
39
|
+
declare class WebpackManifestPlugin implements RspackPluginInstance {
|
|
40
|
+
private options;
|
|
41
|
+
constructor(opts: ManifestPluginOptions);
|
|
42
|
+
apply(compiler: Compiler): void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare const RspackManifestPlugin: typeof WebpackManifestPlugin;
|
|
46
|
+
|
|
47
|
+
export { RspackManifestPlugin, WebpackManifestPlugin, getCompilerHooks };
|
|
48
|
+
export type { EmitCountMap, FileDescriptor, InternalOptions, Manifest, ManifestPluginOptions };
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_modules__ = {
|
|
4
|
+
305: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transformFiles =
|
|
7
|
+
exports.reduceChunk =
|
|
8
|
+
exports.reduceAssets =
|
|
9
|
+
exports.generateManifest =
|
|
10
|
+
void 0;
|
|
11
|
+
const node_path_1 = __nccwpck_require__(760);
|
|
12
|
+
const generateManifest = (
|
|
13
|
+
compilation,
|
|
14
|
+
files,
|
|
15
|
+
{ generate, seed = {} },
|
|
16
|
+
) => {
|
|
17
|
+
let result;
|
|
18
|
+
if (generate) {
|
|
19
|
+
const entrypointsArray = Array.from(
|
|
20
|
+
compilation.entrypoints.entries(),
|
|
21
|
+
);
|
|
22
|
+
const entrypoints = entrypointsArray.reduce(
|
|
23
|
+
(e, [name, entrypoint]) =>
|
|
24
|
+
Object.assign(e, { [name]: entrypoint.getFiles() }),
|
|
25
|
+
{},
|
|
26
|
+
);
|
|
27
|
+
result = generate(seed, files, entrypoints, { compilation });
|
|
28
|
+
} else {
|
|
29
|
+
result = files.reduce(
|
|
30
|
+
(manifest, file) =>
|
|
31
|
+
Object.assign(manifest, { [file.name]: file.path }),
|
|
32
|
+
seed,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
exports.generateManifest = generateManifest;
|
|
38
|
+
const getFileType = (fileName, { transformExtensions }) => {
|
|
39
|
+
const replaced = fileName.replace(/\?.*/, "");
|
|
40
|
+
const split = replaced.split(".");
|
|
41
|
+
const extension = split.pop();
|
|
42
|
+
return transformExtensions.test(extension)
|
|
43
|
+
? `${split.pop()}.${extension}`
|
|
44
|
+
: extension;
|
|
45
|
+
};
|
|
46
|
+
const reduceAssets = (files, asset, moduleAssets) => {
|
|
47
|
+
let name;
|
|
48
|
+
if (moduleAssets[asset.name]) {
|
|
49
|
+
name = moduleAssets[asset.name];
|
|
50
|
+
} else if (asset.info.sourceFilename) {
|
|
51
|
+
name = (0, node_path_1.join)(
|
|
52
|
+
(0, node_path_1.dirname)(asset.name),
|
|
53
|
+
(0, node_path_1.basename)(asset.info.sourceFilename),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
if (name) {
|
|
57
|
+
return files.concat({
|
|
58
|
+
isAsset: true,
|
|
59
|
+
isChunk: false,
|
|
60
|
+
isInitial: false,
|
|
61
|
+
isModuleAsset: true,
|
|
62
|
+
name,
|
|
63
|
+
path: asset.name,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const isEntryAsset = asset.chunks && asset.chunks.length > 0;
|
|
67
|
+
if (isEntryAsset) {
|
|
68
|
+
return files;
|
|
69
|
+
}
|
|
70
|
+
return files.concat({
|
|
71
|
+
isAsset: true,
|
|
72
|
+
isChunk: false,
|
|
73
|
+
isInitial: false,
|
|
74
|
+
isModuleAsset: false,
|
|
75
|
+
name: asset.name,
|
|
76
|
+
path: asset.name,
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
exports.reduceAssets = reduceAssets;
|
|
80
|
+
const reduceChunk = (files, chunk, options, auxiliaryFiles) => {
|
|
81
|
+
Array.from(chunk.auxiliaryFiles || []).forEach((auxiliaryFile) => {
|
|
82
|
+
auxiliaryFiles[auxiliaryFile] = {
|
|
83
|
+
isAsset: true,
|
|
84
|
+
isChunk: false,
|
|
85
|
+
isInitial: false,
|
|
86
|
+
isModuleAsset: true,
|
|
87
|
+
name: (0, node_path_1.basename)(auxiliaryFile),
|
|
88
|
+
path: auxiliaryFile,
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
return Array.from(chunk.files).reduce((prev, path) => {
|
|
92
|
+
let name = chunk.name ? chunk.name : null;
|
|
93
|
+
name = name
|
|
94
|
+
? options.useEntryKeys && !path.endsWith(".map")
|
|
95
|
+
? name
|
|
96
|
+
: `${name}.${getFileType(path, options)}`
|
|
97
|
+
: path;
|
|
98
|
+
return prev.concat({
|
|
99
|
+
chunk,
|
|
100
|
+
isAsset: false,
|
|
101
|
+
isChunk: true,
|
|
102
|
+
isInitial: chunk.isOnlyInitial(),
|
|
103
|
+
isModuleAsset: false,
|
|
104
|
+
name,
|
|
105
|
+
path,
|
|
106
|
+
});
|
|
107
|
+
}, files);
|
|
108
|
+
};
|
|
109
|
+
exports.reduceChunk = reduceChunk;
|
|
110
|
+
const standardizeFilePaths = (file) => {
|
|
111
|
+
const result = Object.assign({}, file);
|
|
112
|
+
result.name = file.name.replace(/\\/g, "/");
|
|
113
|
+
result.path = file.path.replace(/\\/g, "/");
|
|
114
|
+
return result;
|
|
115
|
+
};
|
|
116
|
+
const transformFiles = (files, options) =>
|
|
117
|
+
["filter", "map", "sort"]
|
|
118
|
+
.filter((fname) => !!options[fname])
|
|
119
|
+
.reduce((prev, fname) => prev[fname](options[fname]), files)
|
|
120
|
+
.map(standardizeFilePaths);
|
|
121
|
+
exports.transformFiles = transformFiles;
|
|
122
|
+
},
|
|
123
|
+
172: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
124
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
125
|
+
exports.normalModuleLoaderHook =
|
|
126
|
+
exports.getCompilerHooks =
|
|
127
|
+
exports.emitHook =
|
|
128
|
+
exports.beforeRunHook =
|
|
129
|
+
void 0;
|
|
130
|
+
const node_fs_1 = __nccwpck_require__(24);
|
|
131
|
+
const node_path_1 = __nccwpck_require__(760);
|
|
132
|
+
const lite_tapable_1 = __nccwpck_require__(408);
|
|
133
|
+
const helpers_1 = __nccwpck_require__(305);
|
|
134
|
+
const compilerHookMap = new WeakMap();
|
|
135
|
+
const getCompilerHooks = (compiler) => {
|
|
136
|
+
let hooks = compilerHookMap.get(compiler);
|
|
137
|
+
if (typeof hooks === "undefined") {
|
|
138
|
+
hooks = {
|
|
139
|
+
afterEmit: new lite_tapable_1.SyncWaterfallHook(["manifest"]),
|
|
140
|
+
beforeEmit: new lite_tapable_1.SyncWaterfallHook(["manifest"]),
|
|
141
|
+
};
|
|
142
|
+
compilerHookMap.set(compiler, hooks);
|
|
143
|
+
}
|
|
144
|
+
return hooks;
|
|
145
|
+
};
|
|
146
|
+
exports.getCompilerHooks = getCompilerHooks;
|
|
147
|
+
const beforeRunHook = (
|
|
148
|
+
{ emitCountMap, manifestFileName },
|
|
149
|
+
_,
|
|
150
|
+
callback,
|
|
151
|
+
) => {
|
|
152
|
+
const emitCount = emitCountMap.get(manifestFileName) || 0;
|
|
153
|
+
emitCountMap.set(manifestFileName, emitCount + 1);
|
|
154
|
+
if (callback) {
|
|
155
|
+
callback();
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
exports.beforeRunHook = beforeRunHook;
|
|
159
|
+
const emitHook = function emit(
|
|
160
|
+
{
|
|
161
|
+
compiler,
|
|
162
|
+
emitCountMap,
|
|
163
|
+
manifestAssetId,
|
|
164
|
+
manifestFileName,
|
|
165
|
+
moduleAssets,
|
|
166
|
+
options,
|
|
167
|
+
},
|
|
168
|
+
compilation,
|
|
169
|
+
) {
|
|
170
|
+
var _a;
|
|
171
|
+
const emitCount = emitCountMap.get(manifestFileName) - 1;
|
|
172
|
+
const stats = compilation
|
|
173
|
+
.getStats()
|
|
174
|
+
.toJson({
|
|
175
|
+
all: false,
|
|
176
|
+
assets: true,
|
|
177
|
+
cachedAssets: true,
|
|
178
|
+
ids: true,
|
|
179
|
+
publicPath: true,
|
|
180
|
+
});
|
|
181
|
+
const resolvedPublicPath =
|
|
182
|
+
options.publicPath !== null ? options.publicPath : stats.publicPath;
|
|
183
|
+
const publicPath =
|
|
184
|
+
resolvedPublicPath === "auto" ? "" : resolvedPublicPath;
|
|
185
|
+
const { basePath, removeKeyHash } = options;
|
|
186
|
+
emitCountMap.set(manifestFileName, emitCount);
|
|
187
|
+
const auxiliaryFiles = {};
|
|
188
|
+
let files = Array.from(compilation.chunks).reduce(
|
|
189
|
+
(prev, chunk) =>
|
|
190
|
+
(0, helpers_1.reduceChunk)(prev, chunk, options, auxiliaryFiles),
|
|
191
|
+
[],
|
|
192
|
+
);
|
|
193
|
+
files = stats.assets.reduce(
|
|
194
|
+
(prev, asset) =>
|
|
195
|
+
(0, helpers_1.reduceAssets)(prev, asset, moduleAssets),
|
|
196
|
+
files,
|
|
197
|
+
);
|
|
198
|
+
files = files.filter(({ name, path }) => {
|
|
199
|
+
var _a;
|
|
200
|
+
return (
|
|
201
|
+
!path.includes("hot-update") &&
|
|
202
|
+
typeof emitCountMap.get(
|
|
203
|
+
(0, node_path_1.join)(
|
|
204
|
+
((_a = compiler.options.output) === null || _a === void 0
|
|
205
|
+
? void 0
|
|
206
|
+
: _a.path) || "<unknown>",
|
|
207
|
+
name,
|
|
208
|
+
),
|
|
209
|
+
) === "undefined"
|
|
210
|
+
);
|
|
211
|
+
});
|
|
212
|
+
files.forEach((file) => {
|
|
213
|
+
delete auxiliaryFiles[file.path];
|
|
214
|
+
});
|
|
215
|
+
Object.keys(auxiliaryFiles).forEach((auxiliaryFile) => {
|
|
216
|
+
files = files.concat(auxiliaryFiles[auxiliaryFile]);
|
|
217
|
+
});
|
|
218
|
+
const integrityMap = {};
|
|
219
|
+
(_a = stats.assets) === null || _a === void 0
|
|
220
|
+
? void 0
|
|
221
|
+
: _a.forEach((asset) => {
|
|
222
|
+
if (asset.integrity) {
|
|
223
|
+
integrityMap[asset.name] = asset.integrity;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
files = files.map((file) => {
|
|
227
|
+
const normalizePath = (path) => {
|
|
228
|
+
if (!path.endsWith("/")) {
|
|
229
|
+
return `${path}/`;
|
|
230
|
+
}
|
|
231
|
+
return path;
|
|
232
|
+
};
|
|
233
|
+
const changes = {
|
|
234
|
+
name: basePath ? normalizePath(basePath) + file.name : file.name,
|
|
235
|
+
path: publicPath
|
|
236
|
+
? normalizePath(publicPath) + file.path
|
|
237
|
+
: file.path,
|
|
238
|
+
};
|
|
239
|
+
if (integrityMap[file.path]) {
|
|
240
|
+
changes.integrity = integrityMap[file.path];
|
|
241
|
+
}
|
|
242
|
+
changes.name = removeKeyHash
|
|
243
|
+
? changes.name.replace(removeKeyHash, "")
|
|
244
|
+
: changes.name;
|
|
245
|
+
return Object.assign(file, changes);
|
|
246
|
+
});
|
|
247
|
+
files = (0, helpers_1.transformFiles)(files, options);
|
|
248
|
+
let manifest = (0, helpers_1.generateManifest)(
|
|
249
|
+
compilation,
|
|
250
|
+
files,
|
|
251
|
+
options,
|
|
252
|
+
);
|
|
253
|
+
const isLastEmit = emitCount === 0;
|
|
254
|
+
manifest = getCompilerHooks(compiler).beforeEmit.call(manifest);
|
|
255
|
+
if (isLastEmit) {
|
|
256
|
+
const output = options.serialize(manifest);
|
|
257
|
+
compilation.emitAsset(
|
|
258
|
+
manifestAssetId,
|
|
259
|
+
new compiler.webpack.sources.RawSource(output),
|
|
260
|
+
);
|
|
261
|
+
if (options.writeToFileEmit) {
|
|
262
|
+
(0, node_fs_1.mkdirSync)(
|
|
263
|
+
(0, node_path_1.dirname)(manifestFileName),
|
|
264
|
+
{ recursive: true },
|
|
265
|
+
);
|
|
266
|
+
(0, node_fs_1.writeFileSync)(manifestFileName, output);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
getCompilerHooks(compiler).afterEmit.call(manifest);
|
|
270
|
+
};
|
|
271
|
+
exports.emitHook = emitHook;
|
|
272
|
+
const normalModuleLoaderHook = ({ moduleAssets }, context, module) => {
|
|
273
|
+
const loaderContext = context;
|
|
274
|
+
const { emitFile } = loaderContext;
|
|
275
|
+
loaderContext.emitFile = (file, content, sourceMap) => {
|
|
276
|
+
if (module.userRequest && !moduleAssets[file]) {
|
|
277
|
+
Object.assign(moduleAssets, {
|
|
278
|
+
[file]: (0, node_path_1.join)(
|
|
279
|
+
(0, node_path_1.dirname)(file),
|
|
280
|
+
(0, node_path_1.basename)(module.userRequest),
|
|
281
|
+
),
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
return emitFile.call(module, file, content, sourceMap);
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
exports.normalModuleLoaderHook = normalModuleLoaderHook;
|
|
288
|
+
},
|
|
289
|
+
408: (module) => {
|
|
290
|
+
module.exports = require("@rspack/lite-tapable");
|
|
291
|
+
},
|
|
292
|
+
24: (module) => {
|
|
293
|
+
module.exports = require("node:fs");
|
|
294
|
+
},
|
|
295
|
+
760: (module) => {
|
|
296
|
+
module.exports = require("node:path");
|
|
297
|
+
},
|
|
298
|
+
};
|
|
299
|
+
var __webpack_module_cache__ = {};
|
|
300
|
+
function __nccwpck_require__(moduleId) {
|
|
301
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
302
|
+
if (cachedModule !== undefined) {
|
|
303
|
+
return cachedModule.exports;
|
|
304
|
+
}
|
|
305
|
+
var module = (__webpack_module_cache__[moduleId] = { exports: {} });
|
|
306
|
+
var threw = true;
|
|
307
|
+
try {
|
|
308
|
+
__webpack_modules__[moduleId](
|
|
309
|
+
module,
|
|
310
|
+
module.exports,
|
|
311
|
+
__nccwpck_require__,
|
|
312
|
+
);
|
|
313
|
+
threw = false;
|
|
314
|
+
} finally {
|
|
315
|
+
if (threw) delete __webpack_module_cache__[moduleId];
|
|
316
|
+
}
|
|
317
|
+
return module.exports;
|
|
318
|
+
}
|
|
319
|
+
if (typeof __nccwpck_require__ !== "undefined")
|
|
320
|
+
__nccwpck_require__.ab = __dirname + "/";
|
|
321
|
+
var __webpack_exports__ = {};
|
|
322
|
+
(() => {
|
|
323
|
+
var exports = __webpack_exports__;
|
|
324
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
325
|
+
exports.RspackManifestPlugin =
|
|
326
|
+
exports.WebpackManifestPlugin =
|
|
327
|
+
exports.getCompilerHooks =
|
|
328
|
+
void 0;
|
|
329
|
+
const node_path_1 = __nccwpck_require__(760);
|
|
330
|
+
const hooks_1 = __nccwpck_require__(172);
|
|
331
|
+
Object.defineProperty(exports, "getCompilerHooks", {
|
|
332
|
+
enumerable: true,
|
|
333
|
+
get: function () {
|
|
334
|
+
return hooks_1.getCompilerHooks;
|
|
335
|
+
},
|
|
336
|
+
});
|
|
337
|
+
const emitCountMap = new Map();
|
|
338
|
+
const defaults = {
|
|
339
|
+
assetHookStage: Infinity,
|
|
340
|
+
basePath: "",
|
|
341
|
+
fileName: "manifest.json",
|
|
342
|
+
filter: null,
|
|
343
|
+
generate: void 0,
|
|
344
|
+
map: null,
|
|
345
|
+
publicPath: null,
|
|
346
|
+
removeKeyHash: /([a-f0-9]{16,32}\.?)/gi,
|
|
347
|
+
seed: void 0,
|
|
348
|
+
serialize(manifest) {
|
|
349
|
+
return JSON.stringify(manifest, null, 2);
|
|
350
|
+
},
|
|
351
|
+
sort: null,
|
|
352
|
+
transformExtensions: /^(gz|map)$/i,
|
|
353
|
+
useEntryKeys: false,
|
|
354
|
+
useLegacyEmit: false,
|
|
355
|
+
writeToFileEmit: false,
|
|
356
|
+
};
|
|
357
|
+
class WebpackManifestPlugin {
|
|
358
|
+
constructor(opts) {
|
|
359
|
+
this.options = Object.assign({}, defaults, opts);
|
|
360
|
+
}
|
|
361
|
+
apply(compiler) {
|
|
362
|
+
var _a, _b;
|
|
363
|
+
const moduleAssets = {};
|
|
364
|
+
const manifestFileName = (0, node_path_1.resolve)(
|
|
365
|
+
((_a = compiler.options.output) === null || _a === void 0
|
|
366
|
+
? void 0
|
|
367
|
+
: _a.path) || "./",
|
|
368
|
+
this.options.fileName,
|
|
369
|
+
);
|
|
370
|
+
const manifestAssetId = (0, node_path_1.relative)(
|
|
371
|
+
((_b = compiler.options.output) === null || _b === void 0
|
|
372
|
+
? void 0
|
|
373
|
+
: _b.path) || "./",
|
|
374
|
+
manifestFileName,
|
|
375
|
+
);
|
|
376
|
+
const beforeRun = hooks_1.beforeRunHook.bind(this, {
|
|
377
|
+
emitCountMap,
|
|
378
|
+
manifestFileName,
|
|
379
|
+
});
|
|
380
|
+
const emit = hooks_1.emitHook.bind(this, {
|
|
381
|
+
compiler,
|
|
382
|
+
emitCountMap,
|
|
383
|
+
manifestAssetId,
|
|
384
|
+
manifestFileName,
|
|
385
|
+
moduleAssets,
|
|
386
|
+
options: this.options,
|
|
387
|
+
});
|
|
388
|
+
const hookOptions = {
|
|
389
|
+
name: "WebpackManifestPlugin",
|
|
390
|
+
stage: this.options.assetHookStage,
|
|
391
|
+
};
|
|
392
|
+
if (this.options.useLegacyEmit === true) {
|
|
393
|
+
compiler.hooks.emit.tap(hookOptions, emit);
|
|
394
|
+
} else {
|
|
395
|
+
compiler.hooks.thisCompilation.tap(hookOptions, (compilation) => {
|
|
396
|
+
compilation.hooks.processAssets.tap(hookOptions, () =>
|
|
397
|
+
emit(compilation),
|
|
398
|
+
);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
compiler.hooks.run.tapAsync(hookOptions, beforeRun);
|
|
402
|
+
compiler.hooks.watchRun.tapAsync(hookOptions, beforeRun);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
exports.WebpackManifestPlugin = WebpackManifestPlugin;
|
|
406
|
+
exports.RspackManifestPlugin = WebpackManifestPlugin;
|
|
407
|
+
})();
|
|
408
|
+
module.exports = __webpack_exports__;
|
|
409
|
+
})();
|
|
@@ -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.2.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export = any;
|