MCPcopy
hub / github.com/kuma-ui/kuma-ui / apply

Method apply

packages/webpack-plugin/src/plugin.ts:55–111  ·  view source on GitHub ↗
(compiler: Compiler)

Source from the content-addressed store, hash-verified

53 }
54
55 apply(compiler: Compiler) {
56 const { config } = this;
57
58 compiler.options.plugins.push(
59 new compiler.webpack.DefinePlugin({
60 ...(config
61 ? {
62 "globalThis.__KUMA_USER_THEME__":
63 compiler.webpack.DefinePlugin.runtimeValue(
64 () => {
65 const userTheme = getUserTheme(config);
66 if (userTheme) {
67 theme.setUserTheme(userTheme);
68 }
69 return JSON.stringify(userTheme);
70 },
71 {
72 // enable automatic rebuild for dynamic theme props
73 // <Box color={(() => "colors.red.100"))()} />
74 fileDependencies: [config],
75 },
76 ),
77 }
78 : undefined),
79 }),
80 );
81
82 compiler.hooks.watchRun.tap("@kuma-ui/webpack-plugin:watchRun", () => {
83 this.watchMode = true;
84 });
85
86 compiler.options.module?.rules?.push(
87 {
88 test: /\.(tsx|ts|js|mjs|jsx)$/,
89 exclude: /node_modules/,
90 use: [
91 {
92 loader: _require.resolve("./loader.js"),
93 options: {
94 plugin: this,
95 outputDir: this.outputDir,
96 wasm: this.wasm,
97 },
98 },
99 ],
100 },
101 {
102 test: CSS_PATH,
103 use: [
104 {
105 loader: _require.resolve("./cssLoader.js"),
106 options: { plugin: this },
107 },
108 ],
109 },
110 );
111 }
112}

Callers

nothing calls this directly

Calls 2

getUserThemeFunction · 0.90
setUserThemeMethod · 0.80

Tested by

no test coverage detected