@modern-js/plugin-styled-components 3.0.4 → 3.1.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/cjs/index.js +6 -3
- package/dist/cjs/styled.js +7 -2
- package/dist/esm/index.mjs +6 -3
- package/dist/esm/styled.mjs +9 -3
- package/dist/esm-node/index.mjs +6 -3
- package/dist/esm-node/styled.mjs +9 -3
- package/dist/types/styled.d.ts +2 -1
- package/package.json +4 -9
- package/src/index.ts +5 -1
- package/src/styled.ts +19 -2
package/dist/cjs/index.js
CHANGED
|
@@ -31,12 +31,14 @@ const plugin_styled_components_namespaceObject = require("@rsbuild/plugin-styled
|
|
|
31
31
|
const styledComponentsPlugin = (options)=>({
|
|
32
32
|
name: '@modern-js/plugin-styled-components',
|
|
33
33
|
setup (api) {
|
|
34
|
-
api.config(()=>
|
|
34
|
+
api.config(()=>{
|
|
35
|
+
const { metaName } = api.getAppContext();
|
|
36
|
+
return {
|
|
35
37
|
builderPlugins: [
|
|
36
38
|
(0, plugin_styled_components_namespaceObject.pluginStyledComponents)({
|
|
37
39
|
...options,
|
|
38
40
|
topLevelImportPaths: [
|
|
39
|
-
|
|
41
|
+
`@${metaName}/plugin-styled-components/styled`
|
|
40
42
|
]
|
|
41
43
|
})
|
|
42
44
|
],
|
|
@@ -45,7 +47,8 @@ const styledComponentsPlugin = (options)=>({
|
|
|
45
47
|
'styled-components': require.resolve('styled-components')
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
}
|
|
50
|
+
};
|
|
51
|
+
});
|
|
49
52
|
api._internalRuntimePlugins(async ({ entrypoint, plugins })=>{
|
|
50
53
|
const { metaName } = api.getAppContext();
|
|
51
54
|
plugins.push({
|
package/dist/cjs/styled.js
CHANGED
|
@@ -51,11 +51,16 @@ var __webpack_exports__ = {};
|
|
|
51
51
|
default: ()=>__rspack_default_export
|
|
52
52
|
});
|
|
53
53
|
var styled_components__rspack_import_0 = __webpack_require__("styled-components");
|
|
54
|
-
var styled_components__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(styled_components__rspack_import_0);
|
|
55
54
|
var __rspack_reexport = {};
|
|
56
55
|
for(const __rspack_import_key in styled_components__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>styled_components__rspack_import_0[__rspack_import_key];
|
|
57
56
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
58
|
-
|
|
57
|
+
function resolveStyledComponents() {
|
|
58
|
+
const moduleExports = styled_components__rspack_import_0;
|
|
59
|
+
if (moduleExports.default?.default !== void 0) return moduleExports.default.default;
|
|
60
|
+
return moduleExports.default ?? moduleExports;
|
|
61
|
+
}
|
|
62
|
+
const styled = resolveStyledComponents();
|
|
63
|
+
const __rspack_default_export = styled;
|
|
59
64
|
})();
|
|
60
65
|
exports["default"] = __webpack_exports__["default"];
|
|
61
66
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2,12 +2,14 @@ import { pluginStyledComponents } from "@rsbuild/plugin-styled-components";
|
|
|
2
2
|
const styledComponentsPlugin = (options)=>({
|
|
3
3
|
name: '@modern-js/plugin-styled-components',
|
|
4
4
|
setup (api) {
|
|
5
|
-
api.config(()=>
|
|
5
|
+
api.config(()=>{
|
|
6
|
+
const { metaName } = api.getAppContext();
|
|
7
|
+
return {
|
|
6
8
|
builderPlugins: [
|
|
7
9
|
pluginStyledComponents({
|
|
8
10
|
...options,
|
|
9
11
|
topLevelImportPaths: [
|
|
10
|
-
|
|
12
|
+
`@${metaName}/plugin-styled-components/styled`
|
|
11
13
|
]
|
|
12
14
|
})
|
|
13
15
|
],
|
|
@@ -16,7 +18,8 @@ const styledComponentsPlugin = (options)=>({
|
|
|
16
18
|
'styled-components': require.resolve('styled-components')
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
|
-
}
|
|
21
|
+
};
|
|
22
|
+
});
|
|
20
23
|
api._internalRuntimePlugins(async ({ entrypoint, plugins })=>{
|
|
21
24
|
const { metaName } = api.getAppContext();
|
|
22
25
|
plugins.push({
|
package/dist/esm/styled.mjs
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import styled_components from "styled-components";
|
|
2
1
|
export * from "styled-components";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import * as __rspack_external_styled_components_326b429a from "styled-components";
|
|
3
|
+
function resolveStyledComponents() {
|
|
4
|
+
const moduleExports = __rspack_external_styled_components_326b429a;
|
|
5
|
+
if (moduleExports.default?.default !== void 0) return moduleExports.default.default;
|
|
6
|
+
return moduleExports.default ?? moduleExports;
|
|
7
|
+
}
|
|
8
|
+
const styled = resolveStyledComponents();
|
|
9
|
+
const src_styled = styled;
|
|
10
|
+
export { src_styled as default };
|
package/dist/esm-node/index.mjs
CHANGED
|
@@ -4,12 +4,14 @@ import { pluginStyledComponents } from "@rsbuild/plugin-styled-components";
|
|
|
4
4
|
const styledComponentsPlugin = (options)=>({
|
|
5
5
|
name: '@modern-js/plugin-styled-components',
|
|
6
6
|
setup (api) {
|
|
7
|
-
api.config(()=>
|
|
7
|
+
api.config(()=>{
|
|
8
|
+
const { metaName } = api.getAppContext();
|
|
9
|
+
return {
|
|
8
10
|
builderPlugins: [
|
|
9
11
|
pluginStyledComponents({
|
|
10
12
|
...options,
|
|
11
13
|
topLevelImportPaths: [
|
|
12
|
-
|
|
14
|
+
`@${metaName}/plugin-styled-components/styled`
|
|
13
15
|
]
|
|
14
16
|
})
|
|
15
17
|
],
|
|
@@ -18,7 +20,8 @@ const styledComponentsPlugin = (options)=>({
|
|
|
18
20
|
'styled-components': require.resolve('styled-components')
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
|
-
}
|
|
23
|
+
};
|
|
24
|
+
});
|
|
22
25
|
api._internalRuntimePlugins(async ({ entrypoint, plugins })=>{
|
|
23
26
|
const { metaName } = api.getAppContext();
|
|
24
27
|
plugins.push({
|
package/dist/esm-node/styled.mjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import styled_components from "styled-components";
|
|
3
2
|
export * from "styled-components";
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import * as __rspack_external_styled_components_326b429a from "styled-components";
|
|
4
|
+
function resolveStyledComponents() {
|
|
5
|
+
const moduleExports = __rspack_external_styled_components_326b429a;
|
|
6
|
+
if (moduleExports.default?.default !== void 0) return moduleExports.default.default;
|
|
7
|
+
return moduleExports.default ?? moduleExports;
|
|
8
|
+
}
|
|
9
|
+
const styled = resolveStyledComponents();
|
|
10
|
+
const src_styled = styled;
|
|
11
|
+
export { src_styled as default };
|
package/dist/types/styled.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"modern",
|
|
9
9
|
"modern.js"
|
|
10
10
|
],
|
|
11
|
-
"version": "3.0
|
|
11
|
+
"version": "3.1.0",
|
|
12
12
|
"types": "./src/index.ts",
|
|
13
13
|
"main": "./dist/cjs/index.js",
|
|
14
14
|
"export": {
|
|
@@ -36,18 +36,13 @@
|
|
|
36
36
|
"@types/styled-components": "^5.1.36",
|
|
37
37
|
"styled-components": "^5.3.1",
|
|
38
38
|
"typescript": "^5.3.3",
|
|
39
|
-
"@modern-js/app-tools": "3.0
|
|
40
|
-
"@modern-js/
|
|
41
|
-
"@modern-js/
|
|
39
|
+
"@modern-js/app-tools": "3.1.0",
|
|
40
|
+
"@modern-js/runtime": "3.1.0",
|
|
41
|
+
"@modern-js/rslib": "2.68.10"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"styled-components": "^5.3.1"
|
|
45
45
|
},
|
|
46
|
-
"peerDependenciesMeta": {
|
|
47
|
-
"styled-components": {
|
|
48
|
-
"optional": true
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
46
|
"exports": {
|
|
52
47
|
".": {
|
|
53
48
|
"types": "./dist/types/index.d.ts",
|
package/src/index.ts
CHANGED
|
@@ -11,12 +11,16 @@ export const styledComponentsPlugin = (
|
|
|
11
11
|
|
|
12
12
|
setup(api) {
|
|
13
13
|
api.config(() => {
|
|
14
|
+
const { metaName } = api.getAppContext();
|
|
15
|
+
|
|
14
16
|
return {
|
|
15
17
|
builderPlugins: [
|
|
16
18
|
pluginStyledComponents({
|
|
17
19
|
...options,
|
|
18
20
|
// https://github.com/styled-components/babel-plugin-styled-components/issues/287
|
|
19
|
-
topLevelImportPaths: [
|
|
21
|
+
topLevelImportPaths: [
|
|
22
|
+
`@${metaName}/plugin-styled-components/styled`,
|
|
23
|
+
],
|
|
20
24
|
}),
|
|
21
25
|
],
|
|
22
26
|
resolve: {
|
package/src/styled.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as styledComponents from 'styled-components';
|
|
2
|
+
import type { StyledInterface } from 'styled-components';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Safely resolves the styled-components default export.
|
|
6
|
+
* This helper function handles potential interoperability issues between CJS and ESM,
|
|
7
|
+
* where the default export might be nested or directly attached.
|
|
8
|
+
*/
|
|
9
|
+
function resolveStyledComponents(): StyledInterface {
|
|
10
|
+
const moduleExports = styledComponents as any;
|
|
11
|
+
|
|
12
|
+
if (moduleExports.default?.default !== undefined) {
|
|
13
|
+
return moduleExports.default.default;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return moduleExports.default ?? moduleExports;
|
|
17
|
+
}
|
|
4
18
|
|
|
19
|
+
const styled: StyledInterface = resolveStyledComponents();
|
|
20
|
+
|
|
21
|
+
export default styled;
|
|
5
22
|
export * from 'styled-components';
|