@mekari/pixel3-postcss 0.0.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.
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // ../../node_modules/.pnpm/tsup@7.2.0_postcss@8.4.31_typescript@5.1.6/node_modules/tsup/assets/cjs_shims.js
34
+ var getImportMetaUrl, importMetaUrl;
35
+ var init_cjs_shims = __esm({
36
+ "../../node_modules/.pnpm/tsup@7.2.0_postcss@8.4.31_typescript@5.1.6/node_modules/tsup/assets/cjs_shims.js"() {
37
+ "use strict";
38
+ getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
39
+ importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
40
+ }
41
+ });
42
+
43
+ // src/default-config.js
44
+ var default_config_exports = {};
45
+ __export(default_config_exports, {
46
+ defaultConfig: () => defaultConfig
47
+ });
48
+ var defaultConfig;
49
+ var init_default_config = __esm({
50
+ "src/default-config.js"() {
51
+ "use strict";
52
+ init_cjs_shims();
53
+ defaultConfig = {
54
+ preflight: true,
55
+ presets: ["@mekari/pixel3-theme"],
56
+ include: [
57
+ "./src/**/*.{js,jsx,ts,tsx,vue}",
58
+ "./node_modules/@mekari/pixel3/node_modules/@mekari/**/src/**/*.{ts,tsx,vue}"
59
+ ],
60
+ exclude: [],
61
+ layers: {
62
+ reset: "pixel_reset",
63
+ base: "pixel_base",
64
+ tokens: "pixel_tokens",
65
+ recipes: "pixel_recipes",
66
+ utilities: "pixel_utilities"
67
+ },
68
+ prefix: "mp",
69
+ jsxFramework: "vue"
70
+ };
71
+ }
72
+ });
73
+
74
+ // index.ts
75
+ init_cjs_shims();
76
+
77
+ // src/index.ts
78
+ init_cjs_shims();
79
+ var import_node = require("@pandacss/node");
80
+ var import_module = require("module");
81
+
82
+ // src/create-config.ts
83
+ init_cjs_shims();
84
+ var fs = require("fs");
85
+ var { defaultConfig: defaultConfig2 } = (init_default_config(), __toCommonJS(default_config_exports));
86
+ function mergeConfig(obj1, obj2) {
87
+ const mergeKey = ["include"];
88
+ const tempObj = {};
89
+ mergeKey.map((item) => {
90
+ if (obj2.hasOwnProperty(item)) {
91
+ tempObj[item] = [...obj1[item], ...obj2[item]];
92
+ }
93
+ });
94
+ return { ...obj1, ...tempObj };
95
+ }
96
+ var createConfigFile = (filePath, options) => {
97
+ const configs = mergeConfig(defaultConfig2, options);
98
+ const data = "export default" + JSON.stringify(configs, null, 2);
99
+ try {
100
+ fs.writeFileSync(filePath, data, "utf-8");
101
+ } catch (error) {
102
+ console.error(error.message);
103
+ }
104
+ };
105
+
106
+ // src/index.ts
107
+ var import_path = __toESM(require("path"));
108
+ var require2 = (0, import_module.createRequire)(importMetaUrl);
109
+ var tmp = require2("tmp");
110
+ var PLUGIN_NAME = "pixel3-postcss";
111
+ var tmpobj = tmp.fileSync({ postfix: ".ts" });
112
+ var configPath = tmpobj.name;
113
+ tmp.setGracefulCleanup();
114
+ var pixelcss = (options = {}) => {
115
+ const { cwd } = options;
116
+ createConfigFile(configPath, options);
117
+ console.log("Pixel Config (auto-generated) :", configPath);
118
+ const builder = new import_node.Builder();
119
+ const nodeModulesRegex = /node_modules/;
120
+ function isValidCss(file) {
121
+ const [filePath] = file.split("?");
122
+ return import_path.default.extname(filePath) === ".css";
123
+ }
124
+ return {
125
+ postcssPlugin: PLUGIN_NAME,
126
+ plugins: [
127
+ async function(root, result) {
128
+ const fileName = result.opts.from;
129
+ const skip = fileName ? !isValidCss(fileName) || nodeModulesRegex.test(fileName) : true;
130
+ if (skip)
131
+ return;
132
+ await builder.setup({ configPath, cwd });
133
+ if (!builder.isValidRoot(root)) {
134
+ return;
135
+ }
136
+ await builder.emit();
137
+ await builder.extract();
138
+ builder.registerDependency((dep) => {
139
+ result.messages.push({
140
+ ...dep,
141
+ plugin: PLUGIN_NAME,
142
+ parent: result.opts.from
143
+ });
144
+ });
145
+ builder.write(root);
146
+ root.walk((node) => {
147
+ if (!node.source) {
148
+ node.source = root.source;
149
+ }
150
+ });
151
+ }
152
+ ]
153
+ };
154
+ };
155
+ pixelcss.postcss = true;
156
+ var src_default = pixelcss;
157
+
158
+ // index.ts
159
+ module.exports = src_default;
package/dist/index.mjs ADDED
@@ -0,0 +1,170 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
6
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
7
+ }) : x)(function(x) {
8
+ if (typeof require !== "undefined")
9
+ return require.apply(this, arguments);
10
+ throw Error('Dynamic require of "' + x + '" is not supported');
11
+ });
12
+ var __esm = (fn, res) => function __init() {
13
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
14
+ };
15
+ var __commonJS = (cb, mod) => function __require2() {
16
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
+ };
18
+ var __export = (target, all) => {
19
+ for (var name in all)
20
+ __defProp(target, name, { get: all[name], enumerable: true });
21
+ };
22
+ var __copyProps = (to, from, except, desc) => {
23
+ if (from && typeof from === "object" || typeof from === "function") {
24
+ for (let key of __getOwnPropNames(from))
25
+ if (!__hasOwnProp.call(to, key) && key !== except)
26
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
27
+ }
28
+ return to;
29
+ };
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // ../../node_modules/.pnpm/tsup@7.2.0_postcss@8.4.31_typescript@5.1.6/node_modules/tsup/assets/esm_shims.js
33
+ var init_esm_shims = __esm({
34
+ "../../node_modules/.pnpm/tsup@7.2.0_postcss@8.4.31_typescript@5.1.6/node_modules/tsup/assets/esm_shims.js"() {
35
+ "use strict";
36
+ }
37
+ });
38
+
39
+ // src/default-config.js
40
+ var default_config_exports = {};
41
+ __export(default_config_exports, {
42
+ defaultConfig: () => defaultConfig
43
+ });
44
+ var defaultConfig;
45
+ var init_default_config = __esm({
46
+ "src/default-config.js"() {
47
+ "use strict";
48
+ init_esm_shims();
49
+ defaultConfig = {
50
+ preflight: true,
51
+ presets: ["@mekari/pixel3-theme"],
52
+ include: [
53
+ "./src/**/*.{js,jsx,ts,tsx,vue}",
54
+ "./node_modules/@mekari/pixel3/node_modules/@mekari/**/src/**/*.{ts,tsx,vue}"
55
+ ],
56
+ exclude: [],
57
+ layers: {
58
+ reset: "pixel_reset",
59
+ base: "pixel_base",
60
+ tokens: "pixel_tokens",
61
+ recipes: "pixel_recipes",
62
+ utilities: "pixel_utilities"
63
+ },
64
+ prefix: "mp",
65
+ jsxFramework: "vue"
66
+ };
67
+ }
68
+ });
69
+
70
+ // src/create-config.ts
71
+ function mergeConfig(obj1, obj2) {
72
+ const mergeKey = ["include"];
73
+ const tempObj = {};
74
+ mergeKey.map((item) => {
75
+ if (obj2.hasOwnProperty(item)) {
76
+ tempObj[item] = [...obj1[item], ...obj2[item]];
77
+ }
78
+ });
79
+ return { ...obj1, ...tempObj };
80
+ }
81
+ var fs, defaultConfig2, createConfigFile;
82
+ var init_create_config = __esm({
83
+ "src/create-config.ts"() {
84
+ "use strict";
85
+ init_esm_shims();
86
+ fs = __require("fs");
87
+ ({ defaultConfig: defaultConfig2 } = (init_default_config(), __toCommonJS(default_config_exports)));
88
+ createConfigFile = (filePath, options) => {
89
+ const configs = mergeConfig(defaultConfig2, options);
90
+ const data = "export default" + JSON.stringify(configs, null, 2);
91
+ try {
92
+ fs.writeFileSync(filePath, data, "utf-8");
93
+ } catch (error) {
94
+ console.error(error.message);
95
+ }
96
+ };
97
+ }
98
+ });
99
+
100
+ // src/index.ts
101
+ import { Builder } from "@pandacss/node";
102
+ import { createRequire } from "module";
103
+ import path from "path";
104
+ var require2, tmp, PLUGIN_NAME, tmpobj, configPath, pixelcss, src_default;
105
+ var init_src = __esm({
106
+ "src/index.ts"() {
107
+ "use strict";
108
+ init_esm_shims();
109
+ init_create_config();
110
+ require2 = createRequire(import.meta.url);
111
+ tmp = require2("tmp");
112
+ PLUGIN_NAME = "pixel3-postcss";
113
+ tmpobj = tmp.fileSync({ postfix: ".ts" });
114
+ configPath = tmpobj.name;
115
+ tmp.setGracefulCleanup();
116
+ pixelcss = (options = {}) => {
117
+ const { cwd } = options;
118
+ createConfigFile(configPath, options);
119
+ console.log("Pixel Config (auto-generated) :", configPath);
120
+ const builder = new Builder();
121
+ const nodeModulesRegex = /node_modules/;
122
+ function isValidCss(file) {
123
+ const [filePath] = file.split("?");
124
+ return path.extname(filePath) === ".css";
125
+ }
126
+ return {
127
+ postcssPlugin: PLUGIN_NAME,
128
+ plugins: [
129
+ async function(root, result) {
130
+ const fileName = result.opts.from;
131
+ const skip = fileName ? !isValidCss(fileName) || nodeModulesRegex.test(fileName) : true;
132
+ if (skip)
133
+ return;
134
+ await builder.setup({ configPath, cwd });
135
+ if (!builder.isValidRoot(root)) {
136
+ return;
137
+ }
138
+ await builder.emit();
139
+ await builder.extract();
140
+ builder.registerDependency((dep) => {
141
+ result.messages.push({
142
+ ...dep,
143
+ plugin: PLUGIN_NAME,
144
+ parent: result.opts.from
145
+ });
146
+ });
147
+ builder.write(root);
148
+ root.walk((node) => {
149
+ if (!node.source) {
150
+ node.source = root.source;
151
+ }
152
+ });
153
+ }
154
+ ]
155
+ };
156
+ };
157
+ pixelcss.postcss = true;
158
+ src_default = pixelcss;
159
+ }
160
+ });
161
+
162
+ // index.ts
163
+ var require_postcss = __commonJS({
164
+ "index.ts"(exports, module) {
165
+ init_esm_shims();
166
+ init_src();
167
+ module.exports = src_default;
168
+ }
169
+ });
170
+ export default require_postcss();
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@mekari/pixel3-postcss",
3
+ "version": "0.0.0",
4
+ "description": "PostCSS integration for Pixel 3",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "author": "Sastra Nababan",
9
+ "scripts": {
10
+ "build": "tsup index.ts --format=cjs,esm --shims --dts",
11
+ "build-fast": "tsup src/index.ts --format=cjs,esm --shims --no-dts",
12
+ "dev": "pnpm build-fast --watch",
13
+ "replace-config": "clean-package",
14
+ "restore-config": "clean-package restore"
15
+ },
16
+ "sideEffects": false,
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "dependencies": {
24
+ "@pandacss/dev": "^0.20.1",
25
+ "@pandacss/node": "^0.20.1",
26
+ "postcss": "^8.4.31",
27
+ "tmp": "^0.2.1"
28
+ },
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "require": "./dist/index.js",
33
+ "default": "./dist/index.mjs"
34
+ }
35
+ }
36
+ }