@modern-js/plugin-tailwindcss 0.0.0-next-20240617090621 → 0.0.0-next-20240618081858

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.
@@ -44,7 +44,42 @@ const designTokenPlugin = ({ pluginName } = {
44
44
  return resolveConfig(tailwindcssConfig).theme || {};
45
45
  };
46
46
  return {
47
- _internalRuntimePlugins({ entrypoint, plugins }) {
47
+ config() {
48
+ const appContext = api.useAppContext();
49
+ pluginsExportsUtils = (0, import_utils.createRuntimeExportsUtils)(appContext.internalDirectory, "plugins");
50
+ return {
51
+ source: {
52
+ alias: {
53
+ "@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
54
+ }
55
+ }
56
+ };
57
+ },
58
+ modifyEntryImports({ entrypoint, imports }) {
59
+ var _userConfig_source;
60
+ const userConfig = api.useResolvedConfigContext();
61
+ var _userConfig_source_designSystem;
62
+ const designSystem = (_userConfig_source_designSystem = (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.designSystem) !== null && _userConfig_source_designSystem !== void 0 ? _userConfig_source_designSystem : {};
63
+ if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
64
+ const designTokens = getDesignTokens(userConfig.source.designSystem);
65
+ imports.push({
66
+ value: "@modern-js/runtime/plugins",
67
+ specifiers: [
68
+ {
69
+ imported: PLUGIN_IDENTIFIER
70
+ }
71
+ ],
72
+ initialize: `
73
+ const designTokens = ${JSON.stringify(designTokens)};
74
+ `
75
+ });
76
+ }
77
+ return {
78
+ entrypoint,
79
+ imports
80
+ };
81
+ },
82
+ modifyEntryRuntimePlugins({ entrypoint, plugins }) {
48
83
  var _userConfig_source;
49
84
  const userConfig = api.useResolvedConfigContext();
50
85
  var _userConfig_source_designSystem;
@@ -54,15 +89,9 @@ const designTokenPlugin = ({ pluginName } = {
54
89
  useSCThemeProvider = (designSystem === null || designSystem === void 0 ? void 0 : designSystem.supportStyledComponents) || false;
55
90
  }
56
91
  if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
57
- const designTokens = getDesignTokens(userConfig.source.designSystem);
58
92
  plugins.push({
59
93
  name: PLUGIN_IDENTIFIER,
60
- implementation: "@modern-js/plugin-tailwindcss/runtime-design-token",
61
- config: {
62
- token: designTokens,
63
- useStyledComponentsThemeProvider: Boolean(useSCThemeProvider),
64
- useDesignTokenContext: false
65
- }
94
+ options: `{token: designTokens, useStyledComponentsThemeProvider: ${useSCThemeProvider ? "true" : "false"}, useDesignTokenContext: false}`
66
95
  });
67
96
  }
68
97
  return {
@@ -70,17 +99,6 @@ const designTokenPlugin = ({ pluginName } = {
70
99
  plugins
71
100
  };
72
101
  },
73
- config() {
74
- const appContext = api.useAppContext();
75
- pluginsExportsUtils = (0, import_utils.createRuntimeExportsUtils)(appContext.internalDirectory, "plugins");
76
- return {
77
- source: {
78
- alias: {
79
- "@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
80
- }
81
- }
82
- };
83
- },
84
102
  addRuntimeExports() {
85
103
  pluginsExportsUtils.addExport(`export { default as designToken } from '${pluginName}/runtime-design-token'`);
86
104
  }
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
21
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
22
  // If the importer is in node compatibility mode or this is not an ESM
22
23
  // file that has been converted to a CommonJS file using a Babel-
@@ -28,12 +29,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
30
  var runtime_exports = {};
30
31
  __export(runtime_exports, {
31
- default: () => import_plugin.default,
32
- designTokenPlugin: () => import_plugin.designTokenPlugin
32
+ default: () => runtime_default
33
33
  });
34
34
  module.exports = __toCommonJS(runtime_exports);
35
35
  var import_plugin = __toESM(require("./plugin"));
36
+ __reExport(runtime_exports, require("./plugin"), module.exports);
37
+ var runtime_default = import_plugin.default;
36
38
  // Annotate the CommonJS export names for ESM import in node:
37
39
  0 && (module.exports = {
38
- designTokenPlugin
40
+ ...require("./plugin")
39
41
  });
@@ -30,7 +30,6 @@ var plugin_exports = {};
30
30
  __export(plugin_exports, {
31
31
  DesignTokenContext: () => DesignTokenContext,
32
32
  default: () => plugin_default,
33
- designTokenPlugin: () => designTokenPlugin,
34
33
  useDesignTokens: () => useDesignTokens
35
34
  });
36
35
  module.exports = __toCommonJS(plugin_exports);
@@ -39,7 +38,7 @@ var import_hoist_non_react_statics = __toESM(require("hoist-non-react-statics"))
39
38
  var import_react = __toESM(require("react"));
40
39
  const DesignTokenContext = /* @__PURE__ */ import_react.default.createContext({});
41
40
  const useDesignTokens = () => (0, import_react.useContext)(DesignTokenContext);
42
- const designTokenPlugin = (options = {}) => ({
41
+ var plugin_default = (options = {}) => ({
43
42
  name: "@modern-js/plugin-design-token",
44
43
  setup: () => ({
45
44
  hoc({ App, config }, next) {
@@ -84,10 +83,8 @@ const designTokenPlugin = (options = {}) => ({
84
83
  }
85
84
  })
86
85
  });
87
- var plugin_default = designTokenPlugin;
88
86
  // Annotate the CommonJS export names for ESM import in node:
89
87
  0 && (module.exports = {
90
88
  DesignTokenContext,
91
- designTokenPlugin,
92
89
  useDesignTokens
93
90
  });
@@ -22,7 +22,41 @@ var designTokenPlugin = function() {
22
22
  return resolveConfig(tailwindcssConfig).theme || {};
23
23
  };
24
24
  return {
25
- _internalRuntimePlugins: function _internalRuntimePlugins(param) {
25
+ config: function config() {
26
+ var appContext = api.useAppContext();
27
+ pluginsExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, "plugins");
28
+ return {
29
+ source: {
30
+ alias: {
31
+ "@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
32
+ }
33
+ }
34
+ };
35
+ },
36
+ modifyEntryImports: function modifyEntryImports(param) {
37
+ var entrypoint = param.entrypoint, imports = param.imports;
38
+ var _userConfig_source;
39
+ var userConfig = api.useResolvedConfigContext();
40
+ var _userConfig_source_designSystem;
41
+ var designSystem = (_userConfig_source_designSystem = (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.designSystem) !== null && _userConfig_source_designSystem !== void 0 ? _userConfig_source_designSystem : {};
42
+ if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
43
+ var designTokens = getDesignTokens(userConfig.source.designSystem);
44
+ imports.push({
45
+ value: "@modern-js/runtime/plugins",
46
+ specifiers: [
47
+ {
48
+ imported: PLUGIN_IDENTIFIER
49
+ }
50
+ ],
51
+ initialize: "\n const designTokens = ".concat(JSON.stringify(designTokens), ";\n ")
52
+ });
53
+ }
54
+ return {
55
+ entrypoint,
56
+ imports
57
+ };
58
+ },
59
+ modifyEntryRuntimePlugins: function modifyEntryRuntimePlugins(param) {
26
60
  var entrypoint = param.entrypoint, plugins = param.plugins;
27
61
  var _userConfig_source;
28
62
  var userConfig = api.useResolvedConfigContext();
@@ -33,15 +67,9 @@ var designTokenPlugin = function() {
33
67
  useSCThemeProvider = (designSystem === null || designSystem === void 0 ? void 0 : designSystem.supportStyledComponents) || false;
34
68
  }
35
69
  if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
36
- var designTokens = getDesignTokens(userConfig.source.designSystem);
37
70
  plugins.push({
38
71
  name: PLUGIN_IDENTIFIER,
39
- implementation: "@modern-js/plugin-tailwindcss/runtime-design-token",
40
- config: {
41
- token: designTokens,
42
- useStyledComponentsThemeProvider: Boolean(useSCThemeProvider),
43
- useDesignTokenContext: false
44
- }
72
+ options: "{token: designTokens, useStyledComponentsThemeProvider: ".concat(useSCThemeProvider ? "true" : "false", ", useDesignTokenContext: false}")
45
73
  });
46
74
  }
47
75
  return {
@@ -49,17 +77,6 @@ var designTokenPlugin = function() {
49
77
  plugins
50
78
  };
51
79
  },
52
- config: function config() {
53
- var appContext = api.useAppContext();
54
- pluginsExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, "plugins");
55
- return {
56
- source: {
57
- alias: {
58
- "@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
59
- }
60
- }
61
- };
62
- },
63
80
  addRuntimeExports: function addRuntimeExports() {
64
81
  pluginsExportsUtils.addExport("export { default as designToken } from '".concat(pluginName, "/runtime-design-token'"));
65
82
  }
@@ -1,5 +1,6 @@
1
- import { default as default2, designTokenPlugin } from "./plugin";
1
+ import designTokenPlugin from "./plugin";
2
+ export * from "./plugin";
3
+ var runtime_default = designTokenPlugin;
2
4
  export {
3
- default2 as default,
4
- designTokenPlugin
5
+ runtime_default as default
5
6
  };
@@ -6,7 +6,7 @@ var DesignTokenContext = /* @__PURE__ */ React.createContext({});
6
6
  var useDesignTokens = function() {
7
7
  return useContext(DesignTokenContext);
8
8
  };
9
- var designTokenPlugin = function() {
9
+ function plugin_default() {
10
10
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
11
11
  return {
12
12
  name: "@modern-js/plugin-design-token",
@@ -48,11 +48,10 @@ var designTokenPlugin = function() {
48
48
  };
49
49
  }
50
50
  };
51
- };
52
- var plugin_default = designTokenPlugin;
51
+ }
52
+ ;
53
53
  export {
54
54
  DesignTokenContext,
55
55
  plugin_default as default,
56
- designTokenPlugin,
57
56
  useDesignTokens
58
57
  };
@@ -21,7 +21,42 @@ const designTokenPlugin = ({ pluginName } = {
21
21
  return resolveConfig(tailwindcssConfig).theme || {};
22
22
  };
23
23
  return {
24
- _internalRuntimePlugins({ entrypoint, plugins }) {
24
+ config() {
25
+ const appContext = api.useAppContext();
26
+ pluginsExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, "plugins");
27
+ return {
28
+ source: {
29
+ alias: {
30
+ "@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
31
+ }
32
+ }
33
+ };
34
+ },
35
+ modifyEntryImports({ entrypoint, imports }) {
36
+ var _userConfig_source;
37
+ const userConfig = api.useResolvedConfigContext();
38
+ var _userConfig_source_designSystem;
39
+ const designSystem = (_userConfig_source_designSystem = (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.designSystem) !== null && _userConfig_source_designSystem !== void 0 ? _userConfig_source_designSystem : {};
40
+ if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
41
+ const designTokens = getDesignTokens(userConfig.source.designSystem);
42
+ imports.push({
43
+ value: "@modern-js/runtime/plugins",
44
+ specifiers: [
45
+ {
46
+ imported: PLUGIN_IDENTIFIER
47
+ }
48
+ ],
49
+ initialize: `
50
+ const designTokens = ${JSON.stringify(designTokens)};
51
+ `
52
+ });
53
+ }
54
+ return {
55
+ entrypoint,
56
+ imports
57
+ };
58
+ },
59
+ modifyEntryRuntimePlugins({ entrypoint, plugins }) {
25
60
  var _userConfig_source;
26
61
  const userConfig = api.useResolvedConfigContext();
27
62
  var _userConfig_source_designSystem;
@@ -31,15 +66,9 @@ const designTokenPlugin = ({ pluginName } = {
31
66
  useSCThemeProvider = (designSystem === null || designSystem === void 0 ? void 0 : designSystem.supportStyledComponents) || false;
32
67
  }
33
68
  if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
34
- const designTokens = getDesignTokens(userConfig.source.designSystem);
35
69
  plugins.push({
36
70
  name: PLUGIN_IDENTIFIER,
37
- implementation: "@modern-js/plugin-tailwindcss/runtime-design-token",
38
- config: {
39
- token: designTokens,
40
- useStyledComponentsThemeProvider: Boolean(useSCThemeProvider),
41
- useDesignTokenContext: false
42
- }
71
+ options: `{token: designTokens, useStyledComponentsThemeProvider: ${useSCThemeProvider ? "true" : "false"}, useDesignTokenContext: false}`
43
72
  });
44
73
  }
45
74
  return {
@@ -47,17 +76,6 @@ const designTokenPlugin = ({ pluginName } = {
47
76
  plugins
48
77
  };
49
78
  },
50
- config() {
51
- const appContext = api.useAppContext();
52
- pluginsExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, "plugins");
53
- return {
54
- source: {
55
- alias: {
56
- "@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
57
- }
58
- }
59
- };
60
- },
61
79
  addRuntimeExports() {
62
80
  pluginsExportsUtils.addExport(`export { default as designToken } from '${pluginName}/runtime-design-token'`);
63
81
  }
@@ -1,5 +1,6 @@
1
- import { default as default2, designTokenPlugin } from "./plugin";
1
+ import designTokenPlugin from "./plugin";
2
+ export * from "./plugin";
3
+ var runtime_default = designTokenPlugin;
2
4
  export {
3
- default2 as default,
4
- designTokenPlugin
5
+ runtime_default as default
5
6
  };
@@ -3,7 +3,7 @@ import hoistNonReactStatics from "hoist-non-react-statics";
3
3
  import React, { useContext } from "react";
4
4
  const DesignTokenContext = /* @__PURE__ */ React.createContext({});
5
5
  const useDesignTokens = () => useContext(DesignTokenContext);
6
- const designTokenPlugin = (options = {}) => ({
6
+ var plugin_default = (options = {}) => ({
7
7
  name: "@modern-js/plugin-design-token",
8
8
  setup: () => ({
9
9
  hoc({ App, config }, next) {
@@ -48,10 +48,8 @@ const designTokenPlugin = (options = {}) => ({
48
48
  }
49
49
  })
50
50
  });
51
- var plugin_default = designTokenPlugin;
52
51
  export {
53
52
  DesignTokenContext,
54
53
  plugin_default as default,
55
- designTokenPlugin,
56
54
  useDesignTokens
57
55
  };
@@ -1 +1,3 @@
1
- export { default, designTokenPlugin } from './plugin';
1
+ import designTokenPlugin from './plugin';
2
+ export * from './plugin';
3
+ export default designTokenPlugin;
@@ -2,9 +2,9 @@ import type { Plugin } from '@modern-js/runtime';
2
2
  import React from 'react';
3
3
  export declare const DesignTokenContext: React.Context<any>;
4
4
  export declare const useDesignTokens: () => IDesignTokens;
5
- export declare const designTokenPlugin: (options?: {
5
+ declare const _default: (options?: {
6
6
  token?: Record<string, any>;
7
7
  useStyledComponentsThemeProvider?: boolean;
8
8
  useDesignTokenContext?: boolean;
9
9
  }) => Plugin;
10
- export default designTokenPlugin;
10
+ export default _default;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-next-20240617090621",
18
+ "version": "0.0.0-next-20240618081858",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -49,8 +49,8 @@
49
49
  "babel-plugin-macros": "3.1.0",
50
50
  "hoist-non-react-statics": "^3.3.2",
51
51
  "@swc/helpers": "0.5.3",
52
- "@modern-js/node-bundle-require": "0.0.0-next-20240617090621",
53
- "@modern-js/utils": "0.0.0-next-20240617090621"
52
+ "@modern-js/node-bundle-require": "0.0.0-next-20240618081858",
53
+ "@modern-js/utils": "0.0.0-next-20240618081858"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/jest": "^29",
@@ -60,17 +60,17 @@
60
60
  "jest": "^29",
61
61
  "react": "^18",
62
62
  "postcss": "^8.4.35",
63
- "@modern-js/core": "0.0.0-next-20240617090621",
64
- "@modern-js/module-tools": "0.0.0-next-20240617090621",
65
- "@modern-js/runtime": "0.0.0-next-20240617090621",
66
- "@scripts/build": "0.0.0-next-20240617090621",
67
- "@modern-js/types": "0.0.0-next-20240617090621",
68
- "@modern-js/app-tools": "0.0.0-next-20240617090621",
69
- "@scripts/jest-config": "0.0.0-next-20240617090621"
63
+ "@modern-js/core": "0.0.0-next-20240618081858",
64
+ "@modern-js/module-tools": "0.0.0-next-20240618081858",
65
+ "@scripts/build": "0.0.0-next-20240618081858",
66
+ "@modern-js/runtime": "0.0.0-next-20240618081858",
67
+ "@modern-js/types": "0.0.0-next-20240618081858",
68
+ "@modern-js/app-tools": "0.0.0-next-20240618081858",
69
+ "@scripts/jest-config": "0.0.0-next-20240618081858"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "tailwindcss": ">= 2.0.0 || >= 3.0.0",
73
- "@modern-js/runtime": "0.0.0-next-20240617090621"
73
+ "@modern-js/runtime": "0.0.0-next-20240618081858"
74
74
  },
75
75
  "peerDependenciesMeta": {
76
76
  "@modern-js/runtime": {