@dsai-io/tools 1.2.4 → 1.3.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/README.md +5 -1
- package/dist/cli/index.cjs +164 -24
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +164 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +32 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +32 -19
- package/dist/index.js.map +1 -1
- package/package.json +112 -112
package/dist/index.cjs
CHANGED
|
@@ -1482,7 +1482,7 @@ var init_optimizer = __esm({
|
|
|
1482
1482
|
});
|
|
1483
1483
|
|
|
1484
1484
|
// src/version.ts
|
|
1485
|
-
var version = "
|
|
1485
|
+
var version = "1.3.0";
|
|
1486
1486
|
var logLevelSchema = zod.z.enum(["silent", "error", "warn", "info", "debug", "verbose"]);
|
|
1487
1487
|
var outputFormatSchema = zod.z.enum(["css", "scss", "less", "json", "js", "ts", "esm", "cjs"]);
|
|
1488
1488
|
var frameworkSchema = zod.z.enum(["react", "vue", "angular", "svelte", "vanilla"]);
|
|
@@ -9834,7 +9834,7 @@ function analyzeImports(files, knownNpmDeps) {
|
|
|
9834
9834
|
importPattern.lastIndex = 0;
|
|
9835
9835
|
while ((m = importPattern.exec(file.content)) !== null) {
|
|
9836
9836
|
const specifier = m[1] ?? "";
|
|
9837
|
-
const typesPattern =
|
|
9837
|
+
const typesPattern = /^\.\.\/\.\.\/types(?:\/.*)?$/;
|
|
9838
9838
|
if (typesPattern.test(specifier)) {
|
|
9839
9839
|
registryDeps.add("dsai-types");
|
|
9840
9840
|
continue;
|
|
@@ -9854,6 +9854,16 @@ function analyzeImports(files, knownNpmDeps) {
|
|
|
9854
9854
|
if (regName) registryDeps.add(regName);
|
|
9855
9855
|
continue;
|
|
9856
9856
|
}
|
|
9857
|
+
const siblingUtilPattern = /^\.\.\/([a-z][\w-]*)(?:\/.*)?$/;
|
|
9858
|
+
const siblingUtilMatch = siblingUtilPattern.exec(specifier);
|
|
9859
|
+
if (siblingUtilMatch && siblingUtilMatch[1]) {
|
|
9860
|
+
const siblingDir = siblingUtilMatch[1];
|
|
9861
|
+
const regName = UTIL_SUBPATH_TO_REGISTRY[siblingDir];
|
|
9862
|
+
if (regName) {
|
|
9863
|
+
registryDeps.add(regName);
|
|
9864
|
+
continue;
|
|
9865
|
+
}
|
|
9866
|
+
}
|
|
9857
9867
|
const compPattern = /^\.\.\/(\.\.\/)?(?:components\/)?([A-Z]\w+)(?:\/.*)?$/;
|
|
9858
9868
|
const compMatch = compPattern.exec(specifier);
|
|
9859
9869
|
if (compMatch && compMatch[2]) {
|
|
@@ -9997,6 +10007,8 @@ function buildTypesItem(reactSrcDir, log) {
|
|
|
9997
10007
|
const files = sourceFiles.map((f) => {
|
|
9998
10008
|
let content = f.content;
|
|
9999
10009
|
content = content.replace(/export \{[^}]*\} from ['"]\.\.\/utils\/[^'"]+['"];?\n?/g, "");
|
|
10010
|
+
content = content.replace(/export\s+(?!type)\{[^}]*\}\s+from\s+['"]\.\/[^'"]+['"];?\n?/g, "");
|
|
10011
|
+
content = content.replace(/\/\*\*\s*\n\s*\*\s*@deprecated[^*]*\*\/\s*\n/g, "");
|
|
10000
10012
|
return {
|
|
10001
10013
|
path: `types/${f.path}`,
|
|
10002
10014
|
type: "registry:type",
|
|
@@ -10173,7 +10185,7 @@ function transformImports(content, options) {
|
|
|
10173
10185
|
const { aliases } = options;
|
|
10174
10186
|
let result = content;
|
|
10175
10187
|
result = result.replace(
|
|
10176
|
-
/(from\s+['"])
|
|
10188
|
+
/(from\s+['"])\.\.\/\.\.\/types(?:\/([^'"]+))?(['"])/g,
|
|
10177
10189
|
(_match, prefix, subpath, suffix) => {
|
|
10178
10190
|
if (subpath) {
|
|
10179
10191
|
return `${prefix}${aliases.importAlias}${aliases.components}/types/${subpath}${suffix}`;
|
|
@@ -10181,6 +10193,18 @@ function transformImports(content, options) {
|
|
|
10181
10193
|
return `${prefix}${aliases.importAlias}${aliases.components}/types${suffix}`;
|
|
10182
10194
|
}
|
|
10183
10195
|
);
|
|
10196
|
+
result = result.replace(
|
|
10197
|
+
/(from\s+['"])\.\.\/\.\.\/hooks\/(\w+)(['"])/g,
|
|
10198
|
+
`$1${aliases.importAlias}${aliases.hooks}/$2$3`
|
|
10199
|
+
);
|
|
10200
|
+
result = result.replace(
|
|
10201
|
+
/(from\s+['"])\.\.\/\.\.\/utils\/(\w+(?:\/\w+)?)(['"])/g,
|
|
10202
|
+
`$1${aliases.importAlias}${aliases.utils}/$2$3`
|
|
10203
|
+
);
|
|
10204
|
+
result = result.replace(
|
|
10205
|
+
/(from\s+['"])\.\.\/\.\.\/utils(['"])/g,
|
|
10206
|
+
`$1${aliases.importAlias}${aliases.utils}$2`
|
|
10207
|
+
);
|
|
10184
10208
|
result = result.replace(
|
|
10185
10209
|
/(from\s+['"])\.\.\/(([A-Z]\w+)(\/[^'"]+)?)(['"])/g,
|
|
10186
10210
|
(_match, prefix, _fullPath, dirName, subPath, suffix) => {
|
|
@@ -10191,18 +10215,6 @@ function transformImports(content, options) {
|
|
|
10191
10215
|
return `${prefix}${aliases.importAlias}${aliases.ui}/${kebab}${suffix}`;
|
|
10192
10216
|
}
|
|
10193
10217
|
);
|
|
10194
|
-
result = result.replace(
|
|
10195
|
-
/(from\s+['"])(?:\.\.\/)+hooks\/(\w+)(['"])/g,
|
|
10196
|
-
`$1${aliases.importAlias}${aliases.hooks}/$2$3`
|
|
10197
|
-
);
|
|
10198
|
-
result = result.replace(
|
|
10199
|
-
/(from\s+['"])(?:\.\.\/)+utils\/(\w+(?:\/\w+)?)(['"])/g,
|
|
10200
|
-
`$1${aliases.importAlias}${aliases.utils}/$2$3`
|
|
10201
|
-
);
|
|
10202
|
-
result = result.replace(
|
|
10203
|
-
/(from\s+['"])(?:\.\.\/)+utils(['"])/g,
|
|
10204
|
-
`$1${aliases.importAlias}${aliases.utils}$2`
|
|
10205
|
-
);
|
|
10206
10218
|
return result;
|
|
10207
10219
|
}
|
|
10208
10220
|
function normalizeExtensions(content, tsx) {
|
|
@@ -10256,16 +10268,17 @@ function writeRegistryItems(tree, options) {
|
|
|
10256
10268
|
for (const item of tree.items) {
|
|
10257
10269
|
const targetBaseDir = getTargetDir(item.type, aliases);
|
|
10258
10270
|
for (const file of item.files) {
|
|
10259
|
-
const fileName = path2.basename(file.path);
|
|
10260
10271
|
let targetPath;
|
|
10261
10272
|
if (file.target) {
|
|
10262
10273
|
targetPath = path2.join(projectDir, file.target);
|
|
10263
10274
|
} else if (item.type === "registry:ui" || item.type === "registry:component") {
|
|
10264
|
-
targetPath = path2.join(projectDir, targetBaseDir, item.name,
|
|
10265
|
-
} else if (item.type === "registry:
|
|
10275
|
+
targetPath = path2.join(projectDir, targetBaseDir, item.name, path2.basename(file.path));
|
|
10276
|
+
} else if (item.type === "registry:hook") {
|
|
10277
|
+
targetPath = path2.join(projectDir, targetBaseDir, item.name, path2.basename(file.path));
|
|
10278
|
+
} else if (file.path.includes("/")) {
|
|
10266
10279
|
targetPath = path2.join(projectDir, targetBaseDir, file.path);
|
|
10267
10280
|
} else {
|
|
10268
|
-
targetPath = path2.join(projectDir, targetBaseDir,
|
|
10281
|
+
targetPath = path2.join(projectDir, targetBaseDir, path2.basename(file.path));
|
|
10269
10282
|
}
|
|
10270
10283
|
if (fs3.existsSync(targetPath) && !shouldOverwrite) {
|
|
10271
10284
|
if (log) log(` Skipped (exists): ${targetPath}`);
|