@solid-stack/mason 1.0.18 → 1.0.21

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/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AASA,wBAAgB,SAAS,sBAqMxB;AAWD,wBAAsB,MAAM,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGzE"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AASA,wBAAgB,SAAS,sBAuMxB;AAWD,wBAAsB,MAAM,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGzE"}
@@ -8,12 +8,18 @@ export interface ImportFlags {
8
8
  alias?: Record<string, string> | string | string[];
9
9
  pointTo?: Record<string, string> | string | string[];
10
10
  useExisting?: Record<string, string> | string | string[];
11
+ tests?: boolean;
11
12
  [key: string]: any;
12
13
  }
13
14
  export declare const importPrompts: {
14
15
  select: <Value>(opts: p.SelectOptions<Value>) => Promise<Value | typeof p.CANCEL_SYMBOL>;
15
16
  text: (opts: p.TextOptions) => Promise<string | typeof p.CANCEL_SYMBOL>;
17
+ confirm: (opts: p.ConfirmOptions) => Promise<boolean | typeof p.CANCEL_SYMBOL>;
16
18
  };
19
+ /**
20
+ * Checks whether a given relative file path is a test file.
21
+ */
22
+ export declare function isTestFile(filePath: string): boolean;
17
23
  /**
18
24
  * Rewrite import strings across file content based on an alias mapping.
19
25
  * E.g. "@/shared/hasher/" -> "@/shared/auth-hasher/"
@@ -1 +1 @@
1
- {"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../src/commands/import.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAkBpC,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC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H,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAS3F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAYf;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,OAAO,EAAE,MAAM,GACd,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,QAAQ,GAAG,SAAS,GAC5B,MAAM,EAAE,CAwBV;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAuBlE;AAgBD,wBAAsB,YAAY,CAChC,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,GAAE,WAAgB,GACtB,OAAO,CAAC,IAAI,CAAC,CA8jBf"}
package/dist/index.cjs CHANGED
@@ -679,7 +679,7 @@ function getAllFiles(dir, baseDir = dir) {
679
679
  }
680
680
  files.push(...getAllFiles(fullPath, baseDir));
681
681
  } else if (entry.isFile()) {
682
- if (entry.name === "registry.json" || entry.name.endsWith(".test.ts") || entry.name.endsWith(".spec.ts") || entry.name.startsWith(".")) {
682
+ if (entry.name === "registry.json" || entry.name.endsWith(".test.ts") || entry.name.endsWith(".spec.ts") || entry.name.endsWith(".test.js") || entry.name.endsWith(".spec.js") || entry.name.startsWith(".")) {
683
683
  continue;
684
684
  }
685
685
  files.push(relPath);
@@ -3632,8 +3632,15 @@ async function handleCreate(type, name, flags = {}) {
3632
3632
  }
3633
3633
  var importPrompts = {
3634
3634
  select: p14__namespace.select,
3635
- text: p14__namespace.text
3635
+ text: p14__namespace.text,
3636
+ confirm: p14__namespace.confirm
3636
3637
  };
3638
+ function isTestFile(filePath) {
3639
+ const normalized = filePath.replace(/\\/g, "/");
3640
+ const parts = normalized.split("/");
3641
+ const fileName = parts[parts.length - 1] || "";
3642
+ return fileName.endsWith(".test.ts") || fileName.endsWith(".test.js") || fileName.endsWith(".spec.ts") || fileName.endsWith(".spec.js") || parts.includes("__tests__");
3643
+ }
3637
3644
  function rewriteImports(content, aliasMap) {
3638
3645
  if (aliasMap.size === 0) return content;
3639
3646
  let rewritten = content;
@@ -4100,6 +4107,22 @@ async function handleImport(typeArg, nameArg, flags = {}) {
4100
4107
  requiredNpmPackages.add(pkg);
4101
4108
  }
4102
4109
  }
4110
+ const hasTestFiles = Array.from(nodes.values()).some(
4111
+ (node) => node.manifest.files?.some((file) => isTestFile(file))
4112
+ );
4113
+ let includeTests = true;
4114
+ if (flags.tests !== void 0) {
4115
+ includeTests = Boolean(flags.tests);
4116
+ } else if (flags.yes) {
4117
+ includeTests = true;
4118
+ } else if (hasTestFiles) {
4119
+ includeTests = handleCancel(
4120
+ await importPrompts.confirm({
4121
+ message: "Include test files?",
4122
+ initialValue: true
4123
+ })
4124
+ );
4125
+ }
4103
4126
  for (const key of orderedKeys) {
4104
4127
  const res = resolutions.get(key);
4105
4128
  if (res.action === "reuse") {
@@ -4124,6 +4147,7 @@ async function handleImport(typeArg, nameArg, flags = {}) {
4124
4147
  }
4125
4148
  for (const file of res.manifest.files || []) {
4126
4149
  if (file === "registry.json") continue;
4150
+ if (!includeTests && isTestFile(file)) continue;
4127
4151
  const remoteFilePath = `${folder}/${res.registryName}/${file}`;
4128
4152
  const localFilePath = path2__default.default.join(targetDir, file);
4129
4153
  if (fs4__default.default.existsSync(localFilePath) && !isOverwrite) {
@@ -4176,7 +4200,7 @@ async function handleImport(typeArg, nameArg, flags = {}) {
4176
4200
  // src/cli.ts
4177
4201
  function createCli() {
4178
4202
  const cli = cac.cac("mason");
4179
- cli.command("[...args]", "Interactive scaffolding and import wizard").option("-d, --dry-run", "Preview changes without writing to disk").option("-o, --overwrite", "Overwrite existing files").option("-y, --yes", "Accept defaults and skip interactive prompts").option("--registry", "Run in registry mode").option("--point-to <mapping>", "Point a dependency to an existing local module (e.g. --point-to time:mytime)").option("--alias <mapping>", "Import a dependency fresh under an alias name (e.g. --alias time:time-mason)").action(async (args, flags) => {
4203
+ cli.command("[...args]", "Interactive scaffolding and import wizard").option("-d, --dry-run", "Preview changes without writing to disk").option("-o, --overwrite", "Overwrite existing files").option("-y, --yes", "Accept defaults and skip interactive prompts").option("--registry", "Run in registry mode").option("--point-to <mapping>", "Point a dependency to an existing local module (e.g. --point-to time:mytime)").option("--alias <mapping>", "Import a dependency fresh under an alias name (e.g. --alias time:time-mason)").option("--tests", "Include test files (use --no-tests to exclude)").action(async (args, flags) => {
4180
4204
  if (args && args.length > 0) {
4181
4205
  p14__namespace.log.error(
4182
4206
  pc14__default.default.red(
@@ -4271,7 +4295,7 @@ function createCli() {
4271
4295
  cli.command(
4272
4296
  "import [type] [name]",
4273
4297
  "Import pre-built shared modules or features from the Solid Stack Registry"
4274
- ).option("-o, --overwrite", "Overwrite existing files").option("-d, --dry-run", "Preview changes without writing to disk").option("-y, --yes", "Accept defaults and skip interactive prompts").option("--registry <url>", "Registry base URL or local directory").option("--skip-install", "Skip automatic package manager dependency installation").option("--point-to <mapping>", "Point a dependency to an existing local module (e.g. --point-to time:mytime)").option("--alias <mapping>", "Import a dependency fresh under an alias name (e.g. --alias time:time-mason)").example("mason import shared hasher").example("mason import feature authn").example("mason import shared").example("mason import feature").action(async (type, name, flags = {}) => {
4298
+ ).option("-o, --overwrite", "Overwrite existing files").option("-d, --dry-run", "Preview changes without writing to disk").option("-y, --yes", "Accept defaults and skip interactive prompts").option("--registry <url>", "Registry base URL or local directory").option("--skip-install", "Skip automatic package manager dependency installation").option("--point-to <mapping>", "Point a dependency to an existing local module (e.g. --point-to time:mytime)").option("--alias <mapping>", "Import a dependency fresh under an alias name (e.g. --alias time:time-mason)").option("--tests", "Include test files (use --no-tests to exclude)").example("mason import shared hasher").example("mason import feature authn").example("mason import shared").example("mason import feature").action(async (type, name, flags = {}) => {
4275
4299
  try {
4276
4300
  await handleImport(type, name, flags);
4277
4301
  } catch (err) {
@@ -4301,7 +4325,7 @@ function createCli() {
4301
4325
  });
4302
4326
  }
4303
4327
  cli.help();
4304
- cli.version("1.0.18");
4328
+ cli.version("1.0.19");
4305
4329
  return cli;
4306
4330
  }
4307
4331
  function handleCliError(err) {