@mekari/pixel3-postcss 0.0.0 → 0.0.1

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