@mekari/pixel3-postcss 0.0.6 → 0.0.7-dev.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/dist/index.js +40 -5
- package/dist/index.mjs +43 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54,9 +54,7 @@ var init_default_config = __esm({
|
|
|
54
54
|
preflight: true,
|
|
55
55
|
presets: ["@mekari/pixel3-theme"],
|
|
56
56
|
include: [
|
|
57
|
-
"./src/**/*.{js,jsx,ts,tsx,vue}"
|
|
58
|
-
"./node_modules/@mekari/**/dist/**/*.{js,mjs}"
|
|
59
|
-
// Need to analyze usage of children component, MpFlex, and Pixel tag.
|
|
57
|
+
"./src/**/*.{js,jsx,ts,tsx,vue}"
|
|
60
58
|
],
|
|
61
59
|
exclude: [],
|
|
62
60
|
layers: {
|
|
@@ -92,22 +90,43 @@ var import_module = require("module");
|
|
|
92
90
|
// src/create-config.ts
|
|
93
91
|
init_cjs_shims();
|
|
94
92
|
var fs = require("fs");
|
|
93
|
+
var path = require("path");
|
|
95
94
|
var { defaultConfig: defaultConfig2 } = (init_default_config(), __toCommonJS(default_config_exports));
|
|
95
|
+
function findRealModulePath(moduleName) {
|
|
96
|
+
try {
|
|
97
|
+
const symlinkPath = path.join("node_modules", moduleName);
|
|
98
|
+
const realPath = fs.realpathSync(symlinkPath);
|
|
99
|
+
return realPath;
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error("Error finding real module path:", error);
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
96
105
|
function mergeConfig(obj1, obj2) {
|
|
97
106
|
const mergeKey = ["include", "exclude"];
|
|
98
107
|
const tempObj = {};
|
|
108
|
+
const hasReplaceConfig = obj2.replaceConfig?.length > 0;
|
|
99
109
|
mergeKey.map((item) => {
|
|
100
110
|
if (obj2.hasOwnProperty(item)) {
|
|
101
111
|
if (item === "staticCss") {
|
|
102
112
|
tempObj[item] = obj2[item];
|
|
103
113
|
return;
|
|
104
114
|
}
|
|
115
|
+
if (hasReplaceConfig && obj2.replaceConfig.includes(item)) {
|
|
116
|
+
tempObj[item] = obj2[item];
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
105
119
|
tempObj[item] = [...obj1[item], ...obj2[item]];
|
|
106
120
|
}
|
|
107
121
|
});
|
|
108
122
|
return { ...obj1, ...tempObj };
|
|
109
123
|
}
|
|
110
|
-
var createConfigFile = (filePath, options) => {
|
|
124
|
+
var createConfigFile = (filePath, options, packageManager) => {
|
|
125
|
+
const restDefaultConfig = defaultConfig2;
|
|
126
|
+
if (packageManager) {
|
|
127
|
+
const pixelDir = path.dirname(findRealModulePath("@mekari/pixel3"));
|
|
128
|
+
restDefaultConfig.include.push(`${pixelDir}/**/dist/**/*.{js,mjs}`);
|
|
129
|
+
}
|
|
111
130
|
const configs = mergeConfig(defaultConfig2, options);
|
|
112
131
|
const data = "export default" + JSON.stringify(configs, null, 2);
|
|
113
132
|
try {
|
|
@@ -140,9 +159,25 @@ var shouldSkip = (fileName) => {
|
|
|
140
159
|
return false;
|
|
141
160
|
return nodeModulesRegex.test(fileName);
|
|
142
161
|
};
|
|
162
|
+
function getPackageManager() {
|
|
163
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
164
|
+
let result = "";
|
|
165
|
+
if (userAgent) {
|
|
166
|
+
if (userAgent.includes("pnpm")) {
|
|
167
|
+
result = "pnpm";
|
|
168
|
+
} else if (userAgent.includes("npm")) {
|
|
169
|
+
result = "npm";
|
|
170
|
+
} else {
|
|
171
|
+
result = "yarn";
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
143
176
|
var pixelcss = (options = {}) => {
|
|
144
177
|
const { cwd } = options;
|
|
145
|
-
|
|
178
|
+
const packageManager = getPackageManager();
|
|
179
|
+
createConfigFile(configPath, options, packageManager);
|
|
180
|
+
console.log("Using package manager", packageManager);
|
|
146
181
|
console.log("Pixel Config (auto-generated) :", configPath);
|
|
147
182
|
return {
|
|
148
183
|
postcssPlugin: PLUGIN_NAME,
|
package/dist/index.mjs
CHANGED
|
@@ -50,9 +50,7 @@ var init_default_config = __esm({
|
|
|
50
50
|
preflight: true,
|
|
51
51
|
presets: ["@mekari/pixel3-theme"],
|
|
52
52
|
include: [
|
|
53
|
-
"./src/**/*.{js,jsx,ts,tsx,vue}"
|
|
54
|
-
"./node_modules/@mekari/**/dist/**/*.{js,mjs}"
|
|
55
|
-
// Need to analyze usage of children component, MpFlex, and Pixel tag.
|
|
53
|
+
"./src/**/*.{js,jsx,ts,tsx,vue}"
|
|
56
54
|
],
|
|
57
55
|
exclude: [],
|
|
58
56
|
layers: {
|
|
@@ -78,28 +76,49 @@ var init_default_config = __esm({
|
|
|
78
76
|
});
|
|
79
77
|
|
|
80
78
|
// src/create-config.ts
|
|
79
|
+
function findRealModulePath(moduleName) {
|
|
80
|
+
try {
|
|
81
|
+
const symlinkPath = path.join("node_modules", moduleName);
|
|
82
|
+
const realPath = fs.realpathSync(symlinkPath);
|
|
83
|
+
return realPath;
|
|
84
|
+
} catch (error) {
|
|
85
|
+
console.error("Error finding real module path:", error);
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
81
89
|
function mergeConfig(obj1, obj2) {
|
|
82
90
|
const mergeKey = ["include", "exclude"];
|
|
83
91
|
const tempObj = {};
|
|
92
|
+
const hasReplaceConfig = obj2.replaceConfig?.length > 0;
|
|
84
93
|
mergeKey.map((item) => {
|
|
85
94
|
if (obj2.hasOwnProperty(item)) {
|
|
86
95
|
if (item === "staticCss") {
|
|
87
96
|
tempObj[item] = obj2[item];
|
|
88
97
|
return;
|
|
89
98
|
}
|
|
99
|
+
if (hasReplaceConfig && obj2.replaceConfig.includes(item)) {
|
|
100
|
+
tempObj[item] = obj2[item];
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
90
103
|
tempObj[item] = [...obj1[item], ...obj2[item]];
|
|
91
104
|
}
|
|
92
105
|
});
|
|
93
106
|
return { ...obj1, ...tempObj };
|
|
94
107
|
}
|
|
95
|
-
var fs, defaultConfig2, createConfigFile;
|
|
108
|
+
var fs, path, defaultConfig2, createConfigFile;
|
|
96
109
|
var init_create_config = __esm({
|
|
97
110
|
"src/create-config.ts"() {
|
|
98
111
|
"use strict";
|
|
99
112
|
init_esm_shims();
|
|
100
113
|
fs = __require("fs");
|
|
114
|
+
path = __require("path");
|
|
101
115
|
({ defaultConfig: defaultConfig2 } = (init_default_config(), __toCommonJS(default_config_exports)));
|
|
102
|
-
createConfigFile = (filePath, options) => {
|
|
116
|
+
createConfigFile = (filePath, options, packageManager) => {
|
|
117
|
+
const restDefaultConfig = defaultConfig2;
|
|
118
|
+
if (packageManager) {
|
|
119
|
+
const pixelDir = path.dirname(findRealModulePath("@mekari/pixel3"));
|
|
120
|
+
restDefaultConfig.include.push(`${pixelDir}/**/dist/**/*.{js,mjs}`);
|
|
121
|
+
}
|
|
103
122
|
const configs = mergeConfig(defaultConfig2, options);
|
|
104
123
|
const data = "export default" + JSON.stringify(configs, null, 2);
|
|
105
124
|
try {
|
|
@@ -114,10 +133,24 @@ var init_create_config = __esm({
|
|
|
114
133
|
// src/index.ts
|
|
115
134
|
import { Builder } from "@pandacss/node";
|
|
116
135
|
import { createRequire } from "module";
|
|
117
|
-
import
|
|
136
|
+
import path2 from "path";
|
|
118
137
|
function isValidCss(file) {
|
|
119
138
|
const [filePath] = file.split("?");
|
|
120
|
-
return
|
|
139
|
+
return path2.extname(filePath) === ".css";
|
|
140
|
+
}
|
|
141
|
+
function getPackageManager() {
|
|
142
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
143
|
+
let result = "";
|
|
144
|
+
if (userAgent) {
|
|
145
|
+
if (userAgent.includes("pnpm")) {
|
|
146
|
+
result = "pnpm";
|
|
147
|
+
} else if (userAgent.includes("npm")) {
|
|
148
|
+
result = "npm";
|
|
149
|
+
} else {
|
|
150
|
+
result = "yarn";
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return result;
|
|
121
154
|
}
|
|
122
155
|
var require2, tmp, PLUGIN_NAME, tmpobj, configPath, builder, nodeModulesRegex, shouldSkip, pixelcss, src_default;
|
|
123
156
|
var init_src = __esm({
|
|
@@ -144,7 +177,9 @@ var init_src = __esm({
|
|
|
144
177
|
};
|
|
145
178
|
pixelcss = (options = {}) => {
|
|
146
179
|
const { cwd } = options;
|
|
147
|
-
|
|
180
|
+
const packageManager = getPackageManager();
|
|
181
|
+
createConfigFile(configPath, options, packageManager);
|
|
182
|
+
console.log("Using package manager", packageManager);
|
|
148
183
|
console.log("Pixel Config (auto-generated) :", configPath);
|
|
149
184
|
return {
|
|
150
185
|
postcssPlugin: PLUGIN_NAME,
|