@dsai-io/tools 1.2.5 → 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/dist/index.d.cts CHANGED
@@ -8,7 +8,7 @@ import { z } from 'zod';
8
8
  /**
9
9
  * Package version
10
10
  */
11
- declare const version = "0.0.1";
11
+ declare const version = "1.3.0";
12
12
 
13
13
  /**
14
14
  * Registry type definitions for DSAi component distribution.
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import { z } from 'zod';
8
8
  /**
9
9
  * Package version
10
10
  */
11
- declare const version = "0.0.1";
11
+ declare const version = "1.3.0";
12
12
 
13
13
  /**
14
14
  * Registry type definitions for DSAi component distribution.
package/dist/index.js CHANGED
@@ -1456,7 +1456,7 @@ var init_optimizer = __esm({
1456
1456
  });
1457
1457
 
1458
1458
  // src/version.ts
1459
- var version = "0.0.1";
1459
+ var version = "1.3.0";
1460
1460
  var logLevelSchema = z.enum(["silent", "error", "warn", "info", "debug", "verbose"]);
1461
1461
  var outputFormatSchema = z.enum(["css", "scss", "less", "json", "js", "ts", "esm", "cjs"]);
1462
1462
  var frameworkSchema = z.enum(["react", "vue", "angular", "svelte", "vanilla"]);
@@ -9808,7 +9808,7 @@ function analyzeImports(files, knownNpmDeps) {
9808
9808
  importPattern.lastIndex = 0;
9809
9809
  while ((m = importPattern.exec(file.content)) !== null) {
9810
9810
  const specifier = m[1] ?? "";
9811
- const typesPattern = /\.\.\/(?:\.\.\/)?types(?:\/.*)?$/;
9811
+ const typesPattern = /^\.\.\/\.\.\/types(?:\/.*)?$/;
9812
9812
  if (typesPattern.test(specifier)) {
9813
9813
  registryDeps.add("dsai-types");
9814
9814
  continue;
@@ -9828,6 +9828,16 @@ function analyzeImports(files, knownNpmDeps) {
9828
9828
  if (regName) registryDeps.add(regName);
9829
9829
  continue;
9830
9830
  }
9831
+ const siblingUtilPattern = /^\.\.\/([a-z][\w-]*)(?:\/.*)?$/;
9832
+ const siblingUtilMatch = siblingUtilPattern.exec(specifier);
9833
+ if (siblingUtilMatch && siblingUtilMatch[1]) {
9834
+ const siblingDir = siblingUtilMatch[1];
9835
+ const regName = UTIL_SUBPATH_TO_REGISTRY[siblingDir];
9836
+ if (regName) {
9837
+ registryDeps.add(regName);
9838
+ continue;
9839
+ }
9840
+ }
9831
9841
  const compPattern = /^\.\.\/(\.\.\/)?(?:components\/)?([A-Z]\w+)(?:\/.*)?$/;
9832
9842
  const compMatch = compPattern.exec(specifier);
9833
9843
  if (compMatch && compMatch[2]) {
@@ -9971,6 +9981,8 @@ function buildTypesItem(reactSrcDir, log) {
9971
9981
  const files = sourceFiles.map((f) => {
9972
9982
  let content = f.content;
9973
9983
  content = content.replace(/export \{[^}]*\} from ['"]\.\.\/utils\/[^'"]+['"];?\n?/g, "");
9984
+ content = content.replace(/export\s+(?!type)\{[^}]*\}\s+from\s+['"]\.\/[^'"]+['"];?\n?/g, "");
9985
+ content = content.replace(/\/\*\*\s*\n\s*\*\s*@deprecated[^*]*\*\/\s*\n/g, "");
9974
9986
  return {
9975
9987
  path: `types/${f.path}`,
9976
9988
  type: "registry:type",
@@ -10147,7 +10159,7 @@ function transformImports(content, options) {
10147
10159
  const { aliases } = options;
10148
10160
  let result = content;
10149
10161
  result = result.replace(
10150
- /(from\s+['"])(?:\.\.\/)+types(?:\/([^'"]+))?(['"])/g,
10162
+ /(from\s+['"])\.\.\/\.\.\/types(?:\/([^'"]+))?(['"])/g,
10151
10163
  (_match, prefix, subpath, suffix) => {
10152
10164
  if (subpath) {
10153
10165
  return `${prefix}${aliases.importAlias}${aliases.components}/types/${subpath}${suffix}`;
@@ -10155,6 +10167,18 @@ function transformImports(content, options) {
10155
10167
  return `${prefix}${aliases.importAlias}${aliases.components}/types${suffix}`;
10156
10168
  }
10157
10169
  );
10170
+ result = result.replace(
10171
+ /(from\s+['"])\.\.\/\.\.\/hooks\/(\w+)(['"])/g,
10172
+ `$1${aliases.importAlias}${aliases.hooks}/$2$3`
10173
+ );
10174
+ result = result.replace(
10175
+ /(from\s+['"])\.\.\/\.\.\/utils\/(\w+(?:\/\w+)?)(['"])/g,
10176
+ `$1${aliases.importAlias}${aliases.utils}/$2$3`
10177
+ );
10178
+ result = result.replace(
10179
+ /(from\s+['"])\.\.\/\.\.\/utils(['"])/g,
10180
+ `$1${aliases.importAlias}${aliases.utils}$2`
10181
+ );
10158
10182
  result = result.replace(
10159
10183
  /(from\s+['"])\.\.\/(([A-Z]\w+)(\/[^'"]+)?)(['"])/g,
10160
10184
  (_match, prefix, _fullPath, dirName, subPath, suffix) => {
@@ -10165,18 +10189,6 @@ function transformImports(content, options) {
10165
10189
  return `${prefix}${aliases.importAlias}${aliases.ui}/${kebab}${suffix}`;
10166
10190
  }
10167
10191
  );
10168
- result = result.replace(
10169
- /(from\s+['"])(?:\.\.\/)+hooks\/(\w+)(['"])/g,
10170
- `$1${aliases.importAlias}${aliases.hooks}/$2$3`
10171
- );
10172
- result = result.replace(
10173
- /(from\s+['"])(?:\.\.\/)+utils\/(\w+(?:\/\w+)?)(['"])/g,
10174
- `$1${aliases.importAlias}${aliases.utils}/$2$3`
10175
- );
10176
- result = result.replace(
10177
- /(from\s+['"])(?:\.\.\/)+utils(['"])/g,
10178
- `$1${aliases.importAlias}${aliases.utils}$2`
10179
- );
10180
10192
  return result;
10181
10193
  }
10182
10194
  function normalizeExtensions(content, tsx) {
@@ -10230,16 +10242,17 @@ function writeRegistryItems(tree, options) {
10230
10242
  for (const item of tree.items) {
10231
10243
  const targetBaseDir = getTargetDir(item.type, aliases);
10232
10244
  for (const file of item.files) {
10233
- const fileName = basename(file.path);
10234
10245
  let targetPath;
10235
10246
  if (file.target) {
10236
10247
  targetPath = join(projectDir, file.target);
10237
10248
  } else if (item.type === "registry:ui" || item.type === "registry:component") {
10238
- targetPath = join(projectDir, targetBaseDir, item.name, fileName);
10239
- } else if (item.type === "registry:type") {
10249
+ targetPath = join(projectDir, targetBaseDir, item.name, basename(file.path));
10250
+ } else if (item.type === "registry:hook") {
10251
+ targetPath = join(projectDir, targetBaseDir, item.name, basename(file.path));
10252
+ } else if (file.path.includes("/")) {
10240
10253
  targetPath = join(projectDir, targetBaseDir, file.path);
10241
10254
  } else {
10242
- targetPath = join(projectDir, targetBaseDir, fileName);
10255
+ targetPath = join(projectDir, targetBaseDir, basename(file.path));
10243
10256
  }
10244
10257
  if (existsSync(targetPath) && !shouldOverwrite) {
10245
10258
  if (log) log(` Skipped (exists): ${targetPath}`);