uniwind-plugin-next 1.1.1 → 1.2.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/LICENSE +21 -0
- package/README.md +8 -9
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/index.cjs +2 -368
- package/dist/index.d.cts +1 -10
- package/dist/index.d.mts +1 -10
- package/dist/index.mjs +1 -338
- package/dist/postcss/index.cjs +8 -4
- package/dist/postcss/index.d.cts +10 -1
- package/dist/postcss/index.d.cts.map +1 -0
- package/dist/postcss/index.d.mts +11 -1
- package/dist/postcss/index.d.mts.map +1 -0
- package/dist/postcss/index.mjs +17 -19
- package/dist/postcss/index.mjs.map +1 -0
- package/dist/webpack/UniwindWebpackPlugin.cjs +48 -0
- package/dist/webpack/UniwindWebpackPlugin.mjs +47 -0
- package/dist/webpack/UniwindWebpackPlugin.mjs.map +1 -0
- package/dist/webpack/clientDirectiveLoader.js +8 -0
- package/dist/webpack/configInjectionLoader.js +6 -0
- package/dist/webpack/types.d.cts +9 -0
- package/dist/webpack/types.d.cts.map +1 -0
- package/dist/webpack/types.d.mts +9 -0
- package/dist/webpack/types.d.mts.map +1 -0
- package/dist/webpack/uniwind/package.cjs +11 -0
- package/dist/webpack/uniwind/package.mjs +6 -0
- package/dist/webpack/uniwind/package.mjs.map +1 -0
- package/dist/webpack/uniwind/src/css/index.cjs +26 -0
- package/dist/webpack/uniwind/src/css/index.mjs +24 -0
- package/dist/webpack/uniwind/src/css/index.mjs.map +1 -0
- package/dist/webpack/uniwind/src/css/insets.cjs +66 -0
- package/dist/webpack/uniwind/src/css/insets.mjs +66 -0
- package/dist/webpack/uniwind/src/css/insets.mjs.map +1 -0
- package/dist/webpack/uniwind/src/css/themes.cjs +84 -0
- package/dist/webpack/uniwind/src/css/themes.mjs +82 -0
- package/dist/webpack/uniwind/src/css/themes.mjs.map +1 -0
- package/dist/webpack/uniwind/src/css/variants.cjs +18 -0
- package/dist/webpack/uniwind/src/css/variants.mjs +18 -0
- package/dist/webpack/uniwind/src/css/variants.mjs.map +1 -0
- package/dist/webpack/uniwind/src/metro/logger.cjs +37 -0
- package/dist/webpack/uniwind/src/metro/logger.mjs +37 -0
- package/dist/webpack/uniwind/src/metro/logger.mjs.map +1 -0
- package/dist/webpack/uniwind/src/utils/buildDtsFile.cjs +27 -0
- package/dist/webpack/uniwind/src/utils/buildDtsFile.mjs +26 -0
- package/dist/webpack/uniwind/src/utils/buildDtsFile.mjs.map +1 -0
- package/dist/webpack/uniwind/src/utils/common.cjs +6 -0
- package/dist/webpack/uniwind/src/utils/common.mjs +6 -0
- package/dist/webpack/uniwind/src/utils/common.mjs.map +1 -0
- package/dist/webpack/uniwind/src/utils/stringifyThemes.cjs +6 -0
- package/dist/webpack/uniwind/src/utils/stringifyThemes.mjs +6 -0
- package/dist/webpack/uniwind/src/utils/stringifyThemes.mjs.map +1 -0
- package/dist/webpack/withUniwind.cjs +34 -0
- package/dist/webpack/withUniwind.d.cts +7 -0
- package/dist/webpack/withUniwind.d.cts.map +1 -0
- package/dist/webpack/withUniwind.d.mts +7 -0
- package/dist/webpack/withUniwind.d.mts.map +1 -0
- package/dist/webpack/withUniwind.mjs +32 -0
- package/dist/webpack/withUniwind.mjs.map +1 -0
- package/package.json +24 -5
- package/dist/chunk-3qlvafw2.mjs +0 -8
- package/dist/clientDirectiveLoader.js +0 -9
- package/dist/configInjectionLoader.js +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withUniwind.d.mts","names":[],"sources":["../../src/webpack/withUniwind.ts"],"sourcesContent":[],"mappings":";;;iBASgB,WAAA,6CAEC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { uniq } from "./uniwind/src/utils/common.mjs";
|
|
2
|
+
import { UniwindWebpackPlugin } from "./UniwindWebpackPlugin.mjs";
|
|
3
|
+
import webpack from "webpack";
|
|
4
|
+
import path from "path";
|
|
5
|
+
|
|
6
|
+
//#region src/webpack/withUniwind.ts
|
|
7
|
+
const { NormalModuleReplacementPlugin } = webpack;
|
|
8
|
+
function withUniwind(nextConfig = {}, uniwindConfig) {
|
|
9
|
+
return {
|
|
10
|
+
...nextConfig,
|
|
11
|
+
transpilePackages: uniq([
|
|
12
|
+
...nextConfig.transpilePackages || [],
|
|
13
|
+
"uniwind",
|
|
14
|
+
"react-native",
|
|
15
|
+
"react-native-web"
|
|
16
|
+
]),
|
|
17
|
+
webpack(config, options) {
|
|
18
|
+
if (!config.plugins) config.plugins = [];
|
|
19
|
+
config.plugins.push(new NormalModuleReplacementPlugin(/^react-native$/, (resource) => {
|
|
20
|
+
if ((resource.context || "").includes(`${path.sep}uniwind${path.sep}dist${path.sep}module${path.sep}components${path.sep}web`)) resource.request = "react-native-web";
|
|
21
|
+
else resource.request = "uniwind/components/index";
|
|
22
|
+
}));
|
|
23
|
+
config.plugins.push(new UniwindWebpackPlugin(uniwindConfig));
|
|
24
|
+
if (typeof nextConfig.webpack === "function") return nextConfig.webpack(config, options);
|
|
25
|
+
return config;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { withUniwind };
|
|
32
|
+
//# sourceMappingURL=withUniwind.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withUniwind.mjs","names":[],"sources":["../../src/webpack/withUniwind.ts"],"sourcesContent":["import webpack from \"webpack\";\nimport type { Configuration } from \"webpack\";\nimport path from \"path\";\nimport { UniwindConfig } from \"./types\";\nimport { UniwindWebpackPlugin } from \"./UniwindWebpackPlugin\";\nimport { uniq } from \"./uniwind/src/utils/common\";\n\nconst { NormalModuleReplacementPlugin } = webpack;\n\nexport function withUniwind(\n nextConfig: any = {},\n uniwindConfig: UniwindConfig,\n): any {\n return {\n ...nextConfig,\n transpilePackages: uniq([\n ...(nextConfig.transpilePackages || []),\n \"uniwind\",\n \"react-native\",\n \"react-native-web\",\n ]),\n webpack(config: Configuration, options: any): Configuration {\n if (!config.plugins) config.plugins = [];\n\n // Rewrite imports, slightly more complex than usual because we need both:\n // Rewrite `react-native` imports to `uniwind/components/index`\n // Rewrite `react-native` imports within Uniwind components to `react-native-web`\n config.plugins.push(\n new NormalModuleReplacementPlugin(/^react-native$/, (resource) => {\n const context = resource.context || \"\";\n\n if (\n context.includes(\n `${path.sep}uniwind${path.sep}dist${path.sep}module${path.sep}components${path.sep}web`,\n )\n ) {\n // Inside uniwind/dist → react-native-web\n resource.request = \"react-native-web\";\n } else {\n // Everywhere else → uniwnd/web\n resource.request = \"uniwind/components/index\";\n }\n }),\n );\n\n config.plugins.push(new UniwindWebpackPlugin(uniwindConfig));\n\n // Execute the user-defined webpack config.\n if (typeof nextConfig.webpack === \"function\") {\n return nextConfig.webpack(config, options);\n }\n\n return config;\n },\n };\n}\n"],"mappings":";;;;;;AAOA,MAAM,EAAE,kCAAkC;AAE1C,SAAgB,YACd,aAAkB,EAAE,EACpB,eACK;AACL,QAAO;EACL,GAAG;EACH,mBAAmB,KAAK;GACtB,GAAI,WAAW,qBAAqB,EAAE;GACtC;GACA;GACA;GACD,CAAC;EACF,QAAQ,QAAuB,SAA6B;AAC1D,OAAI,CAAC,OAAO,QAAS,QAAO,UAAU,EAAE;AAKxC,UAAO,QAAQ,KACb,IAAI,8BAA8B,mBAAmB,aAAa;AAGhE,SAFgB,SAAS,WAAW,IAG1B,SACN,GAAG,KAAK,IAAI,SAAS,KAAK,IAAI,MAAM,KAAK,IAAI,QAAQ,KAAK,IAAI,YAAY,KAAK,IAAI,KACpF,CAGD,UAAS,UAAU;QAGnB,UAAS,UAAU;KAErB,CACH;AAED,UAAO,QAAQ,KAAK,IAAI,qBAAqB,cAAc,CAAC;AAG5D,OAAI,OAAO,WAAW,YAAY,WAChC,QAAO,WAAW,QAAQ,QAAQ,QAAQ;AAG5C,UAAO;;EAEV"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniwind-plugin-next",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"author": "Alexander Nicholson",
|
|
4
5
|
"description": "Compatibility plugin for using Uniwind with Next.js",
|
|
6
|
+
"homepage": "https://github.com/a16n-dev/uniwind-plugin-next#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/a16n-dev/uniwind-plugin-next.git"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
5
12
|
"devDependencies": {
|
|
6
|
-
"@
|
|
13
|
+
"@vitest/ui": "^4.0.16",
|
|
14
|
+
"postcss": "^8.5.6",
|
|
7
15
|
"tsdown": "^0.18.2",
|
|
8
|
-
"
|
|
16
|
+
"vitest": "^4.0.16"
|
|
9
17
|
},
|
|
10
18
|
"peerDependencies": {
|
|
11
19
|
"@tailwindcss/node": "^4",
|
|
12
20
|
"lightningcss": ">=1.30.2",
|
|
21
|
+
"postcss": "^8",
|
|
13
22
|
"uniwind": "~1.2.2",
|
|
14
23
|
"webpack": "^5"
|
|
15
24
|
},
|
|
@@ -22,12 +31,22 @@
|
|
|
22
31
|
"require": "./dist/postcss/index.cjs",
|
|
23
32
|
"import": "./dist/postcss/index.mjs"
|
|
24
33
|
},
|
|
25
|
-
"./package.json": "./package.json"
|
|
34
|
+
"./package.json": "./package.json",
|
|
35
|
+
"./css": {
|
|
36
|
+
"style": "./dist/webpack/uniwind/uniwind.css"
|
|
37
|
+
}
|
|
26
38
|
},
|
|
27
39
|
"main": "./dist/index.cjs",
|
|
28
40
|
"module": "./dist/index.mjs",
|
|
29
41
|
"types": "./dist/index.d.cts",
|
|
42
|
+
"files": [
|
|
43
|
+
"dist",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
30
46
|
"scripts": {
|
|
31
|
-
"build": "tsdown"
|
|
47
|
+
"build": "tsdown",
|
|
48
|
+
"dev": "tsdown --watch",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"test": "vitest run"
|
|
32
51
|
}
|
|
33
52
|
}
|
package/dist/chunk-3qlvafw2.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
|
|
3
|
-
//#region rolldown:runtime
|
|
4
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
5
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
export { __require as n, __commonJSMin as t };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export default function clientDirectiveLoader(source) {
|
|
2
|
-
console.log(this.resourcePath);
|
|
3
|
-
// Don't add the directive if it's already present
|
|
4
|
-
if (source.startsWith('"use client"') || source.startsWith("'use client'")) {
|
|
5
|
-
return source;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
return `"use client";\n${source}`;
|
|
9
|
-
}
|