@rsbuild/plugin-styled-components 0.6.14 → 0.7.0-beta.0
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/index.cjs +62 -0
- package/dist/index.d.ts +4 -7
- package/dist/index.js +19 -31
- package/package.json +8 -8
- package/dist/index.mjs +0 -50
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
pluginStyledComponents: () => pluginStyledComponents
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
var import_shared = require("@rsbuild/shared");
|
|
27
|
+
var pluginStyledComponents = (pluginOptions = {}) => ({
|
|
28
|
+
name: "rsbuild:styled-components",
|
|
29
|
+
setup(api) {
|
|
30
|
+
if (api.context.bundlerType === "webpack") {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const getMergedOptions = () => {
|
|
34
|
+
const useSSR = (0, import_shared.isServerTarget)(api.context.targets);
|
|
35
|
+
const isProd = (0, import_shared.getNodeEnv)() === "production";
|
|
36
|
+
return (0, import_shared.mergeChainedOptions)({
|
|
37
|
+
defaults: (0, import_shared.getDefaultStyledComponentsConfig)(isProd, useSSR),
|
|
38
|
+
options: pluginOptions
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
api.modifyRsbuildConfig((userConfig, { mergeRsbuildConfig }) => {
|
|
42
|
+
const extraConfig = {
|
|
43
|
+
tools: {
|
|
44
|
+
swc(opts) {
|
|
45
|
+
const mergedOptions = getMergedOptions();
|
|
46
|
+
if (!mergedOptions) {
|
|
47
|
+
return opts;
|
|
48
|
+
}
|
|
49
|
+
opts.rspackExperiments ?? (opts.rspackExperiments = {});
|
|
50
|
+
opts.rspackExperiments.styledComponents = mergedOptions;
|
|
51
|
+
return opts;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return mergeRsbuildConfig(extraConfig, userConfig);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
pluginStyledComponents
|
|
62
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
import { ChainedConfig } from '@rsbuild/shared';
|
|
3
|
-
|
|
1
|
+
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
import { type ChainedConfig } from '@rsbuild/shared';
|
|
4
3
|
/**
|
|
5
4
|
* the options of [rspackExperiments.styledComponents](https://rspack.dev/guide/features/builtin-swc-loader#rspackexperimentsstyledcomponents).
|
|
6
5
|
*/
|
|
7
|
-
type PluginStyledComponentsOptions = {
|
|
6
|
+
export type PluginStyledComponentsOptions = {
|
|
8
7
|
displayName?: boolean;
|
|
9
8
|
ssr?: boolean;
|
|
10
9
|
fileName?: boolean;
|
|
@@ -16,6 +15,4 @@ type PluginStyledComponentsOptions = {
|
|
|
16
15
|
pure?: boolean;
|
|
17
16
|
cssProps?: boolean;
|
|
18
17
|
};
|
|
19
|
-
declare const pluginStyledComponents: (pluginOptions?: ChainedConfig<PluginStyledComponentsOptions>) => RsbuildPlugin;
|
|
20
|
-
|
|
21
|
-
export { type PluginStyledComponentsOptions, pluginStyledComponents };
|
|
18
|
+
export declare const pluginStyledComponents: (pluginOptions?: ChainedConfig<PluginStyledComponentsOptions>) => RsbuildPlugin;
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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);
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
var require = createRequire(import.meta['url']);
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
// ../../node_modules/.pnpm/@modern-js+module-tools@2.49.3_eslint@8.57.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import path from "path";
|
|
19
8
|
|
|
20
9
|
// src/index.ts
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
import {
|
|
11
|
+
getDefaultStyledComponentsConfig,
|
|
12
|
+
getNodeEnv,
|
|
13
|
+
isServerTarget,
|
|
14
|
+
mergeChainedOptions
|
|
15
|
+
} from "@rsbuild/shared";
|
|
27
16
|
var pluginStyledComponents = (pluginOptions = {}) => ({
|
|
28
17
|
name: "rsbuild:styled-components",
|
|
29
18
|
setup(api) {
|
|
@@ -31,10 +20,10 @@ var pluginStyledComponents = (pluginOptions = {}) => ({
|
|
|
31
20
|
return;
|
|
32
21
|
}
|
|
33
22
|
const getMergedOptions = () => {
|
|
34
|
-
const useSSR =
|
|
35
|
-
const isProd =
|
|
36
|
-
return
|
|
37
|
-
defaults:
|
|
23
|
+
const useSSR = isServerTarget(api.context.targets);
|
|
24
|
+
const isProd = getNodeEnv() === "production";
|
|
25
|
+
return mergeChainedOptions({
|
|
26
|
+
defaults: getDefaultStyledComponentsConfig(isProd, useSSR),
|
|
38
27
|
options: pluginOptions
|
|
39
28
|
});
|
|
40
29
|
};
|
|
@@ -56,7 +45,6 @@ var pluginStyledComponents = (pluginOptions = {}) => ({
|
|
|
56
45
|
});
|
|
57
46
|
}
|
|
58
47
|
});
|
|
59
|
-
|
|
60
|
-
0 && (module.exports = {
|
|
48
|
+
export {
|
|
61
49
|
pluginStyledComponents
|
|
62
|
-
}
|
|
50
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-styled-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-beta.0",
|
|
4
4
|
"description": "styled-components plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,29 +8,29 @@
|
|
|
8
8
|
"directory": "packages/plugin-styled-components"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"type": "
|
|
11
|
+
"type": "module",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
|
-
"import": "./dist/index.
|
|
16
|
-
"
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
-
"main": "./dist/index.
|
|
19
|
+
"main": "./dist/index.cjs",
|
|
20
20
|
"types": "./dist/index.d.ts",
|
|
21
21
|
"files": [
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@rsbuild/shared": "0.
|
|
25
|
+
"@rsbuild/shared": "0.7.0-beta.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "18.x",
|
|
29
29
|
"typescript": "^5.4.2",
|
|
30
|
-
"@rsbuild/core": "0.
|
|
30
|
+
"@rsbuild/core": "0.7.0-beta.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@rsbuild/core": "^0.
|
|
33
|
+
"@rsbuild/core": "^0.7.0-beta.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public",
|
package/dist/index.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module';
|
|
2
|
-
var require = createRequire(import.meta['url']);
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// ../../node_modules/.pnpm/@modern-js+module-tools@2.49.2_eslint@8.57.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
|
|
6
|
-
import { fileURLToPath } from "url";
|
|
7
|
-
import path from "path";
|
|
8
|
-
|
|
9
|
-
// src/index.ts
|
|
10
|
-
import {
|
|
11
|
-
getDefaultStyledComponentsConfig,
|
|
12
|
-
getNodeEnv,
|
|
13
|
-
isServerTarget,
|
|
14
|
-
mergeChainedOptions
|
|
15
|
-
} from "@rsbuild/shared";
|
|
16
|
-
var pluginStyledComponents = (pluginOptions = {}) => ({
|
|
17
|
-
name: "rsbuild:styled-components",
|
|
18
|
-
setup(api) {
|
|
19
|
-
if (api.context.bundlerType === "webpack") {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const getMergedOptions = () => {
|
|
23
|
-
const useSSR = isServerTarget(api.context.targets);
|
|
24
|
-
const isProd = getNodeEnv() === "production";
|
|
25
|
-
return mergeChainedOptions({
|
|
26
|
-
defaults: getDefaultStyledComponentsConfig(isProd, useSSR),
|
|
27
|
-
options: pluginOptions
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
api.modifyRsbuildConfig((userConfig, { mergeRsbuildConfig }) => {
|
|
31
|
-
const extraConfig = {
|
|
32
|
-
tools: {
|
|
33
|
-
swc(opts) {
|
|
34
|
-
const mergedOptions = getMergedOptions();
|
|
35
|
-
if (!mergedOptions) {
|
|
36
|
-
return opts;
|
|
37
|
-
}
|
|
38
|
-
opts.rspackExperiments ?? (opts.rspackExperiments = {});
|
|
39
|
-
opts.rspackExperiments.styledComponents = mergedOptions;
|
|
40
|
-
return opts;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
return mergeRsbuildConfig(extraConfig, userConfig);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
export {
|
|
49
|
-
pluginStyledComponents
|
|
50
|
-
};
|