@rsbuild/core 0.0.12 → 0.0.14
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/dist/cli/config.d.ts +3 -9
- package/dist/cli/index.js +1 -2
- package/dist/plugins/asset.d.ts +2 -1
- package/dist/plugins/asset.js +10 -1
- package/dist/plugins/entry.d.ts +1 -1
- package/dist/plugins/entry.js +2 -12
- package/dist/plugins/fileSize.js +9 -11
- package/dist/plugins/html.d.ts +4 -4
- package/dist/plugins/html.js +18 -9
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/moment.d.ts +1 -1
- package/dist/plugins/moment.js +27 -2
- package/dist/plugins/nodeAddons.js +1 -2
- package/dist/plugins/splitChunks.js +2 -10
- package/dist/plugins/startUrl.js +6 -8
- package/dist/rspack-provider/config/defaults.js +1 -4
- package/dist/rspack-provider/core/build.d.ts +4 -5
- package/dist/rspack-provider/core/createCompiler.d.ts +2 -1
- package/dist/rspack-provider/core/createContext.js +0 -4
- package/dist/rspack-provider/core/initConfigs.d.ts +1 -1
- package/dist/rspack-provider/core/initConfigs.js +1 -2
- package/dist/rspack-provider/core/initHooks.d.ts +2 -2
- package/dist/rspack-provider/core/inspectConfig.d.ts +3 -4
- package/dist/rspack-provider/core/rspackConfig.d.ts +2 -2
- package/dist/rspack-provider/core/rspackConfig.js +5 -8
- package/dist/rspack-provider/core/startDevServer.d.ts +3 -4
- package/dist/rspack-provider/core/startDevServer.js +1 -1
- package/dist/rspack-provider/index.d.ts +2 -1
- package/dist/rspack-provider/plugins/css.d.ts +2 -2
- package/dist/rspack-provider/plugins/css.js +2 -2
- package/dist/rspack-provider/plugins/fallback.js +0 -2
- package/dist/rspack-provider/plugins/minimize.d.ts +3 -2
- package/dist/rspack-provider/plugins/minimize.js +9 -4
- package/dist/rspack-provider/plugins/swc.d.ts +2 -2
- package/dist/rspack-provider/provider.d.ts +3 -3
- package/dist/rspack-provider/provider.js +1 -2
- package/dist/rspack-provider/rspackPlugin/removeCssSourcemapPlugin.d.ts +1 -1
- package/dist/rspack-provider/shared/plugin.js +0 -3
- package/dist/rspack-provider/types/context.d.ts +1 -4
- package/dist/rspack-provider/types/hooks.d.ts +2 -10
- package/dist/rspack-provider/types/index.d.ts +1 -2
- package/dist/rspack-provider/types/index.js +1 -5
- package/dist/rspack-provider/types/plugin.d.ts +3 -4
- package/dist/utils/generateMetaTags.d.ts +2 -1
- package/dist/utils/generateMetaTags.js +4 -18
- package/package.json +8 -8
- package/static/openChrome.applescript +95 -0
- package/dist/plugins/checkSyntax.d.ts +0 -0
- package/dist/plugins/checkSyntax.js +0 -1
- package/dist/plugins/svg.d.ts +0 -2
- package/dist/plugins/svg.js +0 -60
- package/dist/rspack-provider/config/validate/dev.d.ts +0 -3
- package/dist/rspack-provider/config/validate/dev.js +0 -29
- package/dist/rspack-provider/config/validate/html.d.ts +0 -3
- package/dist/rspack-provider/config/validate/html.js +0 -29
- package/dist/rspack-provider/config/validate/index.d.ts +0 -4
- package/dist/rspack-provider/config/validate/index.js +0 -50
- package/dist/rspack-provider/config/validate/output.d.ts +0 -3
- package/dist/rspack-provider/config/validate/output.js +0 -29
- package/dist/rspack-provider/config/validate/performance.d.ts +0 -3
- package/dist/rspack-provider/config/validate/performance.js +0 -41
- package/dist/rspack-provider/config/validate/security.d.ts +0 -3
- package/dist/rspack-provider/config/validate/security.js +0 -29
- package/dist/rspack-provider/config/validate/source.d.ts +0 -3
- package/dist/rspack-provider/config/validate/source.js +0 -31
- package/dist/rspack-provider/config/validate/tools.d.ts +0 -3
- package/dist/rspack-provider/config/validate/tools.js +0 -35
- package/dist/rspack-provider/plugins/manifest.d.ts +0 -2
- package/dist/rspack-provider/plugins/manifest.js +0 -58
- package/dist/rspack-provider/plugins/pug.d.ts +0 -2
- package/dist/rspack-provider/plugins/pug.js +0 -67
- package/dist/rspack-provider/types/config/dev.d.ts +0 -3
- package/dist/rspack-provider/types/config/dev.js +0 -16
- package/dist/rspack-provider/types/config/html.d.ts +0 -3
- package/dist/rspack-provider/types/config/html.js +0 -16
- package/dist/rspack-provider/types/config/index.d.ts +0 -34
- package/dist/rspack-provider/types/config/index.js +0 -34
- package/dist/rspack-provider/types/config/output.d.ts +0 -9
- package/dist/rspack-provider/types/config/output.js +0 -16
- package/dist/rspack-provider/types/config/performance.d.ts +0 -3
- package/dist/rspack-provider/types/config/performance.js +0 -16
- package/dist/rspack-provider/types/config/security.d.ts +0 -3
- package/dist/rspack-provider/types/config/security.js +0 -16
- package/dist/rspack-provider/types/config/source.d.ts +0 -11
- package/dist/rspack-provider/types/config/source.js +0 -16
- package/dist/rspack-provider/types/config/tools.d.ts +0 -21
- package/dist/rspack-provider/types/config/tools.js +0 -16
- package/dist/rspack-provider/types/rspack.d.ts +0 -107
- package/dist/rspack-provider/types/rspack.js +0 -16
|
@@ -34,8 +34,8 @@ __export(startDevServer_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(startDevServer_exports);
|
|
35
35
|
var import_shared = require("@rsbuild/shared");
|
|
36
36
|
var import_createCompiler = require("./createCompiler");
|
|
37
|
-
var import_initConfigs = require("./initConfigs");
|
|
38
37
|
var import_devMiddleware = require("./devMiddleware");
|
|
38
|
+
var import_initConfigs = require("./initConfigs");
|
|
39
39
|
async function createDevServer(options, port, serverOptions, customCompiler) {
|
|
40
40
|
const { Server } = await Promise.resolve().then(() => __toESM(require("@modern-js/server")));
|
|
41
41
|
let compiler;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { getRspackVersion } from './shared/rspackVersion';
|
|
2
2
|
export { rspackProvider } from './provider';
|
|
3
3
|
export type { RspackProvider } from './provider';
|
|
4
|
-
export type { RsbuildConfig, NormalizedConfig, ModifyRspackConfigFn, RsbuildPluginAPI
|
|
4
|
+
export type { RsbuildConfig, NormalizedConfig, ModifyRspackConfigFn, RsbuildPluginAPI } from './types';
|
|
5
|
+
export type { Rspack, RspackConfig } from '@rsbuild/shared';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type BundlerChain, type Context, type ModifyBundlerChainUtils } from '@rsbuild/shared';
|
|
2
|
-
import type { RsbuildPlugin, NormalizedConfig
|
|
1
|
+
import { type BundlerChain, type Context, type RspackRule, type ModifyBundlerChainUtils } from '@rsbuild/shared';
|
|
2
|
+
import type { RsbuildPlugin, NormalizedConfig } from '../types';
|
|
3
3
|
export declare const enableNativeCss: (config: NormalizedConfig) => boolean;
|
|
4
4
|
export declare function applyBaseCSSRule({
|
|
5
5
|
rule,
|
|
@@ -34,8 +34,8 @@ __export(css_exports, {
|
|
|
34
34
|
pluginCss: () => pluginCss
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(css_exports);
|
|
37
|
-
var import_shared = require("@rsbuild/shared");
|
|
38
37
|
var import_path = __toESM(require("path"));
|
|
38
|
+
var import_shared = require("@rsbuild/shared");
|
|
39
39
|
var import_shared2 = require("../shared");
|
|
40
40
|
const enableNativeCss = (config) => !config.output.disableCssExtract;
|
|
41
41
|
async function applyBaseCSSRule({
|
|
@@ -185,7 +185,7 @@ const pluginCss = () => {
|
|
|
185
185
|
(0, import_shared.setConfig)(rspackConfig, "experiments.css", false);
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
|
-
let localIdentName = config.output.cssModules.localIdentName ||
|
|
188
|
+
let localIdentName = config.output.cssModules.localIdentName || // Using shorter classname in production to reduce bundle size
|
|
189
189
|
(isProd ? "[local]-[hash:6]" : "[path][name]__[local]-[hash:6]");
|
|
190
190
|
if (localIdentName.includes(":base64")) {
|
|
191
191
|
import_shared.logger.warn(
|
|
@@ -41,8 +41,6 @@ const pluginFallback = () => ({
|
|
|
41
41
|
(0, import_shared.setConfig)(
|
|
42
42
|
config,
|
|
43
43
|
"module.rules",
|
|
44
|
-
// Rspack RuleSetRule is not exactly aligned with webpack. But it doesn't matter in resourceRuleFallback.
|
|
45
|
-
// @ts-expect-error
|
|
46
44
|
(0, import_shared.resourceRuleFallback)((_a = config.module) == null ? void 0 : _a.rules)
|
|
47
45
|
);
|
|
48
46
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BundlerChain } from '@rsbuild/shared';
|
|
1
|
+
import { type BundlerChain } from '@rsbuild/shared';
|
|
2
2
|
import type { RsbuildPlugin, NormalizedConfig } from '../types';
|
|
3
|
-
export declare function applyJSMinimizer(chain: BundlerChain, config: NormalizedConfig):
|
|
3
|
+
export declare function applyJSMinimizer(chain: BundlerChain, config: NormalizedConfig): void;
|
|
4
|
+
export declare function applyCSSMinimizer(chain: BundlerChain): void;
|
|
4
5
|
export declare const pluginMinimize: () => RsbuildPlugin;
|
|
@@ -18,13 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var minimize_exports = {};
|
|
20
20
|
__export(minimize_exports, {
|
|
21
|
+
applyCSSMinimizer: () => applyCSSMinimizer,
|
|
21
22
|
applyJSMinimizer: () => applyJSMinimizer,
|
|
22
23
|
pluginMinimize: () => pluginMinimize
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(minimize_exports);
|
|
25
26
|
var import_shared = require("@rsbuild/shared");
|
|
26
27
|
var import_core = require("@rspack/core");
|
|
27
|
-
|
|
28
|
+
function applyJSMinimizer(chain, config) {
|
|
28
29
|
const options = {};
|
|
29
30
|
const { removeConsole } = config.performance;
|
|
30
31
|
if (removeConsole === true) {
|
|
@@ -51,22 +52,26 @@ async function applyJSMinimizer(chain, config) {
|
|
|
51
52
|
options.asciiOnly = config.output.charset === "ascii";
|
|
52
53
|
chain.optimization.minimizer(import_shared.CHAIN_ID.MINIMIZER.JS).use(import_core.SwcJsMinimizerRspackPlugin, [options]).end();
|
|
53
54
|
}
|
|
55
|
+
function applyCSSMinimizer(chain) {
|
|
56
|
+
chain.optimization.minimizer(import_shared.CHAIN_ID.MINIMIZER.CSS).use(import_core.SwcCssMinimizerRspackPlugin, []).end();
|
|
57
|
+
}
|
|
54
58
|
const pluginMinimize = () => ({
|
|
55
59
|
name: "plugin-minimize",
|
|
56
60
|
setup(api) {
|
|
57
|
-
api.modifyBundlerChain(
|
|
61
|
+
api.modifyBundlerChain((chain, { isProd }) => {
|
|
58
62
|
const config = api.getNormalizedConfig();
|
|
59
63
|
const isMinimize = isProd && !config.output.disableMinimize;
|
|
60
64
|
chain.optimization.minimize(isMinimize);
|
|
61
65
|
if (isMinimize) {
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
applyJSMinimizer(chain, config);
|
|
67
|
+
applyCSSMinimizer(chain);
|
|
64
68
|
}
|
|
65
69
|
});
|
|
66
70
|
}
|
|
67
71
|
});
|
|
68
72
|
// Annotate the CommonJS export names for ESM import in node:
|
|
69
73
|
0 && (module.exports = {
|
|
74
|
+
applyCSSMinimizer,
|
|
70
75
|
applyJSMinimizer,
|
|
71
76
|
pluginMinimize
|
|
72
77
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type RsbuildTarget } from '@rsbuild/shared';
|
|
2
|
-
import type { RsbuildPlugin, NormalizedConfig
|
|
1
|
+
import { type RsbuildTarget, type BuiltinSwcLoaderOptions } from '@rsbuild/shared';
|
|
2
|
+
import type { RsbuildPlugin, NormalizedConfig } from '../types';
|
|
3
3
|
export declare function getDefaultSwcConfig(config: NormalizedConfig, rootPath: string, target: RsbuildTarget): Promise<BuiltinSwcLoaderOptions>;
|
|
4
4
|
/**
|
|
5
5
|
* Provide some swc configs of rspack
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type RsbuildProvider } from '@rsbuild/shared';
|
|
2
|
-
import type {
|
|
3
|
-
export type RspackProvider = RsbuildProvider<RsbuildConfig, RspackConfig, NormalizedConfig,
|
|
1
|
+
import { type RsbuildProvider, type RspackConfig, type RspackCompiler, type RspackMultiCompiler } from '@rsbuild/shared';
|
|
2
|
+
import type { RsbuildConfig, NormalizedConfig } from './types';
|
|
3
|
+
export type RspackProvider = RsbuildProvider<RsbuildConfig, RspackConfig, NormalizedConfig, RspackCompiler | RspackMultiCompiler>;
|
|
4
4
|
export declare function rspackProvider({
|
|
5
5
|
rsbuildConfig: originalRsbuildConfig
|
|
6
6
|
}: {
|
|
@@ -32,7 +32,6 @@ __export(provider_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(provider_exports);
|
|
34
34
|
var import_shared = require("@rsbuild/shared");
|
|
35
|
-
var import_chalk = require("@rsbuild/shared/chalk");
|
|
36
35
|
var import_createContext = require("./core/createContext");
|
|
37
36
|
var import_initConfigs = require("./core/initConfigs");
|
|
38
37
|
var import_initPlugins = require("./core/initPlugins");
|
|
@@ -45,7 +44,7 @@ function rspackProvider({
|
|
|
45
44
|
return async ({ pluginStore, rsbuildOptions, plugins }) => {
|
|
46
45
|
if (!await (0, import_rspackVersion.isSatisfyRspackMinimumVersion)()) {
|
|
47
46
|
throw new Error(
|
|
48
|
-
`The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${
|
|
47
|
+
`The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${import_shared.color.green(
|
|
49
48
|
import_rspackVersion.supportedRspackMinimumVersion
|
|
50
49
|
)}`
|
|
51
50
|
);
|
|
@@ -52,14 +52,11 @@ const applyDefaultPlugins = (plugins) => (0, import_shared.awaitableGetter)([
|
|
|
52
52
|
plugins.wasm(),
|
|
53
53
|
plugins.moment(),
|
|
54
54
|
plugins.nodeAddons(),
|
|
55
|
-
// pug plugin should after html plugin
|
|
56
|
-
Promise.resolve().then(() => __toESM(require("../plugins/pug"))).then((m) => m.pluginPug()),
|
|
57
55
|
plugins.define(),
|
|
58
56
|
Promise.resolve().then(() => __toESM(require("../plugins/css"))).then((m) => m.pluginCss()),
|
|
59
57
|
Promise.resolve().then(() => __toESM(require("../plugins/less"))).then((m) => m.pluginLess()),
|
|
60
58
|
Promise.resolve().then(() => __toESM(require("../plugins/sass"))).then((m) => m.pluginSass()),
|
|
61
59
|
Promise.resolve().then(() => __toESM(require("../plugins/minimize"))).then((m) => m.pluginMinimize()),
|
|
62
|
-
Promise.resolve().then(() => __toESM(require("../plugins/manifest"))).then((m) => m.pluginManifest()),
|
|
63
60
|
plugins.rem(),
|
|
64
61
|
Promise.resolve().then(() => __toESM(require("../plugins/hmr"))).then((m) => m.pluginHMR()),
|
|
65
62
|
Promise.resolve().then(() => __toESM(require("../plugins/progress"))).then((m) => m.pluginProgress()),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Context as BaseContext } from '@rsbuild/shared';
|
|
1
|
+
import type { Context as BaseContext, RsbuildConfig, NormalizedConfig } from '@rsbuild/shared';
|
|
2
2
|
import type { Hooks } from '../core/initHooks';
|
|
3
|
-
import type { RsbuildConfig, NormalizedConfig } from './config';
|
|
4
3
|
import type { RsbuildPluginAPI } from './plugin';
|
|
5
4
|
/** The inner context. */
|
|
6
5
|
export type Context = BaseContext & {
|
|
@@ -8,8 +7,6 @@ export type Context = BaseContext & {
|
|
|
8
7
|
hooks: Readonly<Hooks>;
|
|
9
8
|
/** Current Rsbuild config. */
|
|
10
9
|
config: Readonly<RsbuildConfig>;
|
|
11
|
-
/** The async task to validate schema of config. */
|
|
12
|
-
configValidatingTask: Promise<void>;
|
|
13
10
|
/** The original Rsbuild config passed from the createRsbuild method. */
|
|
14
11
|
originalConfig: Readonly<RsbuildConfig>;
|
|
15
12
|
/** The normalized Rsbuild config. */
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { RspackConfig
|
|
3
|
-
export type ModifyRspackConfigUtils = ModifyChainUtils & {
|
|
4
|
-
addRules: (rules: RspackRule | RspackRule[]) => void;
|
|
5
|
-
prependPlugins: (plugins: RspackPluginInstance | RspackPluginInstance[]) => void;
|
|
6
|
-
appendPlugins: (plugins: RspackPluginInstance | RspackPluginInstance[]) => void;
|
|
7
|
-
removePlugin: (pluginName: string) => void;
|
|
8
|
-
mergeConfig: typeof import('@rsbuild/shared/webpack-merge').merge;
|
|
9
|
-
rspack: typeof import('@rspack/core');
|
|
10
|
-
};
|
|
1
|
+
import type { ModifyRspackConfigUtils } from '@rsbuild/shared';
|
|
2
|
+
import type { RspackConfig } from '@rsbuild/shared';
|
|
11
3
|
export type ModifyRspackConfigFn = (config: RspackConfig, utils: ModifyRspackConfigUtils) => Promise<RspackConfig | void> | RspackConfig | void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './hooks';
|
|
2
|
-
export * from './config';
|
|
3
2
|
export * from './plugin';
|
|
4
3
|
export * from './context';
|
|
5
|
-
export
|
|
4
|
+
export type { RsbuildConfig, NormalizedConfig, DevConfig, HtmlConfig, ToolsConfig, SourceConfig, OutputConfig, SecurityConfig, PerformanceConfig, NormalizedDevConfig, NormalizedHtmlConfig, NormalizedToolsConfig, NormalizedSourceConfig, NormalizedOutputConfig, NormalizedSecurityConfig, NormalizedPerformanceConfig } from '@rsbuild/shared';
|
|
@@ -16,15 +16,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
var types_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(types_exports);
|
|
18
18
|
__reExport(types_exports, require("./hooks"), module.exports);
|
|
19
|
-
__reExport(types_exports, require("./config"), module.exports);
|
|
20
19
|
__reExport(types_exports, require("./plugin"), module.exports);
|
|
21
20
|
__reExport(types_exports, require("./context"), module.exports);
|
|
22
|
-
__reExport(types_exports, require("./rspack"), module.exports);
|
|
23
21
|
// Annotate the CommonJS export names for ESM import in node:
|
|
24
22
|
0 && (module.exports = {
|
|
25
23
|
...require("./hooks"),
|
|
26
|
-
...require("./config"),
|
|
27
24
|
...require("./plugin"),
|
|
28
|
-
...require("./context")
|
|
29
|
-
...require("./rspack")
|
|
25
|
+
...require("./context")
|
|
30
26
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { DefaultRsbuildPluginAPI, RsbuildPlugin as BaseRsbuildPlugin } from '@rsbuild/shared';
|
|
2
|
-
import type { RsbuildConfig, NormalizedConfig } from './config';
|
|
1
|
+
import type { RsbuildConfig, NormalizedConfig, DefaultRsbuildPluginAPI, RsbuildPlugin as BaseRsbuildPlugin } from '@rsbuild/shared';
|
|
3
2
|
import type { ModifyRspackConfigFn } from './hooks';
|
|
4
|
-
import type {
|
|
5
|
-
export interface RsbuildPluginAPI extends DefaultRsbuildPluginAPI<RsbuildConfig, NormalizedConfig, RspackConfig,
|
|
3
|
+
import type { RspackConfig, RspackCompiler, RspackMultiCompiler } from '@rsbuild/shared';
|
|
4
|
+
export interface RsbuildPluginAPI extends DefaultRsbuildPluginAPI<RsbuildConfig, NormalizedConfig, RspackConfig, RspackCompiler | RspackMultiCompiler> {
|
|
6
5
|
modifyRspackConfig: (fn: ModifyRspackConfigFn) => void;
|
|
7
6
|
}
|
|
8
7
|
export type RsbuildPlugin = BaseRsbuildPlugin<RsbuildPluginAPI>;
|
|
@@ -8,4 +8,5 @@
|
|
|
8
8
|
* Modified from https://github.com/jantimon/html-webpack-plugin/blob/2f5de7ab9e8bca60e9e200f2e4b4cfab90db28d4/index.js#L800
|
|
9
9
|
*/
|
|
10
10
|
import type { MetaOptions } from '@rsbuild/shared';
|
|
11
|
-
|
|
11
|
+
import type { HtmlTagObject } from 'html-webpack-plugin';
|
|
12
|
+
export declare const generateMetaTags: (metaOptions?: MetaOptions) => HtmlTagObject[];
|
|
@@ -21,20 +21,9 @@ __export(generateMetaTags_exports, {
|
|
|
21
21
|
generateMetaTags: () => generateMetaTags
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(generateMetaTags_exports);
|
|
24
|
-
const tagObjectToString = (tagDefinition) => {
|
|
25
|
-
const attributes = Object.keys(tagDefinition.attributes || {}).filter(
|
|
26
|
-
(attributeName) => tagDefinition.attributes[attributeName] !== false
|
|
27
|
-
).map((attributeName) => {
|
|
28
|
-
if (tagDefinition.attributes[attributeName] === true) {
|
|
29
|
-
return attributeName;
|
|
30
|
-
}
|
|
31
|
-
return `${attributeName}="${tagDefinition.attributes[attributeName]}"`;
|
|
32
|
-
});
|
|
33
|
-
return `<${[tagDefinition.tagName].concat(attributes).join(" ")}>${tagDefinition.innerHTML || ""}${tagDefinition.voidTag ? "" : `</${tagDefinition.tagName}>`}`;
|
|
34
|
-
};
|
|
35
24
|
const generateMetaTags = (metaOptions) => {
|
|
36
25
|
if (!metaOptions) {
|
|
37
|
-
return
|
|
26
|
+
return [];
|
|
38
27
|
}
|
|
39
28
|
const metaTagAttributeObjects = Object.keys(metaOptions).map((metaName) => {
|
|
40
29
|
const metaTagContent = metaOptions[metaName];
|
|
@@ -50,13 +39,10 @@ const generateMetaTags = (metaOptions) => {
|
|
|
50
39
|
return {
|
|
51
40
|
tagName: "meta",
|
|
52
41
|
voidTag: true,
|
|
53
|
-
attributes: metaTagAttributes
|
|
42
|
+
attributes: metaTagAttributes,
|
|
43
|
+
meta: {}
|
|
54
44
|
};
|
|
55
|
-
})
|
|
56
|
-
(memo, tagObject) => `${memo}
|
|
57
|
-
${tagObjectToString(tagObject)}`,
|
|
58
|
-
""
|
|
59
|
-
);
|
|
45
|
+
});
|
|
60
46
|
};
|
|
61
47
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
48
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Unleash the power of Rspack with the out-of-the-box build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -57,24 +57,24 @@
|
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
59
|
"bin",
|
|
60
|
-
"dist"
|
|
60
|
+
"dist",
|
|
61
|
+
"static"
|
|
61
62
|
],
|
|
62
63
|
"dependencies": {
|
|
63
|
-
"@modern-js/server": "
|
|
64
|
-
"@rspack/core": "0.3.
|
|
65
|
-
"@rspack/plugin-html": "0.3.8",
|
|
64
|
+
"@modern-js/server": "0.0.0-next-20231103131234",
|
|
65
|
+
"@rspack/core": "0.3.10",
|
|
66
66
|
"commander": "^10.0.1",
|
|
67
|
+
"core-js": "~3.32.2",
|
|
67
68
|
"filesize": "^8.0.7",
|
|
68
69
|
"gzip-size": "^6.0.0",
|
|
70
|
+
"html-webpack-plugin": "5.5.3",
|
|
69
71
|
"jiti": "^1.20.0",
|
|
70
72
|
"lodash": "^4.17.21",
|
|
71
73
|
"open": "^8.4.0",
|
|
72
74
|
"pkg-up": "^3.1.0",
|
|
73
75
|
"postcss": "8.4.31",
|
|
74
|
-
"rspack-manifest-plugin": "5.0.0-alpha0",
|
|
75
76
|
"semver": "^7.5.4",
|
|
76
|
-
"
|
|
77
|
-
"@rsbuild/shared": "0.0.12"
|
|
77
|
+
"@rsbuild/shared": "0.0.14"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/lodash": "^4.14.200",
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
(*
|
|
2
|
+
Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
|
|
4
|
+
This source code is licensed under the MIT license found in the
|
|
5
|
+
LICENSE file at
|
|
6
|
+
https://github.com/facebookincubator/create-react-app/blob/master/LICENSE
|
|
7
|
+
*)
|
|
8
|
+
|
|
9
|
+
property targetTab: null
|
|
10
|
+
property targetTabIndex: -1
|
|
11
|
+
property targetWindow: null
|
|
12
|
+
property theProgram: "Google Chrome"
|
|
13
|
+
|
|
14
|
+
on run argv
|
|
15
|
+
set theURL to item 1 of argv
|
|
16
|
+
|
|
17
|
+
-- Allow requested program to be optional,
|
|
18
|
+
-- default to Google Chrome
|
|
19
|
+
if (count of argv) > 1 then
|
|
20
|
+
set theProgram to item 2 of argv
|
|
21
|
+
end if
|
|
22
|
+
|
|
23
|
+
using terms from application "Google Chrome"
|
|
24
|
+
tell application theProgram
|
|
25
|
+
|
|
26
|
+
if (count every window) = 0 then
|
|
27
|
+
make new window
|
|
28
|
+
end if
|
|
29
|
+
|
|
30
|
+
-- 1: Looking for tab running debugger
|
|
31
|
+
-- then, Reload debugging tab if found
|
|
32
|
+
-- then return
|
|
33
|
+
set found to my lookupTabWithUrl(theURL)
|
|
34
|
+
if found then
|
|
35
|
+
set targetWindow's active tab index to targetTabIndex
|
|
36
|
+
tell targetTab to reload
|
|
37
|
+
tell targetWindow to activate
|
|
38
|
+
set index of targetWindow to 1
|
|
39
|
+
return
|
|
40
|
+
end if
|
|
41
|
+
|
|
42
|
+
-- 2: Looking for Empty tab
|
|
43
|
+
-- In case debugging tab was not found
|
|
44
|
+
-- We try to find an empty tab instead
|
|
45
|
+
set found to my lookupTabWithUrl("chrome://newtab/")
|
|
46
|
+
if found then
|
|
47
|
+
set targetWindow's active tab index to targetTabIndex
|
|
48
|
+
set URL of targetTab to theURL
|
|
49
|
+
tell targetWindow to activate
|
|
50
|
+
return
|
|
51
|
+
end if
|
|
52
|
+
|
|
53
|
+
-- 3: Create new tab
|
|
54
|
+
-- both debugging and empty tab were not found
|
|
55
|
+
-- make a new tab with url
|
|
56
|
+
tell window 1
|
|
57
|
+
activate
|
|
58
|
+
make new tab with properties {URL:theURL}
|
|
59
|
+
end tell
|
|
60
|
+
end tell
|
|
61
|
+
end using terms from
|
|
62
|
+
end run
|
|
63
|
+
|
|
64
|
+
-- Function:
|
|
65
|
+
-- Lookup tab with given url
|
|
66
|
+
-- if found, store tab, index, and window in properties
|
|
67
|
+
-- (properties were declared on top of file)
|
|
68
|
+
on lookupTabWithUrl(lookupUrl)
|
|
69
|
+
using terms from application "Google Chrome"
|
|
70
|
+
tell application theProgram
|
|
71
|
+
-- Find a tab with the given url
|
|
72
|
+
set found to false
|
|
73
|
+
set theTabIndex to -1
|
|
74
|
+
repeat with theWindow in every window
|
|
75
|
+
set theTabIndex to 0
|
|
76
|
+
repeat with theTab in every tab of theWindow
|
|
77
|
+
set theTabIndex to theTabIndex + 1
|
|
78
|
+
if (theTab's URL as string) contains lookupUrl then
|
|
79
|
+
-- assign tab, tab index, and window to properties
|
|
80
|
+
set targetTab to theTab
|
|
81
|
+
set targetTabIndex to theTabIndex
|
|
82
|
+
set targetWindow to theWindow
|
|
83
|
+
set found to true
|
|
84
|
+
exit repeat
|
|
85
|
+
end if
|
|
86
|
+
end repeat
|
|
87
|
+
|
|
88
|
+
if found then
|
|
89
|
+
exit repeat
|
|
90
|
+
end if
|
|
91
|
+
end repeat
|
|
92
|
+
end tell
|
|
93
|
+
end using terms from
|
|
94
|
+
return found
|
|
95
|
+
end lookupTabWithUrl
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/plugins/svg.d.ts
DELETED
package/dist/plugins/svg.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
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 svg_exports = {};
|
|
30
|
-
__export(svg_exports, {
|
|
31
|
-
pluginSvg: () => pluginSvg
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(svg_exports);
|
|
34
|
-
var import_path = __toESM(require("path"));
|
|
35
|
-
var import_shared = require("@rsbuild/shared");
|
|
36
|
-
const pluginSvg = () => {
|
|
37
|
-
return {
|
|
38
|
-
name: "plugin-svg",
|
|
39
|
-
setup(api) {
|
|
40
|
-
api.modifyBundlerChain(async (chain, { isProd, CHAIN_ID }) => {
|
|
41
|
-
const config = api.getNormalizedConfig();
|
|
42
|
-
const assetType = "svg";
|
|
43
|
-
const distDir = (0, import_shared.getDistPath)(config.output, "svg");
|
|
44
|
-
const filename = (0, import_shared.getFilename)(config.output, "svg", isProd);
|
|
45
|
-
const maxSize = config.output.dataUriLimit[assetType];
|
|
46
|
-
const rule = chain.module.rule(CHAIN_ID.RULE.SVG).test(import_shared.SVG_REGEX);
|
|
47
|
-
(0, import_shared.chainStaticAssetRule)({
|
|
48
|
-
rule,
|
|
49
|
-
maxSize,
|
|
50
|
-
filename: import_path.default.posix.join(distDir, filename),
|
|
51
|
-
assetType
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
-
0 && (module.exports = {
|
|
59
|
-
pluginSvg
|
|
60
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
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 dev_exports = {};
|
|
20
|
-
__export(dev_exports, {
|
|
21
|
-
devConfigSchema: () => devConfigSchema
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(dev_exports);
|
|
24
|
-
var import_shared = require("@rsbuild/shared");
|
|
25
|
-
const devConfigSchema = import_shared.sharedDevConfigSchema;
|
|
26
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
-
0 && (module.exports = {
|
|
28
|
-
devConfigSchema
|
|
29
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
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 html_exports = {};
|
|
20
|
-
__export(html_exports, {
|
|
21
|
-
htmlConfigSchema: () => htmlConfigSchema
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(html_exports);
|
|
24
|
-
var import_shared = require("@rsbuild/shared");
|
|
25
|
-
const htmlConfigSchema = import_shared.sharedHtmlConfigSchema;
|
|
26
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
-
0 && (module.exports = {
|
|
28
|
-
htmlConfigSchema
|
|
29
|
-
});
|
|
@@ -1,50 +0,0 @@
|
|
|
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 validate_exports = {};
|
|
20
|
-
__export(validate_exports, {
|
|
21
|
-
configSchema: () => configSchema,
|
|
22
|
-
validateRsbuildConfig: () => validateRsbuildConfig
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(validate_exports);
|
|
25
|
-
var import_zod = require("@rsbuild/shared/zod");
|
|
26
|
-
var import_shared = require("@rsbuild/shared");
|
|
27
|
-
var import_dev = require("./dev");
|
|
28
|
-
var import_html = require("./html");
|
|
29
|
-
var import_output = require("./output");
|
|
30
|
-
var import_performance = require("./performance");
|
|
31
|
-
var import_source = require("./source");
|
|
32
|
-
var import_tools = require("./tools");
|
|
33
|
-
var import_security = require("./security");
|
|
34
|
-
const configSchema = import_zod.z.partialObj({
|
|
35
|
-
source: import_source.sourceConfigSchema,
|
|
36
|
-
dev: import_dev.devConfigSchema,
|
|
37
|
-
html: import_html.htmlConfigSchema,
|
|
38
|
-
output: import_output.outputConfigSchema,
|
|
39
|
-
security: import_security.securityConfigSchema,
|
|
40
|
-
performance: import_performance.performanceConfigSchema,
|
|
41
|
-
tools: import_tools.toolsConfigSchema
|
|
42
|
-
});
|
|
43
|
-
const validateRsbuildConfig = async (data) => {
|
|
44
|
-
return (0, import_shared.validateRsbuildConfig)(configSchema, data);
|
|
45
|
-
};
|
|
46
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
-
0 && (module.exports = {
|
|
48
|
-
configSchema,
|
|
49
|
-
validateRsbuildConfig
|
|
50
|
-
});
|