wp-typia 0.22.8 → 0.22.10
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-bunli/.bunli/commands.gen.js +3522 -3250
- package/dist-bunli/{cli-pnjx2e2h.js → cli-1k61xyn2.js} +14 -9
- package/dist-bunli/{cli-arz4rcye.js → cli-2mswafd6.js} +6 -6
- package/dist-bunli/{cli-fa7g1aqm.js → cli-2x49egkd.js} +52 -58
- package/dist-bunli/{cli-bbj0kn1e.js → cli-3fzqhpx9.js} +477 -455
- package/dist-bunli/{cli-mzvzbpnz.js → cli-8reep89s.js} +5 -27
- package/dist-bunli/{cli-add-1xvw17yg.js → cli-add-8rvmezy0.js} +37 -21
- package/dist-bunli/cli-cvxvcw7c.js +46 -0
- package/dist-bunli/{cli-doctor-bjv6z74k.js → cli-doctor-5m6xyx9q.js} +8 -7
- package/dist-bunli/{cli-init-zdfrmp3y.js → cli-init-qv3zxmvc.js} +5 -4
- package/dist-bunli/{cli-scaffold-pbb67zxg.js → cli-scaffold-b1ex2y80.js} +14 -12
- package/dist-bunli/{cli-e7n7hbvr.js → cli-spdrcg8k.js} +117 -99
- package/dist-bunli/{cli-bwwssctv.js → cli-tjf0070f.js} +9 -5
- package/dist-bunli/cli.js +2 -2
- package/dist-bunli/{command-list-hbcv3bz6.js → command-list-h96cft88.js} +1188 -1005
- package/dist-bunli/{create-template-validation-7k2752mz.js → create-template-validation-rtec5sng.js} +3 -2
- package/dist-bunli/{migrations-ads3j14z.js → migrations-7g9rag5d.js} +5 -4
- package/dist-bunli/node-cli.js +1337 -1123
- package/package.json +2 -2
|
@@ -9,12 +9,14 @@ import {
|
|
|
9
9
|
SHARED_WORKSPACE_TEMPLATE_ROOT,
|
|
10
10
|
getTemplateById
|
|
11
11
|
} from "./cli-qse6myha.js";
|
|
12
|
+
import {
|
|
13
|
+
pathExists
|
|
14
|
+
} from "./cli-3fzqhpx9.js";
|
|
12
15
|
import {
|
|
13
16
|
createManagedTempRoot
|
|
14
17
|
} from "./cli-t73q5aqz.js";
|
|
15
18
|
|
|
16
19
|
// ../wp-typia-project-tools/src/runtime/template-builtins.ts
|
|
17
|
-
import fs from "fs";
|
|
18
20
|
import path from "path";
|
|
19
21
|
import { promises as fsp } from "fs";
|
|
20
22
|
var BUILT_IN_SHARED_TEMPLATE_LAYERS = Object.freeze([
|
|
@@ -136,20 +138,23 @@ function getBuiltInTemplateLayerDirs(templateId, options = {}) {
|
|
|
136
138
|
function isOmittableBuiltInTemplateLayerDir(templateId, layerDir) {
|
|
137
139
|
return OMITTABLE_BUILT_IN_OVERLAY_TEMPLATE_IDS.has(templateId) && layerDir === getTemplateById(templateId).templateDir;
|
|
138
140
|
}
|
|
139
|
-
function resolveMaterializedTemplateLayerDirs(templateId, layerDirs) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
async function resolveMaterializedTemplateLayerDirs(templateId, layerDirs) {
|
|
142
|
+
const materializedLayerDirs = [];
|
|
143
|
+
for (const layerDir of layerDirs) {
|
|
144
|
+
if (await pathExists(layerDir)) {
|
|
145
|
+
materializedLayerDirs.push(layerDir);
|
|
146
|
+
continue;
|
|
143
147
|
}
|
|
144
148
|
if (isOmittableBuiltInTemplateLayerDir(templateId, layerDir)) {
|
|
145
|
-
|
|
149
|
+
continue;
|
|
146
150
|
}
|
|
147
151
|
throw new Error(`Built-in template layer is missing: ${layerDir}`);
|
|
148
|
-
}
|
|
152
|
+
}
|
|
153
|
+
return materializedLayerDirs;
|
|
149
154
|
}
|
|
150
155
|
async function materializeBuiltInTemplateSource(templateId, layerDirs) {
|
|
151
156
|
const template = getTemplateById(templateId);
|
|
152
|
-
const materializedLayerDirs = resolveMaterializedTemplateLayerDirs(templateId, layerDirs);
|
|
157
|
+
const materializedLayerDirs = await resolveMaterializedTemplateLayerDirs(templateId, layerDirs);
|
|
153
158
|
const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-template-");
|
|
154
159
|
const templateDir = path.join(tempRoot, templateId);
|
|
155
160
|
try {
|
|
@@ -183,4 +188,4 @@ async function resolveBuiltInTemplateSource(templateId, options = {}) {
|
|
|
183
188
|
|
|
184
189
|
export { isBuiltInSharedTemplateLayerId, getBuiltInSharedTemplateLayerDir, getBuiltInTemplateOverlayDir, getBuiltInTemplateSharedLayerDirs, getBuiltInTemplateLayerDirs, isOmittableBuiltInTemplateLayerDir, resolveBuiltInTemplateSourceFromLayerDirs, resolveBuiltInTemplateSource };
|
|
185
190
|
|
|
186
|
-
//# debugId=
|
|
191
|
+
//# debugId=ABC45C8693C7267064756E2164756E21
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
PROJECT_TOOLS_PACKAGE_ROOT
|
|
4
4
|
} from "./cli-qse6myha.js";
|
|
5
|
+
import {
|
|
6
|
+
getOptionalNodeErrorCode
|
|
7
|
+
} from "./cli-3fzqhpx9.js";
|
|
5
8
|
|
|
6
9
|
// ../wp-typia-project-tools/src/runtime/package-versions.ts
|
|
7
10
|
import fs from "fs";
|
|
@@ -19,9 +22,6 @@ var DEFAULT_WORDPRESS_DATA_VERSION = "^9.28.0";
|
|
|
19
22
|
var DEFAULT_WORDPRESS_DATAVIEWS_VERSION = "^14.1.0";
|
|
20
23
|
var DEFAULT_WP_TYPIA_DATAVIEWS_VERSION = "^0.1.1";
|
|
21
24
|
var cachedPackageVersions = null;
|
|
22
|
-
function getErrorCode(error) {
|
|
23
|
-
return typeof error === "object" && error !== null && "code" in error ? String(error.code) : undefined;
|
|
24
|
-
}
|
|
25
25
|
function normalizeVersionRange(value) {
|
|
26
26
|
const trimmed = value?.trim();
|
|
27
27
|
if (!trimmed) {
|
|
@@ -73,7 +73,7 @@ function resolvePackageManifestLocation(packageJsonPath) {
|
|
|
73
73
|
source
|
|
74
74
|
};
|
|
75
75
|
} catch (error) {
|
|
76
|
-
if (
|
|
76
|
+
if (getOptionalNodeErrorCode(error) === "ENOENT") {
|
|
77
77
|
return {
|
|
78
78
|
cacheKey: `missing-file:${packageJsonPath}`,
|
|
79
79
|
packageJsonPath: null,
|
|
@@ -103,7 +103,7 @@ function resolveInstalledPackageManifestLocation(packageName) {
|
|
|
103
103
|
try {
|
|
104
104
|
return resolvePackageManifestLocation(require2.resolve(`${packageName}/package.json`));
|
|
105
105
|
} catch (error) {
|
|
106
|
-
if (
|
|
106
|
+
if (getOptionalNodeErrorCode(error) === "MODULE_NOT_FOUND") {
|
|
107
107
|
return {
|
|
108
108
|
cacheKey: `missing-module:${packageName}`,
|
|
109
109
|
packageJsonPath: null,
|
|
@@ -184,4 +184,4 @@ function getPackageVersions() {
|
|
|
184
184
|
|
|
185
185
|
export { DEFAULT_WORDPRESS_ABILITIES_VERSION, DEFAULT_WORDPRESS_CORE_ABILITIES_VERSION, DEFAULT_WORDPRESS_CORE_DATA_VERSION, DEFAULT_WORDPRESS_DATA_VERSION, DEFAULT_WORDPRESS_DATAVIEWS_VERSION, DEFAULT_WP_TYPIA_DATAVIEWS_VERSION, resolveManagedPackageVersionRange, getPackageVersions };
|
|
186
186
|
|
|
187
|
-
//# debugId=
|
|
187
|
+
//# debugId=00D2485EFE2B66E864756E2164756E21
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import {
|
|
3
|
-
getPackageVersions
|
|
4
|
-
} from "./cli-arz4rcye.js";
|
|
5
2
|
import {
|
|
6
3
|
CREATE_TEMPLATE_SELECTION_HINT,
|
|
7
4
|
parseTemplateLocator,
|
|
8
5
|
require_semver,
|
|
9
6
|
validateExplicitCreateTemplateId
|
|
10
|
-
} from "./cli-
|
|
11
|
-
import {
|
|
12
|
-
seedProjectMigrations
|
|
13
|
-
} from "./cli-bwwssctv.js";
|
|
14
|
-
import {
|
|
15
|
-
ensureMigrationDirectories,
|
|
16
|
-
isPlainObject,
|
|
17
|
-
stableJsonStringify,
|
|
18
|
-
writeInitialMigrationScaffold,
|
|
19
|
-
writeMigrationConfig
|
|
20
|
-
} from "./cli-2rqf6t0b.js";
|
|
7
|
+
} from "./cli-8reep89s.js";
|
|
21
8
|
import {
|
|
22
9
|
getBuiltInSharedTemplateLayerDir,
|
|
23
10
|
getBuiltInTemplateLayerDirs,
|
|
@@ -27,7 +14,10 @@ import {
|
|
|
27
14
|
isOmittableBuiltInTemplateLayerDir,
|
|
28
15
|
resolveBuiltInTemplateSource,
|
|
29
16
|
resolveBuiltInTemplateSourceFromLayerDirs
|
|
30
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-1k61xyn2.js";
|
|
18
|
+
import {
|
|
19
|
+
getPackageVersions
|
|
20
|
+
} from "./cli-2mswafd6.js";
|
|
31
21
|
import {
|
|
32
22
|
BUILTIN_BLOCK_METADATA_VERSION,
|
|
33
23
|
COMPOUND_CHILD_BLOCK_METADATA_DEFAULTS,
|
|
@@ -43,10 +33,21 @@ import {
|
|
|
43
33
|
isBuiltInTemplateId,
|
|
44
34
|
normalizeTemplateLookupId
|
|
45
35
|
} from "./cli-qse6myha.js";
|
|
36
|
+
import {
|
|
37
|
+
seedProjectMigrations
|
|
38
|
+
} from "./cli-tjf0070f.js";
|
|
39
|
+
import {
|
|
40
|
+
ensureMigrationDirectories,
|
|
41
|
+
isPlainObject,
|
|
42
|
+
stableJsonStringify,
|
|
43
|
+
writeInitialMigrationScaffold,
|
|
44
|
+
writeMigrationConfig
|
|
45
|
+
} from "./cli-2rqf6t0b.js";
|
|
46
46
|
import {
|
|
47
47
|
buildBlockCssClassName,
|
|
48
48
|
buildFrontendCssClassName,
|
|
49
49
|
getNodeErrorCode,
|
|
50
|
+
getOptionalNodeErrorCode,
|
|
50
51
|
normalizeBlockSlug,
|
|
51
52
|
pathExists,
|
|
52
53
|
readOptionalUtf8File,
|
|
@@ -57,7 +58,7 @@ import {
|
|
|
57
58
|
toTitleCase,
|
|
58
59
|
validateBlockSlug,
|
|
59
60
|
validateNamespace
|
|
60
|
-
} from "./cli-
|
|
61
|
+
} from "./cli-3fzqhpx9.js";
|
|
61
62
|
import {
|
|
62
63
|
createManagedTempRoot
|
|
63
64
|
} from "./cli-t73q5aqz.js";
|
|
@@ -2556,7 +2557,6 @@ async function collectScaffoldAnswers({
|
|
|
2556
2557
|
}
|
|
2557
2558
|
|
|
2558
2559
|
// ../wp-typia-project-tools/src/runtime/scaffold.ts
|
|
2559
|
-
import fs11 from "fs";
|
|
2560
2560
|
import { promises as fsp12 } from "fs";
|
|
2561
2561
|
import path17 from "path";
|
|
2562
2562
|
|
|
@@ -3062,14 +3062,11 @@ import { createRequire } from "module";
|
|
|
3062
3062
|
import path8 from "path";
|
|
3063
3063
|
var require2 = createRequire(import.meta.url);
|
|
3064
3064
|
var DEFAULT_SCAFFOLD_REPOSITORY_REFERENCE = "imjlk/wp-typia";
|
|
3065
|
-
function getErrorCode(error) {
|
|
3066
|
-
return typeof error === "object" && error !== null && "code" in error ? String(error.code) : undefined;
|
|
3067
|
-
}
|
|
3068
3065
|
function readRepositoryPackageManifest(packageJsonPath) {
|
|
3069
3066
|
try {
|
|
3070
3067
|
return JSON.parse(fs4.readFileSync(packageJsonPath, "utf8"));
|
|
3071
3068
|
} catch (error) {
|
|
3072
|
-
if (
|
|
3069
|
+
if (getOptionalNodeErrorCode(error) === "ENOENT") {
|
|
3073
3070
|
return null;
|
|
3074
3071
|
}
|
|
3075
3072
|
throw error;
|
|
@@ -3079,7 +3076,7 @@ function resolveInstalledPackageManifestPath(packageName) {
|
|
|
3079
3076
|
try {
|
|
3080
3077
|
return require2.resolve(`${packageName}/package.json`);
|
|
3081
3078
|
} catch (error) {
|
|
3082
|
-
if (
|
|
3079
|
+
if (getOptionalNodeErrorCode(error) === "MODULE_NOT_FOUND") {
|
|
3083
3080
|
return null;
|
|
3084
3081
|
}
|
|
3085
3082
|
throw error;
|
|
@@ -3428,7 +3425,6 @@ async function applyBuiltInScaffoldProjectFiles({
|
|
|
3428
3425
|
import path13 from "path";
|
|
3429
3426
|
|
|
3430
3427
|
// ../wp-typia-project-tools/src/runtime/template-layers.ts
|
|
3431
|
-
import fs5 from "fs";
|
|
3432
3428
|
import path10 from "path";
|
|
3433
3429
|
import { promises as fsp7 } from "fs";
|
|
3434
3430
|
var TEMPLATE_LAYER_MANIFEST_FILENAME = "wp-typia.layers.json";
|
|
@@ -3480,7 +3476,7 @@ function parseLayerDefinition(layerId, value) {
|
|
|
3480
3476
|
}
|
|
3481
3477
|
async function loadExternalTemplateLayerManifest(sourceRoot) {
|
|
3482
3478
|
const manifestPath = path10.join(sourceRoot, TEMPLATE_LAYER_MANIFEST_FILENAME);
|
|
3483
|
-
if (!
|
|
3479
|
+
if (!await pathExists(manifestPath)) {
|
|
3484
3480
|
return null;
|
|
3485
3481
|
}
|
|
3486
3482
|
const raw = JSON.parse(await fsp7.readFile(manifestPath, "utf8"));
|
|
@@ -3615,13 +3611,12 @@ async function assertExternalTemplateLayersDoNotWriteProtectedOutputs({
|
|
|
3615
3611
|
}
|
|
3616
3612
|
|
|
3617
3613
|
// ../wp-typia-project-tools/src/runtime/template-source-external.ts
|
|
3618
|
-
import fs7 from "fs";
|
|
3619
3614
|
import { promises as fsp8 } from "fs";
|
|
3620
3615
|
import path11 from "path";
|
|
3621
3616
|
import { pathToFileURL } from "url";
|
|
3622
3617
|
|
|
3623
3618
|
// ../wp-typia-project-tools/src/runtime/external-template-guards.ts
|
|
3624
|
-
import
|
|
3619
|
+
import fs5 from "fs";
|
|
3625
3620
|
var TEMPLATE_SOURCE_TIMEOUT_CODE = "template-source-timeout";
|
|
3626
3621
|
var TEMPLATE_SOURCE_TOO_LARGE_CODE = "template-source-too-large";
|
|
3627
3622
|
var DEFAULT_EXTERNAL_TEMPLATE_TIMEOUT_MS = 20000;
|
|
@@ -3663,7 +3658,7 @@ function createExternalTemplateTooLargeError(label, maxBytes) {
|
|
|
3663
3658
|
return createTemplateGuardError(TEMPLATE_SOURCE_TOO_LARGE_CODE, `${label} exceeded the external template size limit (${maxBytes} bytes).`);
|
|
3664
3659
|
}
|
|
3665
3660
|
function assertExternalTemplateFileSize(filePath, options) {
|
|
3666
|
-
const stats =
|
|
3661
|
+
const stats = fs5.statSync(filePath);
|
|
3667
3662
|
if (stats.size > options.maxBytes) {
|
|
3668
3663
|
throw createExternalTemplateTooLargeError(options.label, options.maxBytes);
|
|
3669
3664
|
}
|
|
@@ -3898,9 +3893,9 @@ async function renderCreateBlockExternalTemplate(sourceDir, context, requestedVa
|
|
|
3898
3893
|
const view = await buildExternalTemplateView(context, config, selectedVariant, variantConfig);
|
|
3899
3894
|
const blockTemplateDir = resolveSourceSubpath(sourceDir, templatePath);
|
|
3900
3895
|
await copyRenderedDirectory(blockTemplateDir, blockDir, view, {
|
|
3901
|
-
filter: (sourcePath, _destinationPath, entry) => {
|
|
3896
|
+
filter: async (sourcePath, _destinationPath, entry) => {
|
|
3902
3897
|
const mustacheVariantPath = path11.join(path11.dirname(sourcePath), `${entry.name}.mustache`);
|
|
3903
|
-
return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") &&
|
|
3898
|
+
return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && await pathExists(mustacheVariantPath));
|
|
3904
3899
|
}
|
|
3905
3900
|
});
|
|
3906
3901
|
const assetsPath = typeof variantConfig.assetsPath === "string" ? variantConfig.assetsPath : config.assetsPath;
|
|
@@ -3924,7 +3919,6 @@ async function renderCreateBlockExternalTemplate(sourceDir, context, requestedVa
|
|
|
3924
3919
|
}
|
|
3925
3920
|
|
|
3926
3921
|
// ../wp-typia-project-tools/src/runtime/template-source-remote.ts
|
|
3927
|
-
import fs8 from "fs";
|
|
3928
3922
|
import { promises as fsp9 } from "fs";
|
|
3929
3923
|
import path12 from "path";
|
|
3930
3924
|
async function cleanupSeedRootPair(cleanup, seedCleanup) {
|
|
@@ -4009,9 +4003,9 @@ async function normalizeWpTypiaTemplateSeed(seed) {
|
|
|
4009
4003
|
const normalizedDir = path12.join(tempRoot, "template");
|
|
4010
4004
|
try {
|
|
4011
4005
|
await copyRawDirectory(seed.blockDir, normalizedDir, {
|
|
4012
|
-
filter: (sourcePath, _targetPath, entry) => {
|
|
4006
|
+
filter: async (sourcePath, _targetPath, entry) => {
|
|
4013
4007
|
const mustacheVariantPath = path12.join(path12.dirname(sourcePath), `${entry.name}.mustache`);
|
|
4014
|
-
return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") &&
|
|
4008
|
+
return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && await pathExists(mustacheVariantPath));
|
|
4015
4009
|
}
|
|
4016
4010
|
});
|
|
4017
4011
|
if (seed.assetsDir && await pathExists(seed.assetsDir)) {
|
|
@@ -4325,7 +4319,7 @@ async function detectTemplateSourceFormat(sourceDir) {
|
|
|
4325
4319
|
|
|
4326
4320
|
// ../wp-typia-project-tools/src/runtime/template-source-seeds.ts
|
|
4327
4321
|
var import_semver = __toESM(require_semver(), 1);
|
|
4328
|
-
import
|
|
4322
|
+
import fs7 from "fs";
|
|
4329
4323
|
import { promises as fsp11 } from "fs";
|
|
4330
4324
|
import { createRequire as createRequire2 } from "module";
|
|
4331
4325
|
import path16 from "path";
|
|
@@ -6601,7 +6595,7 @@ var Vn = 512 * 1024;
|
|
|
6601
6595
|
var $n = pr | ur | dr | mr;
|
|
6602
6596
|
var lr = !fr && typeof ar == "number" ? ar | ur | dr | mr : null;
|
|
6603
6597
|
var cs = lr !== null ? () => lr : Kn ? (s3) => s3 < Vn ? $n : "w" : () => "w";
|
|
6604
|
-
var
|
|
6598
|
+
var fs6 = (s3, t, e) => {
|
|
6605
6599
|
try {
|
|
6606
6600
|
return mi.lchownSync(s3, t, e);
|
|
6607
6601
|
} catch (i) {
|
|
@@ -6650,7 +6644,7 @@ var ds = (s3, t, e, i) => {
|
|
|
6650
6644
|
});
|
|
6651
6645
|
};
|
|
6652
6646
|
var qn = (s3, t, e, i) => {
|
|
6653
|
-
t.isDirectory() && us(Ee.resolve(s3, t.name), e, i),
|
|
6647
|
+
t.isDirectory() && us(Ee.resolve(s3, t.name), e, i), fs6(Ee.resolve(s3, t.name), e, i);
|
|
6654
6648
|
};
|
|
6655
6649
|
var us = (s3, t, e) => {
|
|
6656
6650
|
let i;
|
|
@@ -6661,12 +6655,12 @@ var us = (s3, t, e) => {
|
|
|
6661
6655
|
if (n?.code === "ENOENT")
|
|
6662
6656
|
return;
|
|
6663
6657
|
if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP")
|
|
6664
|
-
return
|
|
6658
|
+
return fs6(s3, t, e);
|
|
6665
6659
|
throw n;
|
|
6666
6660
|
}
|
|
6667
6661
|
for (let r of i)
|
|
6668
6662
|
qn(s3, r, t, e);
|
|
6669
|
-
return
|
|
6663
|
+
return fs6(s3, t, e);
|
|
6670
6664
|
};
|
|
6671
6665
|
var we = class extends Error {
|
|
6672
6666
|
path;
|
|
@@ -8213,8 +8207,8 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
|
|
|
8213
8207
|
return null;
|
|
8214
8208
|
}
|
|
8215
8209
|
const workspacePackagesRoot = path16.resolve(PROJECT_TOOLS_PACKAGE_ROOT, "..");
|
|
8216
|
-
if (
|
|
8217
|
-
for (const entry of
|
|
8210
|
+
if (fs7.existsSync(workspacePackagesRoot)) {
|
|
8211
|
+
for (const entry of fs7.readdirSync(workspacePackagesRoot, {
|
|
8218
8212
|
withFileTypes: true
|
|
8219
8213
|
})) {
|
|
8220
8214
|
if (!entry.isDirectory()) {
|
|
@@ -8222,10 +8216,10 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
|
|
|
8222
8216
|
}
|
|
8223
8217
|
const packageDir = path16.join(workspacePackagesRoot, entry.name);
|
|
8224
8218
|
const packageJsonPath = path16.join(packageDir, "package.json");
|
|
8225
|
-
if (!
|
|
8219
|
+
if (!fs7.existsSync(packageJsonPath)) {
|
|
8226
8220
|
continue;
|
|
8227
8221
|
}
|
|
8228
|
-
const manifest = JSON.parse(
|
|
8222
|
+
const manifest = JSON.parse(fs7.readFileSync(packageJsonPath, "utf8"));
|
|
8229
8223
|
if (manifest.name === locator.name) {
|
|
8230
8224
|
return {
|
|
8231
8225
|
blockDir: packageDir,
|
|
@@ -8236,7 +8230,7 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
|
|
|
8236
8230
|
}
|
|
8237
8231
|
const workspaceRequire = createRequire2(path16.join(path16.resolve(cwd), "__wp_typia_template_resolver__.cjs"));
|
|
8238
8232
|
try {
|
|
8239
|
-
const packageJsonPath =
|
|
8233
|
+
const packageJsonPath = fs7.realpathSync(workspaceRequire.resolve(`${locator.name}/package.json`));
|
|
8240
8234
|
const sourceDir = path16.dirname(packageJsonPath);
|
|
8241
8235
|
return {
|
|
8242
8236
|
blockDir: sourceDir,
|
|
@@ -8247,10 +8241,10 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
|
|
|
8247
8241
|
if (errorCode === "MODULE_NOT_FOUND" || errorCode === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
|
|
8248
8242
|
for (const basePath of workspaceRequire.resolve.paths(locator.name) ?? []) {
|
|
8249
8243
|
const packageJsonPath = path16.join(basePath, locator.name, "package.json");
|
|
8250
|
-
if (!
|
|
8244
|
+
if (!fs7.existsSync(packageJsonPath)) {
|
|
8251
8245
|
continue;
|
|
8252
8246
|
}
|
|
8253
|
-
const sourceDir = path16.dirname(
|
|
8247
|
+
const sourceDir = path16.dirname(fs7.realpathSync(packageJsonPath));
|
|
8254
8248
|
return {
|
|
8255
8249
|
blockDir: sourceDir,
|
|
8256
8250
|
rootDir: sourceDir
|
|
@@ -8261,13 +8255,13 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
|
|
|
8261
8255
|
throw error;
|
|
8262
8256
|
}
|
|
8263
8257
|
}
|
|
8264
|
-
function
|
|
8258
|
+
async function isOfficialWorkspaceTemplateSeedAsync(seed) {
|
|
8265
8259
|
const packageJsonPath = path16.join(seed.rootDir, "package.json");
|
|
8266
|
-
if (!
|
|
8260
|
+
if (!await pathExists(packageJsonPath)) {
|
|
8267
8261
|
return false;
|
|
8268
8262
|
}
|
|
8269
8263
|
try {
|
|
8270
|
-
const packageJson = JSON.parse(
|
|
8264
|
+
const packageJson = JSON.parse(await fsp11.readFile(packageJsonPath, "utf8"));
|
|
8271
8265
|
return packageJson.name === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE;
|
|
8272
8266
|
} catch {
|
|
8273
8267
|
return false;
|
|
@@ -8310,13 +8304,13 @@ function runGitTemplateCommand(args, label, options = {}) {
|
|
|
8310
8304
|
function getGitHubTemplateRepositoryUrl(locator) {
|
|
8311
8305
|
return `https://github.com/${locator.owner}/${locator.repo}.git`;
|
|
8312
8306
|
}
|
|
8313
|
-
function resolveGitHubTemplateDirectory(checkoutDir, locator) {
|
|
8307
|
+
async function resolveGitHubTemplateDirectory(checkoutDir, locator) {
|
|
8314
8308
|
const sourceDir = path16.resolve(checkoutDir, locator.sourcePath);
|
|
8315
8309
|
const relativeSourceDir = path16.relative(checkoutDir, sourceDir);
|
|
8316
8310
|
if (relativeSourceDir.startsWith("..") || path16.isAbsolute(relativeSourceDir)) {
|
|
8317
8311
|
throw new Error("GitHub template path must stay within the cloned repository.");
|
|
8318
8312
|
}
|
|
8319
|
-
if (!
|
|
8313
|
+
if (!await pathExists(sourceDir)) {
|
|
8320
8314
|
throw new Error(`GitHub template path does not exist: ${locator.sourcePath}`);
|
|
8321
8315
|
}
|
|
8322
8316
|
return sourceDir;
|
|
@@ -8440,7 +8434,7 @@ async function reuseGitHubTemplateCacheByMetadata(locator) {
|
|
|
8440
8434
|
if (!cachedSource) {
|
|
8441
8435
|
return null;
|
|
8442
8436
|
}
|
|
8443
|
-
const sourceDir = resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
|
|
8437
|
+
const sourceDir = await resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
|
|
8444
8438
|
await assertNoSymlinks2(sourceDir);
|
|
8445
8439
|
return {
|
|
8446
8440
|
blockDir: sourceDir,
|
|
@@ -8483,12 +8477,12 @@ async function resolveGitHubTemplateSource(locator) {
|
|
|
8483
8477
|
namespace: "github"
|
|
8484
8478
|
}, async (checkoutDir2) => {
|
|
8485
8479
|
cloneGitHubTemplateSource(locator, checkoutDir2);
|
|
8486
|
-
const sourceDir = resolveGitHubTemplateDirectory(checkoutDir2, locator);
|
|
8480
|
+
const sourceDir = await resolveGitHubTemplateDirectory(checkoutDir2, locator);
|
|
8487
8481
|
await assertNoSymlinks2(sourceDir);
|
|
8488
8482
|
pinGitHubTemplateCacheRevision(locator, checkoutDir2, resolvedCacheRevision);
|
|
8489
8483
|
});
|
|
8490
8484
|
if (cachedSource) {
|
|
8491
|
-
const sourceDir = resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
|
|
8485
|
+
const sourceDir = await resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
|
|
8492
8486
|
await assertNoSymlinks2(sourceDir);
|
|
8493
8487
|
return {
|
|
8494
8488
|
blockDir: sourceDir,
|
|
@@ -8505,7 +8499,7 @@ async function resolveGitHubTemplateSource(locator) {
|
|
|
8505
8499
|
const checkoutDir = path16.join(remoteRoot, "source");
|
|
8506
8500
|
try {
|
|
8507
8501
|
cloneGitHubTemplateSource(locator, checkoutDir);
|
|
8508
|
-
const sourceDir = resolveGitHubTemplateDirectory(checkoutDir, locator);
|
|
8502
|
+
const sourceDir = await resolveGitHubTemplateDirectory(checkoutDir, locator);
|
|
8509
8503
|
await assertNoSymlinks2(sourceDir);
|
|
8510
8504
|
return {
|
|
8511
8505
|
blockDir: sourceDir,
|
|
@@ -8520,7 +8514,7 @@ async function resolveGitHubTemplateSource(locator) {
|
|
|
8520
8514
|
async function resolveTemplateSeed(locator, cwd) {
|
|
8521
8515
|
if (locator.kind === "path") {
|
|
8522
8516
|
const sourceDir = path16.resolve(cwd, locator.templatePath);
|
|
8523
|
-
if (!
|
|
8517
|
+
if (!await pathExists(sourceDir)) {
|
|
8524
8518
|
throw new Error(`Template path does not exist: ${sourceDir}`);
|
|
8525
8519
|
}
|
|
8526
8520
|
await assertNoSymlinks2(sourceDir);
|
|
@@ -8556,7 +8550,7 @@ async function resolveTemplateSource(templateId, cwd, variables, variant) {
|
|
|
8556
8550
|
const locator = parseTemplateLocator(templateId);
|
|
8557
8551
|
const context = getTemplateVariableContext(variables);
|
|
8558
8552
|
const seed = await resolveTemplateSeed(locator, cwd);
|
|
8559
|
-
const isOfficialWorkspaceTemplate = templateId === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE ||
|
|
8553
|
+
const isOfficialWorkspaceTemplate = templateId === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE || await isOfficialWorkspaceTemplateSeedAsync(seed);
|
|
8560
8554
|
let normalizedSeed = null;
|
|
8561
8555
|
try {
|
|
8562
8556
|
const format = await detectTemplateSourceFormat(seed.blockDir);
|
|
@@ -13927,7 +13921,7 @@ async function scaffoldProject({
|
|
|
13927
13921
|
title: "Finalizing scaffold output"
|
|
13928
13922
|
});
|
|
13929
13923
|
const readmePath = path17.join(projectDir, "README.md");
|
|
13930
|
-
if (!
|
|
13924
|
+
if (!await pathExists(readmePath)) {
|
|
13931
13925
|
await fsp12.writeFile(readmePath, buildReadme(resolvedTemplateId, variables, resolvedPackageManager, {
|
|
13932
13926
|
withMigrationUi: isBuiltInTemplate || isWorkspace ? withMigrationUi : false,
|
|
13933
13927
|
withTestPreset: isBuiltInTemplate ? withTestPreset : false,
|
|
@@ -13935,7 +13929,7 @@ async function scaffoldProject({
|
|
|
13935
13929
|
}), "utf8");
|
|
13936
13930
|
}
|
|
13937
13931
|
const gitignorePath = path17.join(projectDir, ".gitignore");
|
|
13938
|
-
const existingGitignore =
|
|
13932
|
+
const existingGitignore = await pathExists(gitignorePath) ? await fsp12.readFile(gitignorePath, "utf8") : "";
|
|
13939
13933
|
await fsp12.writeFile(gitignorePath, mergeTextLines(buildGitignore(), existingGitignore), "utf8");
|
|
13940
13934
|
await normalizePackageJson(projectDir, resolvedPackageManager);
|
|
13941
13935
|
if (isBuiltInTemplate) {
|
|
@@ -14018,4 +14012,4 @@ async function resolveOptionalInteractiveExternalLayerId({
|
|
|
14018
14012
|
|
|
14019
14013
|
export { syncPersistenceRestArtifacts, copyInterpolatedDirectory, listInterpolatedDirectoryOutputs, getPrimaryDevelopmentScript, getOptionalOnboardingSteps, getOptionalOnboardingNote, getOptionalOnboardingShortNote, isCompoundPersistenceEnabled, formatNonEmptyTargetDirectoryError, resolveExternalTemplateLayers, resolveTemplateSeed, normalizeOptionalCliString, resolveLocalCliPathOption, assertExternalLayerCompositionOptions, assertBuiltInTemplateVariantAllowed, parseAlternateRenderTargets, parseCompoundInnerBlocksPreset, OPTIONAL_WORDPRESS_AI_CLIENT_COMPATIBILITY, REQUIRED_WORKSPACE_ABILITY_COMPATIBILITY, resolveScaffoldCompatibilityPolicy, createScaffoldCompatibilityConfig, renderScaffoldCompatibilityConfig, updatePluginHeaderCompatibility, getDefaultAnswers, resolveTemplateId, resolvePackageManagerId, collectScaffoldAnswers, DATA_STORAGE_MODES, PERSISTENCE_POLICIES, isDataStorageMode, isPersistencePolicy, scaffoldProject, resolveOptionalInteractiveExternalLayerId };
|
|
14020
14014
|
|
|
14021
|
-
//# debugId=
|
|
14015
|
+
//# debugId=D080E1AA4CFC66CB64756E2164756E21
|