@rsbuild/core 0.1.3 → 0.1.5

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.
Files changed (43) hide show
  1. package/dist/cli/commands.d.ts +2 -0
  2. package/dist/cli/commands.js +30 -3
  3. package/dist/cli/config.d.ts +1 -1
  4. package/dist/cli/config.js +13 -9
  5. package/dist/cli/prepare.js +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +3 -1
  8. package/dist/loadEnv.d.ts +8 -2
  9. package/dist/loadEnv.js +22 -10
  10. package/dist/plugins/html.js +6 -6
  11. package/dist/plugins/inlineChunk.js +2 -6
  12. package/dist/plugins/networkPerformance.js +13 -3
  13. package/dist/plugins/preloadOrPrefetch.js +13 -3
  14. package/dist/rspack-plugins/HtmlAppIconPlugin.d.ts +16 -0
  15. package/dist/rspack-plugins/HtmlAppIconPlugin.js +97 -0
  16. package/dist/rspack-plugins/HtmlCrossOriginPlugin.d.ts +15 -0
  17. package/dist/rspack-plugins/HtmlCrossOriginPlugin.js +59 -0
  18. package/dist/rspack-plugins/HtmlNetworkPerformancePlugin.d.ts +12 -0
  19. package/dist/rspack-plugins/HtmlNetworkPerformancePlugin.js +72 -0
  20. package/dist/rspack-plugins/HtmlNoncePlugin.d.ts +14 -0
  21. package/dist/rspack-plugins/HtmlNoncePlugin.js +52 -0
  22. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/helpers/determineAsValue.d.ts +25 -0
  23. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/helpers/determineAsValue.js +99 -0
  24. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/helpers/doesChunkBelongToHtml.d.ts +31 -0
  25. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/helpers/doesChunkBelongToHtml.js +75 -0
  26. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/helpers/extractChunks.d.ts +28 -0
  27. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/helpers/extractChunks.js +83 -0
  28. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/helpers/index.d.ts +4 -0
  29. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/helpers/index.js +28 -0
  30. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/helpers/type.d.ts +13 -0
  31. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/helpers/type.js +16 -0
  32. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/index.d.ts +30 -0
  33. package/dist/rspack-plugins/HtmlPreloadOrPrefetchPlugin/index.js +167 -0
  34. package/dist/rspack-plugins/HtmlTagsPlugin.d.ts +30 -0
  35. package/dist/rspack-plugins/HtmlTagsPlugin.js +173 -0
  36. package/dist/rspack-plugins/InlineChunkHtmlPlugin.d.ts +57 -0
  37. package/dist/rspack-plugins/InlineChunkHtmlPlugin.js +182 -0
  38. package/dist/rspack-provider/core/createContext.js +7 -3
  39. package/dist/server/devServer.d.ts +0 -1
  40. package/dist/server/devServer.js +0 -2
  41. package/dist/server/prodServer.d.ts +0 -1
  42. package/dist/server/prodServer.js +1 -6
  43. package/package.json +5 -4
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var HtmlNetworkPerformancePlugin_exports = {};
20
+ __export(HtmlNetworkPerformancePlugin_exports, {
21
+ HtmlNetworkPerformancePlugin: () => HtmlNetworkPerformancePlugin
22
+ });
23
+ module.exports = __toCommonJS(HtmlNetworkPerformancePlugin_exports);
24
+ var import_shared = require("@rsbuild/shared");
25
+ function generateLinks(options, type) {
26
+ const relMap = {
27
+ preconnect: "preconnect",
28
+ dnsPrefetch: "dns-prefetch"
29
+ };
30
+ return options.map((option) => ({
31
+ tagName: "link",
32
+ attributes: {
33
+ rel: relMap[type],
34
+ ...option
35
+ },
36
+ voidTag: false,
37
+ meta: {}
38
+ }));
39
+ }
40
+ class HtmlNetworkPerformancePlugin {
41
+ constructor(options, type, HtmlPlugin) {
42
+ this.options = options;
43
+ this.type = type;
44
+ this.HtmlPlugin = HtmlPlugin;
45
+ }
46
+ apply(compiler) {
47
+ compiler.hooks.compilation.tap(
48
+ `HTML${this.type}Plugin`,
49
+ (compilation) => {
50
+ this.HtmlPlugin.getHooks(compilation).alterAssetTagGroups.tap(
51
+ `HTML${(0, import_shared.upperFirst)(this.type)}Plugin`,
52
+ (htmlPluginData) => {
53
+ const { headTags } = htmlPluginData;
54
+ const options = this.options.map(
55
+ (option) => typeof option === "string" ? {
56
+ href: option
57
+ } : option
58
+ );
59
+ if (options.length) {
60
+ headTags.unshift(...generateLinks(options, this.type));
61
+ }
62
+ return htmlPluginData;
63
+ }
64
+ );
65
+ }
66
+ );
67
+ }
68
+ }
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ HtmlNetworkPerformancePlugin
72
+ });
@@ -0,0 +1,14 @@
1
+ import type HtmlWebpackPlugin from 'html-webpack-plugin';
2
+ import type { Compiler, RspackPluginInstance } from '@rspack/core';
3
+ type NonceOptions = {
4
+ nonce: string;
5
+ HtmlPlugin: typeof HtmlWebpackPlugin;
6
+ };
7
+ export declare class HtmlNoncePlugin implements RspackPluginInstance {
8
+ readonly name: string;
9
+ readonly nonce: string;
10
+ readonly HtmlPlugin: typeof HtmlWebpackPlugin;
11
+ constructor(options: NonceOptions);
12
+ apply(compiler: Compiler): void;
13
+ }
14
+ export {};
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var HtmlNoncePlugin_exports = {};
20
+ __export(HtmlNoncePlugin_exports, {
21
+ HtmlNoncePlugin: () => HtmlNoncePlugin
22
+ });
23
+ module.exports = __toCommonJS(HtmlNoncePlugin_exports);
24
+ class HtmlNoncePlugin {
25
+ constructor(options) {
26
+ const { nonce } = options;
27
+ this.name = "HtmlNoncePlugin";
28
+ this.nonce = nonce;
29
+ this.HtmlPlugin = options.HtmlPlugin;
30
+ }
31
+ apply(compiler) {
32
+ if (!this.nonce) {
33
+ return;
34
+ }
35
+ compiler.hooks.compilation.tap(this.name, (compilation) => {
36
+ this.HtmlPlugin.getHooks(compilation).alterAssetTags.tap(
37
+ this.name,
38
+ (alterAssetTags) => {
39
+ const {
40
+ assetTags: { scripts }
41
+ } = alterAssetTags;
42
+ scripts.forEach((script) => script.attributes.nonce = this.nonce);
43
+ return alterAssetTags;
44
+ }
45
+ );
46
+ });
47
+ }
48
+ }
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ HtmlNoncePlugin
52
+ });
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2018 Google Inc.
4
+ * https://github.com/vuejs/preload-webpack-plugin/blob/master/src/lib/determine-as-value.js
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import type { As } from './type';
19
+ export declare function determineAsValue({
20
+ href,
21
+ file
22
+ }: {
23
+ href: string;
24
+ file: string;
25
+ }): As;
@@ -0,0 +1,99 @@
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 determineAsValue_exports = {};
30
+ __export(determineAsValue_exports, {
31
+ determineAsValue: () => determineAsValue
32
+ });
33
+ module.exports = __toCommonJS(determineAsValue_exports);
34
+ var import_path = __toESM(require("path"));
35
+ var import_url = require("url");
36
+ /**
37
+ * @license
38
+ * Copyright 2018 Google Inc.
39
+ * https://github.com/vuejs/preload-webpack-plugin/blob/master/src/lib/determine-as-value.js
40
+ *
41
+ * Licensed under the Apache License, Version 2.0 (the "License");
42
+ * you may not use this file except in compliance with the License.
43
+ * You may obtain a copy of the License at
44
+ *
45
+ * http://www.apache.org/licenses/LICENSE-2.0
46
+ *
47
+ * Unless required by applicable law or agreed to in writing, software
48
+ * distributed under the License is distributed on an "AS IS" BASIS,
49
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50
+ * See the License for the specific language governing permissions and
51
+ * limitations under the License.
52
+ */
53
+ function determineAsValue({
54
+ href,
55
+ file
56
+ }) {
57
+ const url = new import_url.URL(file || href, "https://example.com");
58
+ const extension = import_path.default.extname(url.pathname);
59
+ if ([".css"].includes(extension)) {
60
+ return "style";
61
+ }
62
+ if ([
63
+ ".png",
64
+ ".jpg",
65
+ ".jpeg",
66
+ ".jfif",
67
+ ".pjpeg",
68
+ ".pjp",
69
+ ".svg",
70
+ ".webp",
71
+ ".bmp",
72
+ ".apng",
73
+ ".avif",
74
+ ".gif",
75
+ ".ico",
76
+ ".cur",
77
+ ".tif",
78
+ ".tiff"
79
+ ].includes(extension)) {
80
+ return "image";
81
+ }
82
+ if ([".mp4", ".ogg", ".webm"].includes(extension)) {
83
+ return "video";
84
+ }
85
+ if ([".mp3", ".wav"].includes(extension)) {
86
+ return "audio";
87
+ }
88
+ if ([".woff2", ".otf", ".ttf", ".woff", ".eot"].includes(extension)) {
89
+ return "font";
90
+ }
91
+ if ([".vtt"].includes(extension)) {
92
+ return "track";
93
+ }
94
+ return "script";
95
+ }
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
98
+ determineAsValue
99
+ });
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2018 Google Inc.
4
+ * https://github.com/vuejs/preload-webpack-plugin/blob/master/src/lib/does-chunk-belong-to-html.js
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { Compilation } from '@rspack/core';
18
+ import type { Chunk } from 'webpack';
19
+ import type { PreloadOrPreFetchOption } from '@rsbuild/shared';
20
+ import { BeforeAssetTagGenerationHtmlPluginData } from './type';
21
+ interface DoesChunkBelongToHtmlOptions {
22
+ chunk: Chunk;
23
+ compilation?: Compilation;
24
+ htmlPluginData: BeforeAssetTagGenerationHtmlPluginData;
25
+ pluginOptions?: PreloadOrPreFetchOption;
26
+ }
27
+ export declare function doesChunkBelongToHtml({
28
+ chunk,
29
+ htmlPluginData
30
+ }: DoesChunkBelongToHtmlOptions): boolean;
31
+ export {};
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var doesChunkBelongToHtml_exports = {};
20
+ __export(doesChunkBelongToHtml_exports, {
21
+ doesChunkBelongToHtml: () => doesChunkBelongToHtml
22
+ });
23
+ module.exports = __toCommonJS(doesChunkBelongToHtml_exports);
24
+ /**
25
+ * @license
26
+ * Copyright 2018 Google Inc.
27
+ * https://github.com/vuejs/preload-webpack-plugin/blob/master/src/lib/does-chunk-belong-to-html.js
28
+ * Licensed under the Apache License, Version 2.0 (the "License");
29
+ * you may not use this file except in compliance with the License.
30
+ * You may obtain a copy of the License at
31
+ *
32
+ * http://www.apache.org/licenses/LICENSE-2.0
33
+ *
34
+ * Unless required by applicable law or agreed to in writing, software
35
+ * distributed under the License is distributed on an "AS IS" BASIS,
36
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37
+ * See the License for the specific language governing permissions and
38
+ * limitations under the License.
39
+ */
40
+ function recursiveChunkGroup(chunkGroup) {
41
+ const parents = chunkGroup.getParents();
42
+ if (!parents.length) {
43
+ return [chunkGroup.name];
44
+ }
45
+ return parents.flatMap((chunkParent) => recursiveChunkGroup(chunkParent));
46
+ }
47
+ function recursiveChunkEntryNames(chunk) {
48
+ const isChunkName = (name) => Boolean(name);
49
+ const [...chunkGroups] = chunk.groupsIterable;
50
+ const names = chunkGroups.flatMap((chunkGroup) => recursiveChunkGroup(chunkGroup)).filter(isChunkName);
51
+ return [...new Set(names)];
52
+ }
53
+ function isChunksFiltered(chunkName, includeChunks, excludeChunks) {
54
+ if (Array.isArray(includeChunks) && includeChunks.indexOf(chunkName) === -1) {
55
+ return false;
56
+ }
57
+ if (Array.isArray(excludeChunks) && excludeChunks.indexOf(chunkName) !== -1) {
58
+ return false;
59
+ }
60
+ return true;
61
+ }
62
+ function doesChunkBelongToHtml({
63
+ chunk,
64
+ htmlPluginData
65
+ }) {
66
+ const { options } = htmlPluginData.plugin;
67
+ const chunkNames = recursiveChunkEntryNames(chunk);
68
+ return chunkNames.some(
69
+ (chunkName) => isChunksFiltered(chunkName, options?.chunks, options?.excludeChunks)
70
+ );
71
+ }
72
+ // Annotate the CommonJS export names for ESM import in node:
73
+ 0 && (module.exports = {
74
+ doesChunkBelongToHtml
75
+ });
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2018 Google Inc.
4
+ * https://github.com/vuejs/preload-webpack-plugin/blob/master/src/lib/extract-chunks.js
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Chunk, Compilation } from 'webpack';
18
+ import type { PreloadIncludeType } from '@rsbuild/shared';
19
+ export type ChunkGroup = Compilation['chunkGroups'][0];
20
+ interface ExtractChunks {
21
+ compilation: Compilation;
22
+ includeType?: PreloadIncludeType;
23
+ }
24
+ export declare function extractChunks({
25
+ compilation,
26
+ includeType
27
+ }: ExtractChunks): Chunk[];
28
+ export {};
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var extractChunks_exports = {};
20
+ __export(extractChunks_exports, {
21
+ extractChunks: () => extractChunks
22
+ });
23
+ module.exports = __toCommonJS(extractChunks_exports);
24
+ /**
25
+ * @license
26
+ * Copyright 2018 Google Inc.
27
+ * https://github.com/vuejs/preload-webpack-plugin/blob/master/src/lib/extract-chunks.js
28
+ * Licensed under the Apache License, Version 2.0 (the "License");
29
+ * you may not use this file except in compliance with the License.
30
+ * You may obtain a copy of the License at
31
+ *
32
+ * http://www.apache.org/licenses/LICENSE-2.0
33
+ *
34
+ * Unless required by applicable law or agreed to in writing, software
35
+ * distributed under the License is distributed on an "AS IS" BASIS,
36
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37
+ * See the License for the specific language governing permissions and
38
+ * limitations under the License.
39
+ */
40
+ function isAsync(chunk) {
41
+ if ("canBeInitial" in chunk) {
42
+ return !chunk.canBeInitial();
43
+ } else if ("isInitial" in chunk) {
44
+ return !chunk.isInitial();
45
+ }
46
+ return !chunk.initial;
47
+ }
48
+ function extractChunks({
49
+ compilation,
50
+ includeType
51
+ }) {
52
+ const chunks = [...compilation.chunks];
53
+ if (includeType === void 0 || includeType === "async-chunks") {
54
+ return chunks.filter(isAsync);
55
+ }
56
+ if (includeType === "initial") {
57
+ return chunks.filter((chunk) => !isAsync(chunk));
58
+ }
59
+ if (includeType === "all-chunks") {
60
+ return chunks;
61
+ }
62
+ if (includeType === "all-assets") {
63
+ const licenseAssets = [...compilation.assetsInfo.values()].map((info) => {
64
+ if (info.related?.license) {
65
+ return info.related.license;
66
+ }
67
+ return false;
68
+ }).filter(Boolean);
69
+ return [
70
+ {
71
+ // @ts-expect-error ignore ts check for files
72
+ files: Object.keys(compilation.assets).filter(
73
+ (t) => !licenseAssets.includes(t)
74
+ )
75
+ }
76
+ ];
77
+ }
78
+ return chunks;
79
+ }
80
+ // Annotate the CommonJS export names for ESM import in node:
81
+ 0 && (module.exports = {
82
+ extractChunks
83
+ });
@@ -0,0 +1,4 @@
1
+ export * from './extractChunks';
2
+ export * from './determineAsValue';
3
+ export * from './doesChunkBelongToHtml';
4
+ export * from './type';
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var helpers_exports = {};
17
+ module.exports = __toCommonJS(helpers_exports);
18
+ __reExport(helpers_exports, require("./extractChunks"), module.exports);
19
+ __reExport(helpers_exports, require("./determineAsValue"), module.exports);
20
+ __reExport(helpers_exports, require("./doesChunkBelongToHtml"), module.exports);
21
+ __reExport(helpers_exports, require("./type"), module.exports);
22
+ // Annotate the CommonJS export names for ESM import in node:
23
+ 0 && (module.exports = {
24
+ ...require("./extractChunks"),
25
+ ...require("./determineAsValue"),
26
+ ...require("./doesChunkBelongToHtml"),
27
+ ...require("./type")
28
+ });
@@ -0,0 +1,13 @@
1
+ import type HtmlWebpackPlugin from 'html-webpack-plugin';
2
+ export type BeforeAssetTagGenerationHtmlPluginData = {
3
+ assets: {
4
+ publicPath: string;
5
+ js: Array<string>;
6
+ css: Array<string>;
7
+ favicon?: string;
8
+ manifest?: string;
9
+ };
10
+ outputName: string;
11
+ plugin: HtmlWebpackPlugin;
12
+ };
13
+ export type As = 'audio' | 'document' | 'embed' | 'fetch' | 'font' | 'image' | 'object' | 'script' | 'style' | 'track' | 'worker' | 'video';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var type_exports = {};
16
+ module.exports = __toCommonJS(type_exports);
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2018 Google Inc.
4
+ * https://github.com/vuejs/preload-webpack-plugin/blob/master/src/index.js
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { Compiler, RspackPluginInstance } from '@rspack/core';
18
+ import type HtmlWebpackPlugin from 'html-webpack-plugin';
19
+ import { type PreloadOrPreFetchOption } from '@rsbuild/shared';
20
+ type LinkType = 'preload' | 'prefetch';
21
+ export declare class HTMLPreloadOrPrefetchPlugin implements RspackPluginInstance {
22
+ readonly options: PreloadOrPreFetchOption;
23
+ resourceHints: HtmlWebpackPlugin.HtmlTagObject[];
24
+ type: LinkType;
25
+ HtmlPlugin: typeof HtmlWebpackPlugin;
26
+ HTMLCount: number;
27
+ constructor(options: true | PreloadOrPreFetchOption, type: LinkType, HtmlPlugin: typeof HtmlWebpackPlugin, HTMLCount: number);
28
+ apply(compiler: Compiler): void;
29
+ }
30
+ export {};