@solid-stack/mason 1.0.16 → 1.0.18
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/bin.cjs +184 -9
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +184 -9
- package/dist/bin.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/commands/import.d.ts +12 -2
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/index.cjs +184 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +184 -9
- package/dist/index.js.map +1 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/registry.d.ts.map +1 -1
- package/package.json +1 -1
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,
|
|
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"}
|
|
@@ -5,7 +5,9 @@ export interface ImportFlags {
|
|
|
5
5
|
yes?: boolean;
|
|
6
6
|
registry?: string;
|
|
7
7
|
skipInstall?: boolean;
|
|
8
|
-
alias?: Record<string, string
|
|
8
|
+
alias?: Record<string, string> | string | string[];
|
|
9
|
+
pointTo?: Record<string, string> | string | string[];
|
|
10
|
+
useExisting?: Record<string, string> | string | string[];
|
|
9
11
|
[key: string]: any;
|
|
10
12
|
}
|
|
11
13
|
export declare const importPrompts: {
|
|
@@ -22,12 +24,20 @@ export declare function rewriteImports(content: string, aliasMap: Map<string, st
|
|
|
22
24
|
*/
|
|
23
25
|
export declare function getModuleBaseDir(projectRoot: string, modType: "shared" | "feature"): string;
|
|
24
26
|
/**
|
|
25
|
-
* Resolves the existing directory path for a module in the project, checking
|
|
27
|
+
* Resolves the existing directory path for a module in the project, checking configured dirs, src/<folder>/<name>, and <folder>/<name>.
|
|
26
28
|
*/
|
|
27
29
|
export declare function getExistingModuleDir(projectRoot: string, modType: "shared" | "feature", modName: string): string | null;
|
|
28
30
|
/**
|
|
29
31
|
* Check whether a module already exists in the project (checking both src/<folder>/<name> and <folder>/<name>)
|
|
30
32
|
*/
|
|
31
33
|
export declare function checkModuleExists(projectRoot: string, modType: "shared" | "feature", modName: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* List all available local module names for a given type (checking configured dir, src/<folder>, and <folder>)
|
|
36
|
+
*/
|
|
37
|
+
export declare function getAvailableLocalModules(projectRoot: string, modType: "shared" | "feature"): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Helper to parse mapping flags like { time: "mytime" } or "time:mytime" or ["time:mytime"]
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseMappingFlags(raw: any): Record<string, string>;
|
|
32
42
|
export declare function handleImport(typeArg?: string, nameArg?: string, flags?: ImportFlags): Promise<void>;
|
|
33
43
|
//# sourceMappingURL=import.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../src/commands/import.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;
|
|
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,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;IACzD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,aAAa;IACxB,MAAM;IACN,IAAI;CACL,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAerF;AAED;;GAEG;AACH,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,CA0iBf"}
|
package/dist/index.cjs
CHANGED
|
@@ -176,7 +176,7 @@ function getEffectiveMode(projectRoot, flags) {
|
|
|
176
176
|
if (flags?.registry) return "registry";
|
|
177
177
|
const config = loadMasonConfig(projectRoot);
|
|
178
178
|
if (config?.mode) return config.mode;
|
|
179
|
-
if (fs4__default.default.existsSync(path2__default.default.join(projectRoot, "index.json")) && (fs4__default.default.existsSync(path2__default.default.join(projectRoot, "features")) || fs4__default.default.existsSync(path2__default.default.join(projectRoot, "shared")))
|
|
179
|
+
if (fs4__default.default.existsSync(path2__default.default.join(projectRoot, "index.json")) && (fs4__default.default.existsSync(path2__default.default.join(projectRoot, "features")) || fs4__default.default.existsSync(path2__default.default.join(projectRoot, "shared")) || fs4__default.default.existsSync(path2__default.default.join(projectRoot, "src/features")) || fs4__default.default.existsSync(path2__default.default.join(projectRoot, "src/shared")))) {
|
|
180
180
|
return "registry";
|
|
181
181
|
}
|
|
182
182
|
return "app";
|
|
@@ -190,6 +190,9 @@ function getConfiguredFeaturesDir(projectRoot, flags) {
|
|
|
190
190
|
}
|
|
191
191
|
const mode = getEffectiveMode(projectRoot, flags);
|
|
192
192
|
if (mode === "registry") {
|
|
193
|
+
if (fs4__default.default.existsSync(path2__default.default.join(projectRoot, "src/features"))) {
|
|
194
|
+
return path2__default.default.join(projectRoot, "src/features");
|
|
195
|
+
}
|
|
193
196
|
return path2__default.default.join(projectRoot, "features");
|
|
194
197
|
}
|
|
195
198
|
if (fs4__default.default.existsSync(path2__default.default.join(projectRoot, "src/features"))) {
|
|
@@ -206,6 +209,9 @@ function getConfiguredSharedDir(projectRoot, flags) {
|
|
|
206
209
|
}
|
|
207
210
|
const mode = getEffectiveMode(projectRoot, flags);
|
|
208
211
|
if (mode === "registry") {
|
|
212
|
+
if (fs4__default.default.existsSync(path2__default.default.join(projectRoot, "src/shared"))) {
|
|
213
|
+
return path2__default.default.join(projectRoot, "src/shared");
|
|
214
|
+
}
|
|
209
215
|
return path2__default.default.join(projectRoot, "shared");
|
|
210
216
|
}
|
|
211
217
|
if (fs4__default.default.existsSync(path2__default.default.join(projectRoot, "src/shared"))) {
|
|
@@ -512,7 +518,14 @@ async function fetchRegistryFile(registryBase, relPath) {
|
|
|
512
518
|
if (token) {
|
|
513
519
|
headers["Authorization"] = `Bearer ${token}`;
|
|
514
520
|
}
|
|
515
|
-
|
|
521
|
+
let res = await fetch(url, { headers });
|
|
522
|
+
if (!res.ok && res.status === 404 && !cleanRelPath.startsWith("src/")) {
|
|
523
|
+
const srcUrl = `${registryBase.replace(/\/+$/, "")}/src/${cleanRelPath}`;
|
|
524
|
+
const srcRes = await fetch(srcUrl, { headers });
|
|
525
|
+
if (srcRes.ok) {
|
|
526
|
+
res = srcRes;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
516
529
|
if (!res.ok) {
|
|
517
530
|
let extraHint = "";
|
|
518
531
|
if (res.status === 404) {
|
|
@@ -532,9 +545,14 @@ async function fetchRegistryFile(registryBase, relPath) {
|
|
|
532
545
|
if (baseDir.startsWith("file://")) {
|
|
533
546
|
baseDir = url.fileURLToPath(baseDir);
|
|
534
547
|
}
|
|
535
|
-
|
|
548
|
+
let filePath = path2__default.default.resolve(baseDir, cleanRelPath);
|
|
536
549
|
if (!fs4__default.default.existsSync(filePath)) {
|
|
537
|
-
|
|
550
|
+
const inSrcPath = path2__default.default.resolve(baseDir, "src", cleanRelPath);
|
|
551
|
+
if (fs4__default.default.existsSync(inSrcPath)) {
|
|
552
|
+
filePath = inSrcPath;
|
|
553
|
+
} else {
|
|
554
|
+
throw new Error(`Registry file not found at ${filePath}`);
|
|
555
|
+
}
|
|
538
556
|
}
|
|
539
557
|
return fs4__default.default.promises.readFile(filePath, "utf-8");
|
|
540
558
|
}
|
|
@@ -3629,11 +3647,18 @@ function rewriteImports(content, aliasMap) {
|
|
|
3629
3647
|
return rewritten;
|
|
3630
3648
|
}
|
|
3631
3649
|
function getModuleBaseDir(projectRoot, modType) {
|
|
3650
|
+
const mode = getEffectiveMode(projectRoot);
|
|
3651
|
+
if (mode === "registry") {
|
|
3652
|
+
return modType === "shared" ? getConfiguredSharedDir(projectRoot) : getConfiguredFeaturesDir(projectRoot);
|
|
3653
|
+
}
|
|
3632
3654
|
const folder = modType === "shared" ? "shared" : "features";
|
|
3633
3655
|
return path2__default.default.join(projectRoot, "src", folder);
|
|
3634
3656
|
}
|
|
3635
3657
|
function getExistingModuleDir(projectRoot, modType, modName) {
|
|
3636
3658
|
const folder = modType === "shared" ? "shared" : "features";
|
|
3659
|
+
const configuredDir = modType === "shared" ? getConfiguredSharedDir(projectRoot) : getConfiguredFeaturesDir(projectRoot);
|
|
3660
|
+
const inConfigured = path2__default.default.join(configuredDir, modName);
|
|
3661
|
+
if (fs4__default.default.existsSync(inConfigured)) return inConfigured;
|
|
3637
3662
|
const inSrc = path2__default.default.join(projectRoot, "src", folder, modName);
|
|
3638
3663
|
if (fs4__default.default.existsSync(inSrc)) return inSrc;
|
|
3639
3664
|
const inRoot = path2__default.default.join(projectRoot, folder, modName);
|
|
@@ -3643,6 +3668,50 @@ function getExistingModuleDir(projectRoot, modType, modName) {
|
|
|
3643
3668
|
function checkModuleExists(projectRoot, modType, modName) {
|
|
3644
3669
|
return getExistingModuleDir(projectRoot, modType, modName) !== null;
|
|
3645
3670
|
}
|
|
3671
|
+
function getAvailableLocalModules(projectRoot, modType) {
|
|
3672
|
+
const folder = modType === "shared" ? "shared" : "features";
|
|
3673
|
+
const configuredDir = modType === "shared" ? getConfiguredSharedDir(projectRoot) : getConfiguredFeaturesDir(projectRoot);
|
|
3674
|
+
const dirs = [
|
|
3675
|
+
configuredDir,
|
|
3676
|
+
path2__default.default.join(projectRoot, "src", folder),
|
|
3677
|
+
path2__default.default.join(projectRoot, folder)
|
|
3678
|
+
];
|
|
3679
|
+
const set = /* @__PURE__ */ new Set();
|
|
3680
|
+
for (const dir of dirs) {
|
|
3681
|
+
if (fs4__default.default.existsSync(dir)) {
|
|
3682
|
+
try {
|
|
3683
|
+
const entries = fs4__default.default.readdirSync(dir, { withFileTypes: true });
|
|
3684
|
+
for (const e of entries) {
|
|
3685
|
+
if (e.isDirectory() && !e.name.startsWith(".")) {
|
|
3686
|
+
set.add(e.name);
|
|
3687
|
+
}
|
|
3688
|
+
}
|
|
3689
|
+
} catch {
|
|
3690
|
+
}
|
|
3691
|
+
}
|
|
3692
|
+
}
|
|
3693
|
+
return Array.from(set).sort();
|
|
3694
|
+
}
|
|
3695
|
+
function parseMappingFlags(raw) {
|
|
3696
|
+
if (!raw) return {};
|
|
3697
|
+
if (typeof raw === "object" && !Array.isArray(raw)) return raw;
|
|
3698
|
+
const result = {};
|
|
3699
|
+
const entries = Array.isArray(raw) ? raw : [raw];
|
|
3700
|
+
for (const entry of entries) {
|
|
3701
|
+
if (typeof entry === "string") {
|
|
3702
|
+
const idx = entry.indexOf(":");
|
|
3703
|
+
if (idx !== -1) {
|
|
3704
|
+
let key = entry.slice(0, idx).trim();
|
|
3705
|
+
let val = entry.slice(idx + 1).trim();
|
|
3706
|
+
val = val.replace(/^@\/(shared|features)\//, "").replace(/^(src\/)?(shared|features)\//, "").replace(/^\/+|\/+$/g, "").trim();
|
|
3707
|
+
if (key && val) {
|
|
3708
|
+
result[key] = val;
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
}
|
|
3713
|
+
return result;
|
|
3714
|
+
}
|
|
3646
3715
|
async function handleImport(typeArg, nameArg, flags = {}) {
|
|
3647
3716
|
const projectRoot = findProjectRoot();
|
|
3648
3717
|
let type = typeArg?.trim().toLowerCase();
|
|
@@ -3763,7 +3832,8 @@ async function handleImport(typeArg, nameArg, flags = {}) {
|
|
|
3763
3832
|
const { type: modType, name: registryName, manifest } = node;
|
|
3764
3833
|
const folder = modType === "shared" ? "shared" : "features";
|
|
3765
3834
|
if (key === rootKey) {
|
|
3766
|
-
const
|
|
3835
|
+
const aliasMap2 = parseMappingFlags(flags.alias);
|
|
3836
|
+
const programmaticAlias2 = aliasMap2[registryName] || aliasMap2[`${modType}/${registryName}`];
|
|
3767
3837
|
const targetName = programmaticAlias2 || registryName;
|
|
3768
3838
|
if (targetName !== registryName) {
|
|
3769
3839
|
globalAliasMap.set(`@/${folder}/${registryName}/`, `@/${folder}/${targetName}/`);
|
|
@@ -3778,7 +3848,36 @@ async function handleImport(typeArg, nameArg, flags = {}) {
|
|
|
3778
3848
|
});
|
|
3779
3849
|
continue;
|
|
3780
3850
|
}
|
|
3781
|
-
const
|
|
3851
|
+
const aliasMap = parseMappingFlags(flags.alias);
|
|
3852
|
+
const pointToMap = {
|
|
3853
|
+
...parseMappingFlags(flags.pointTo),
|
|
3854
|
+
...parseMappingFlags(flags["point-to"]),
|
|
3855
|
+
...parseMappingFlags(flags.useExisting),
|
|
3856
|
+
...parseMappingFlags(flags["use-existing"])
|
|
3857
|
+
};
|
|
3858
|
+
const programmaticPointTo = pointToMap[registryName] || pointToMap[`${modType}/${registryName}`];
|
|
3859
|
+
if (programmaticPointTo) {
|
|
3860
|
+
if (!checkModuleExists(projectRoot, modType, programmaticPointTo)) {
|
|
3861
|
+
p14__namespace.log.error(
|
|
3862
|
+
pc14__default.default.red(
|
|
3863
|
+
`Module '${programmaticPointTo}' specified in --point-to does not exist in ${folder}.`
|
|
3864
|
+
)
|
|
3865
|
+
);
|
|
3866
|
+
process.exit(1);
|
|
3867
|
+
}
|
|
3868
|
+
globalAliasMap.set(`@/${folder}/${registryName}/`, `@/${folder}/${programmaticPointTo}/`);
|
|
3869
|
+
globalAliasMap.set(`@/${folder}/${registryName}`, `@/${folder}/${programmaticPointTo}`);
|
|
3870
|
+
p14__namespace.log.step(`Pointing '${modType}/${registryName}' to existing '${folder}/${programmaticPointTo}'`);
|
|
3871
|
+
resolutions.set(key, {
|
|
3872
|
+
type: modType,
|
|
3873
|
+
registryName,
|
|
3874
|
+
targetName: programmaticPointTo,
|
|
3875
|
+
action: "reuse",
|
|
3876
|
+
manifest
|
|
3877
|
+
});
|
|
3878
|
+
continue;
|
|
3879
|
+
}
|
|
3880
|
+
const programmaticAlias = aliasMap[registryName] || aliasMap[`${modType}/${registryName}`];
|
|
3782
3881
|
if (programmaticAlias) {
|
|
3783
3882
|
globalAliasMap.set(`@/${folder}/${registryName}/`, `@/${folder}/${programmaticAlias}/`);
|
|
3784
3883
|
globalAliasMap.set(`@/${folder}/${registryName}`, `@/${folder}/${programmaticAlias}`);
|
|
@@ -3852,6 +3951,10 @@ async function handleImport(typeArg, nameArg, flags = {}) {
|
|
|
3852
3951
|
value: "keep_existing",
|
|
3853
3952
|
label: `Keep existing local version (Recommended)`
|
|
3854
3953
|
},
|
|
3954
|
+
{
|
|
3955
|
+
value: "point_existing",
|
|
3956
|
+
label: `Point to another existing ${modType} module`
|
|
3957
|
+
},
|
|
3855
3958
|
{
|
|
3856
3959
|
value: "rename",
|
|
3857
3960
|
label: "Import fresh copy under a new name (alias)"
|
|
@@ -3874,6 +3977,78 @@ async function handleImport(typeArg, nameArg, flags = {}) {
|
|
|
3874
3977
|
});
|
|
3875
3978
|
continue;
|
|
3876
3979
|
}
|
|
3980
|
+
if (choice === "point_existing" || choice === "point_to_existing") {
|
|
3981
|
+
const candidates = getAvailableLocalModules(projectRoot, modType).filter(
|
|
3982
|
+
(m) => m !== registryName
|
|
3983
|
+
);
|
|
3984
|
+
let chosenName;
|
|
3985
|
+
if (candidates.length > 0) {
|
|
3986
|
+
const selection = handleCancel(
|
|
3987
|
+
await importPrompts.select({
|
|
3988
|
+
message: `Select an existing ${modType} module to point to:`,
|
|
3989
|
+
options: [
|
|
3990
|
+
...candidates.map((m) => ({
|
|
3991
|
+
value: m,
|
|
3992
|
+
label: m
|
|
3993
|
+
})),
|
|
3994
|
+
{
|
|
3995
|
+
value: "__custom__",
|
|
3996
|
+
label: "Enter name manually..."
|
|
3997
|
+
}
|
|
3998
|
+
]
|
|
3999
|
+
})
|
|
4000
|
+
);
|
|
4001
|
+
if (selection === "__custom__") {
|
|
4002
|
+
chosenName = handleCancel(
|
|
4003
|
+
await importPrompts.text({
|
|
4004
|
+
message: `Enter the name of the existing ${modType} module:`,
|
|
4005
|
+
placeholder: `my${registryName}`,
|
|
4006
|
+
validate(val) {
|
|
4007
|
+
const v = val?.trim();
|
|
4008
|
+
if (!v) return "Name cannot be empty";
|
|
4009
|
+
if (v === registryName) {
|
|
4010
|
+
return `Name must be different from '${registryName}' (or select 'Keep existing local version')`;
|
|
4011
|
+
}
|
|
4012
|
+
if (!checkModuleExists(projectRoot, modType, v)) {
|
|
4013
|
+
return `'${v}' does not exist in ${folder}`;
|
|
4014
|
+
}
|
|
4015
|
+
}
|
|
4016
|
+
})
|
|
4017
|
+
).trim();
|
|
4018
|
+
} else {
|
|
4019
|
+
chosenName = selection;
|
|
4020
|
+
}
|
|
4021
|
+
} else {
|
|
4022
|
+
chosenName = handleCancel(
|
|
4023
|
+
await importPrompts.text({
|
|
4024
|
+
message: `Enter the name of the existing ${modType} module:`,
|
|
4025
|
+
placeholder: `my${registryName}`,
|
|
4026
|
+
validate(val) {
|
|
4027
|
+
const v = val?.trim();
|
|
4028
|
+
if (!v) return "Name cannot be empty";
|
|
4029
|
+
if (v === registryName) {
|
|
4030
|
+
return `Name must be different from '${registryName}' (or select 'Keep existing local version')`;
|
|
4031
|
+
}
|
|
4032
|
+
if (!checkModuleExists(projectRoot, modType, v)) {
|
|
4033
|
+
return `'${v}' does not exist in ${folder}`;
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4036
|
+
})
|
|
4037
|
+
).trim();
|
|
4038
|
+
}
|
|
4039
|
+
chosenName = chosenName.replace(/^@\/(shared|features)\//, "").replace(/^(src\/)?(shared|features)\//, "").replace(/^\/+|\/+$/g, "").trim();
|
|
4040
|
+
globalAliasMap.set(`@/${folder}/${registryName}/`, `@/${folder}/${chosenName}/`);
|
|
4041
|
+
globalAliasMap.set(`@/${folder}/${registryName}`, `@/${folder}/${chosenName}`);
|
|
4042
|
+
p14__namespace.log.step(`Pointing '${modType}/${registryName}' to existing '${folder}/${chosenName}'`);
|
|
4043
|
+
resolutions.set(key, {
|
|
4044
|
+
type: modType,
|
|
4045
|
+
registryName,
|
|
4046
|
+
targetName: chosenName,
|
|
4047
|
+
action: "reuse",
|
|
4048
|
+
manifest
|
|
4049
|
+
});
|
|
4050
|
+
continue;
|
|
4051
|
+
}
|
|
3877
4052
|
if (choice === "rename") {
|
|
3878
4053
|
const newName = handleCancel(
|
|
3879
4054
|
await importPrompts.text({
|
|
@@ -4001,7 +4176,7 @@ async function handleImport(typeArg, nameArg, flags = {}) {
|
|
|
4001
4176
|
// src/cli.ts
|
|
4002
4177
|
function createCli() {
|
|
4003
4178
|
const cli = cac.cac("mason");
|
|
4004
|
-
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").action(async (args, flags) => {
|
|
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) => {
|
|
4005
4180
|
if (args && args.length > 0) {
|
|
4006
4181
|
p14__namespace.log.error(
|
|
4007
4182
|
pc14__default.default.red(
|
|
@@ -4096,7 +4271,7 @@ function createCli() {
|
|
|
4096
4271
|
cli.command(
|
|
4097
4272
|
"import [type] [name]",
|
|
4098
4273
|
"Import pre-built shared modules or features from the Solid Stack Registry"
|
|
4099
|
-
).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").example("mason import shared hasher").example("mason import feature authn").example("mason import shared").example("mason import feature").action(async (type, name, flags = {}) => {
|
|
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 = {}) => {
|
|
4100
4275
|
try {
|
|
4101
4276
|
await handleImport(type, name, flags);
|
|
4102
4277
|
} catch (err) {
|
|
@@ -4126,7 +4301,7 @@ function createCli() {
|
|
|
4126
4301
|
});
|
|
4127
4302
|
}
|
|
4128
4303
|
cli.help();
|
|
4129
|
-
cli.version("1.0.
|
|
4304
|
+
cli.version("1.0.18");
|
|
4130
4305
|
return cli;
|
|
4131
4306
|
}
|
|
4132
4307
|
function handleCliError(err) {
|