wp-typia 0.22.6 → 0.22.7
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/bin/wp-typia.js +83 -0
- package/dist-bunli/.bunli/commands.gen.js +509 -565
- package/dist-bunli/{cli-0q0tz4dq.js → cli-27v2qpjg.js} +1 -1
- package/dist-bunli/{cli-1sm60g1z.js → cli-2hsp17nd.js} +2 -2
- package/dist-bunli/{cli-6a65qfb1.js → cli-8snabymq.js} +105 -130
- package/dist-bunli/{cli-add-5vmxpgmn.js → cli-add-8jpdnz1r.js} +13 -14
- package/dist-bunli/{cli-f44sphgv.js → cli-cjygr56g.js} +3 -3
- package/dist-bunli/{cli-doctor-ngzs8kkc.js → cli-doctor-h5tq4ztr.js} +1 -1
- package/dist-bunli/{cli-init-df1wg71p.js → cli-init-w9p558th.js} +73 -72
- package/dist-bunli/{cli-scaffold-btx3wfsn.js → cli-scaffold-qve8rqja.js} +4 -4
- package/dist-bunli/{cli-5kn2p7ee.js → cli-ta3y0hp2.js} +159 -194
- package/dist-bunli/cli.js +2 -2
- package/dist-bunli/{command-list-bqr2tp8w.js → command-list-6zr1tj96.js} +7 -7
- package/dist-bunli/{migrations-bnrjw4k1.js → migrations-v0avgyg6.js} +2 -2
- package/dist-bunli/node-cli.js +3 -3
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
getPackageVersions
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-2hsp17nd.js";
|
|
5
5
|
import {
|
|
6
6
|
seedProjectMigrations
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-27v2qpjg.js";
|
|
8
8
|
import {
|
|
9
9
|
ensureMigrationDirectories,
|
|
10
10
|
isPlainObject,
|
|
@@ -44,6 +44,8 @@ import {
|
|
|
44
44
|
buildBlockCssClassName,
|
|
45
45
|
buildFrontendCssClassName,
|
|
46
46
|
normalizeBlockSlug,
|
|
47
|
+
pathExists,
|
|
48
|
+
readOptionalUtf8File,
|
|
47
49
|
resolveScaffoldIdentifiers,
|
|
48
50
|
toPascalCase,
|
|
49
51
|
toSegmentPascalCase,
|
|
@@ -51,7 +53,7 @@ import {
|
|
|
51
53
|
toTitleCase,
|
|
52
54
|
validateBlockSlug,
|
|
53
55
|
validateNamespace
|
|
54
|
-
} from "./cli-
|
|
56
|
+
} from "./cli-ta3y0hp2.js";
|
|
55
57
|
import {
|
|
56
58
|
createManagedTempRoot
|
|
57
59
|
} from "./cli-t73q5aqz.js";
|
|
@@ -4548,7 +4550,7 @@ function getPhpRestExtensionPointsSection(templateId, { compoundPersistenceEnabl
|
|
|
4548
4550
|
|
|
4549
4551
|
// ../wp-typia-project-tools/src/runtime/scaffold-bootstrap.ts
|
|
4550
4552
|
import fs2 from "fs";
|
|
4551
|
-
import { promises as
|
|
4553
|
+
import { promises as fsp3 } from "fs";
|
|
4552
4554
|
import path4 from "path";
|
|
4553
4555
|
|
|
4554
4556
|
// ../wp-typia-project-tools/src/runtime/persistence-rest-artifacts.ts
|
|
@@ -5679,41 +5681,14 @@ function stringifyStarterManifest(document) {
|
|
|
5679
5681
|
`;
|
|
5680
5682
|
}
|
|
5681
5683
|
|
|
5682
|
-
// ../wp-typia-project-tools/src/runtime/fs-async.ts
|
|
5683
|
-
import { promises as fsp3 } from "fs";
|
|
5684
|
-
async function pathExists(filePath) {
|
|
5685
|
-
try {
|
|
5686
|
-
await fsp3.access(filePath);
|
|
5687
|
-
return true;
|
|
5688
|
-
} catch {
|
|
5689
|
-
return false;
|
|
5690
|
-
}
|
|
5691
|
-
}
|
|
5692
|
-
async function readOptionalUtf8File(filePath) {
|
|
5693
|
-
try {
|
|
5694
|
-
return await fsp3.readFile(filePath, "utf8");
|
|
5695
|
-
} catch (error) {
|
|
5696
|
-
if (isFileNotFoundError(error)) {
|
|
5697
|
-
return null;
|
|
5698
|
-
}
|
|
5699
|
-
throw error;
|
|
5700
|
-
}
|
|
5701
|
-
}
|
|
5702
|
-
function getNodeErrorCode(error) {
|
|
5703
|
-
return typeof error === "object" && error !== null && "code" in error ? String(error.code) : "";
|
|
5704
|
-
}
|
|
5705
|
-
function isFileNotFoundError(error) {
|
|
5706
|
-
return getNodeErrorCode(error) === "ENOENT";
|
|
5707
|
-
}
|
|
5708
|
-
|
|
5709
5684
|
// ../wp-typia-project-tools/src/runtime/scaffold-bootstrap.ts
|
|
5710
5685
|
var EPHEMERAL_NODE_MODULES_LINK_TYPE = process.platform === "win32" ? "junction" : "dir";
|
|
5711
5686
|
async function ensureScaffoldDirectory(targetDir, allowExisting = false) {
|
|
5712
|
-
await
|
|
5687
|
+
await fsp3.mkdir(targetDir, { recursive: true });
|
|
5713
5688
|
if (allowExisting) {
|
|
5714
5689
|
return;
|
|
5715
5690
|
}
|
|
5716
|
-
const entries = await
|
|
5691
|
+
const entries = await fsp3.readdir(targetDir);
|
|
5717
5692
|
if (entries.length > 0) {
|
|
5718
5693
|
throw new Error(formatNonEmptyTargetDirectoryError(targetDir));
|
|
5719
5694
|
}
|
|
@@ -5732,8 +5707,8 @@ async function writeStarterManifestFiles(targetDir, templateId, variables) {
|
|
|
5732
5707
|
const manifests = getStarterManifestFiles(templateId, variables);
|
|
5733
5708
|
for (const { document, relativePath } of manifests) {
|
|
5734
5709
|
const destinationPath = path4.join(targetDir, relativePath);
|
|
5735
|
-
await
|
|
5736
|
-
await
|
|
5710
|
+
await fsp3.mkdir(path4.dirname(destinationPath), { recursive: true });
|
|
5711
|
+
await fsp3.writeFile(destinationPath, stringifyStarterManifest(document), "utf8");
|
|
5737
5712
|
}
|
|
5738
5713
|
}
|
|
5739
5714
|
async function seedBuiltInPersistenceArtifacts(targetDir, templateId, variables) {
|
|
@@ -5765,7 +5740,7 @@ function isWorkspaceProject(projectDir) {
|
|
|
5765
5740
|
}
|
|
5766
5741
|
async function applyWorkspaceMigrationCapability(projectDir, packageManager) {
|
|
5767
5742
|
const packageJsonPath = path4.join(projectDir, "package.json");
|
|
5768
|
-
const packageJson = JSON.parse(await
|
|
5743
|
+
const packageJson = JSON.parse(await fsp3.readFile(packageJsonPath, "utf8"));
|
|
5769
5744
|
const wpTypiaPackageVersion = getPackageVersions().wpTypiaPackageVersion;
|
|
5770
5745
|
const canonicalCliSpecifier = wpTypiaPackageVersion === "^0.0.0" ? "wp-typia" : `wp-typia@${wpTypiaPackageVersion.replace(/^[~^]/u, "")}`;
|
|
5771
5746
|
const migrationCli = (args) => formatPackageExecCommand(packageManager, canonicalCliSpecifier, `migrate ${args}`);
|
|
@@ -5780,7 +5755,7 @@ async function applyWorkspaceMigrationCapability(projectDir, packageManager) {
|
|
|
5780
5755
|
"migration:verify": migrationCli("verify --all"),
|
|
5781
5756
|
"migration:fuzz": migrationCli("fuzz --all")
|
|
5782
5757
|
};
|
|
5783
|
-
await
|
|
5758
|
+
await fsp3.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, "\t")}
|
|
5784
5759
|
`, "utf8");
|
|
5785
5760
|
writeMigrationConfig(projectDir, {
|
|
5786
5761
|
blocks: [],
|
|
@@ -5814,11 +5789,11 @@ async function withEphemeralScaffoldNodeModules(targetDir, callback) {
|
|
|
5814
5789
|
if (!sourceNodeModulesPath) {
|
|
5815
5790
|
throw new Error("Unable to resolve a node_modules directory with typia for scaffold-time REST artifact generation.");
|
|
5816
5791
|
}
|
|
5817
|
-
await
|
|
5792
|
+
await fsp3.symlink(sourceNodeModulesPath, targetNodeModulesPath, EPHEMERAL_NODE_MODULES_LINK_TYPE);
|
|
5818
5793
|
try {
|
|
5819
5794
|
await callback();
|
|
5820
5795
|
} finally {
|
|
5821
|
-
await
|
|
5796
|
+
await fsp3.rm(targetNodeModulesPath, { force: true, recursive: true });
|
|
5822
5797
|
}
|
|
5823
5798
|
}
|
|
5824
5799
|
|
|
@@ -6244,35 +6219,35 @@ async function collectScaffoldAnswers({
|
|
|
6244
6219
|
|
|
6245
6220
|
// ../wp-typia-project-tools/src/runtime/scaffold.ts
|
|
6246
6221
|
import fs12 from "fs";
|
|
6247
|
-
import { promises as
|
|
6222
|
+
import { promises as fsp12 } from "fs";
|
|
6248
6223
|
import path18 from "path";
|
|
6249
6224
|
|
|
6250
6225
|
// ../wp-typia-project-tools/src/runtime/scaffold-apply-utils.ts
|
|
6251
|
-
import { promises as
|
|
6226
|
+
import { promises as fsp6 } from "fs";
|
|
6252
6227
|
import path11 from "path";
|
|
6253
6228
|
import { execSync as execSync3 } from "child_process";
|
|
6254
6229
|
import { fileURLToPath } from "url";
|
|
6255
6230
|
|
|
6256
6231
|
// ../wp-typia-project-tools/src/runtime/migration-ui-capability.ts
|
|
6257
|
-
import { promises as
|
|
6232
|
+
import { promises as fsp4 } from "fs";
|
|
6258
6233
|
import path8 from "path";
|
|
6259
6234
|
var INITIAL_MIGRATION_VERSION = "v1";
|
|
6260
6235
|
var BLOCK_METADATA_IMPORT_LINE = "import metadata from './block-metadata';";
|
|
6261
6236
|
var LEGACY_BLOCK_JSON_IMPORT_LINE = "import metadata from './block.json';";
|
|
6262
6237
|
async function mutatePackageJson2(projectDir, mutate) {
|
|
6263
6238
|
const packageJsonPath = path8.join(projectDir, "package.json");
|
|
6264
|
-
const packageJson = JSON.parse(await
|
|
6239
|
+
const packageJson = JSON.parse(await fsp4.readFile(packageJsonPath, "utf8"));
|
|
6265
6240
|
mutate(packageJson);
|
|
6266
|
-
await
|
|
6241
|
+
await fsp4.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, "\t")}
|
|
6267
6242
|
`, "utf8");
|
|
6268
6243
|
}
|
|
6269
6244
|
async function patchFile(filePath, transform) {
|
|
6270
|
-
const source = await
|
|
6245
|
+
const source = await fsp4.readFile(filePath, "utf8");
|
|
6271
6246
|
const nextSource = transform(source);
|
|
6272
6247
|
if (nextSource === source) {
|
|
6273
6248
|
throw new Error(`Unable to apply migration UI patch for ${filePath}`);
|
|
6274
6249
|
}
|
|
6275
|
-
await
|
|
6250
|
+
await fsp4.writeFile(filePath, nextSource, "utf8");
|
|
6276
6251
|
}
|
|
6277
6252
|
function injectAfter(source, needle, insertion) {
|
|
6278
6253
|
if (source.includes(insertion)) {
|
|
@@ -6683,7 +6658,7 @@ function mergeTextLines(primaryContent, existingContent) {
|
|
|
6683
6658
|
}
|
|
6684
6659
|
|
|
6685
6660
|
// ../wp-typia-project-tools/src/runtime/scaffold-package-manager-files.ts
|
|
6686
|
-
import { promises as
|
|
6661
|
+
import { promises as fsp5 } from "fs";
|
|
6687
6662
|
import { execSync as execSync2 } from "child_process";
|
|
6688
6663
|
import path9 from "path";
|
|
6689
6664
|
var LOCKFILES = {
|
|
@@ -6695,11 +6670,11 @@ var LOCKFILES = {
|
|
|
6695
6670
|
async function normalizePackageManagerFiles(targetDir, packageManagerId) {
|
|
6696
6671
|
const yarnRcPath = path9.join(targetDir, ".yarnrc.yml");
|
|
6697
6672
|
if (packageManagerId === "yarn") {
|
|
6698
|
-
await
|
|
6673
|
+
await fsp5.writeFile(yarnRcPath, `nodeLinker: node-modules
|
|
6699
6674
|
`, "utf8");
|
|
6700
6675
|
return;
|
|
6701
6676
|
}
|
|
6702
|
-
await
|
|
6677
|
+
await fsp5.rm(yarnRcPath, { force: true });
|
|
6703
6678
|
}
|
|
6704
6679
|
async function normalizePackageJson(targetDir, packageManagerId) {
|
|
6705
6680
|
const packageJsonPath = path9.join(targetDir, "package.json");
|
|
@@ -6721,7 +6696,7 @@ async function normalizePackageJson(targetDir, packageManagerId) {
|
|
|
6721
6696
|
}
|
|
6722
6697
|
}
|
|
6723
6698
|
}
|
|
6724
|
-
await
|
|
6699
|
+
await fsp5.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, "\t")}
|
|
6725
6700
|
`, "utf8");
|
|
6726
6701
|
}
|
|
6727
6702
|
async function removeUnexpectedLockfiles(targetDir, packageManagerId) {
|
|
@@ -6731,7 +6706,7 @@ async function removeUnexpectedLockfiles(targetDir, packageManagerId) {
|
|
|
6731
6706
|
if (keep.has(filename)) {
|
|
6732
6707
|
return;
|
|
6733
6708
|
}
|
|
6734
|
-
await
|
|
6709
|
+
await fsp5.rm(path9.join(targetDir, filename), { force: true });
|
|
6735
6710
|
}));
|
|
6736
6711
|
}
|
|
6737
6712
|
async function defaultInstallDependencies({
|
|
@@ -6849,11 +6824,11 @@ var LOCKFILES2 = {
|
|
|
6849
6824
|
yarn: ["yarn.lock"]
|
|
6850
6825
|
};
|
|
6851
6826
|
async function ensureDirectory(targetDir, allowExisting = false) {
|
|
6852
|
-
await
|
|
6827
|
+
await fsp6.mkdir(targetDir, { recursive: true });
|
|
6853
6828
|
if (allowExisting) {
|
|
6854
6829
|
return;
|
|
6855
6830
|
}
|
|
6856
|
-
const entries = await
|
|
6831
|
+
const entries = await fsp6.readdir(targetDir);
|
|
6857
6832
|
if (entries.length > 0) {
|
|
6858
6833
|
throw new Error(formatNonEmptyTargetDirectoryError(targetDir));
|
|
6859
6834
|
}
|
|
@@ -6865,23 +6840,23 @@ async function writeStarterManifestFiles2(targetDir, templateId, variables, arti
|
|
|
6865
6840
|
})) : getStarterManifestFiles(templateId, variables);
|
|
6866
6841
|
for (const { document, relativePath } of manifests) {
|
|
6867
6842
|
const destinationPath = path11.join(targetDir, relativePath);
|
|
6868
|
-
await
|
|
6869
|
-
await
|
|
6843
|
+
await fsp6.mkdir(path11.dirname(destinationPath), { recursive: true });
|
|
6844
|
+
await fsp6.writeFile(destinationPath, stringifyStarterManifest(document), "utf8");
|
|
6870
6845
|
}
|
|
6871
6846
|
}
|
|
6872
6847
|
async function writeBuiltInStructuralArtifacts(targetDir, artifacts) {
|
|
6873
6848
|
for (const artifact of artifacts) {
|
|
6874
6849
|
const destinationDir = path11.join(targetDir, artifact.relativeDir);
|
|
6875
|
-
await
|
|
6876
|
-
await
|
|
6877
|
-
await
|
|
6850
|
+
await fsp6.mkdir(destinationDir, { recursive: true });
|
|
6851
|
+
await fsp6.writeFile(path11.join(destinationDir, "types.ts"), artifact.typesSource, "utf8");
|
|
6852
|
+
await fsp6.writeFile(path11.join(destinationDir, "block.json"), stringifyBuiltInBlockJsonDocument(artifact.blockJsonDocument), "utf8");
|
|
6878
6853
|
}
|
|
6879
6854
|
}
|
|
6880
6855
|
async function writeBuiltInCodeArtifacts(targetDir, codeArtifacts) {
|
|
6881
6856
|
for (const artifact of codeArtifacts) {
|
|
6882
6857
|
const destinationPath = path11.join(targetDir, artifact.relativePath);
|
|
6883
|
-
await
|
|
6884
|
-
await
|
|
6858
|
+
await fsp6.mkdir(path11.dirname(destinationPath), { recursive: true });
|
|
6859
|
+
await fsp6.writeFile(destinationPath, artifact.source, "utf8");
|
|
6885
6860
|
}
|
|
6886
6861
|
}
|
|
6887
6862
|
async function resolveScaffoldGeneratorNodeModulesPath2() {
|
|
@@ -6908,11 +6883,11 @@ async function withEphemeralScaffoldNodeModules2(targetDir, callback) {
|
|
|
6908
6883
|
if (!sourceNodeModulesPath) {
|
|
6909
6884
|
throw new Error("Unable to resolve a node_modules directory with typia for scaffold-time REST artifact generation.");
|
|
6910
6885
|
}
|
|
6911
|
-
await
|
|
6886
|
+
await fsp6.symlink(sourceNodeModulesPath, targetNodeModulesPath, EPHEMERAL_NODE_MODULES_LINK_TYPE2);
|
|
6912
6887
|
try {
|
|
6913
6888
|
await callback();
|
|
6914
6889
|
} finally {
|
|
6915
|
-
await
|
|
6890
|
+
await fsp6.rm(targetNodeModulesPath, { force: true, recursive: true });
|
|
6916
6891
|
}
|
|
6917
6892
|
}
|
|
6918
6893
|
async function seedBuiltInPersistenceArtifacts2(targetDir, templateId, variables) {
|
|
@@ -6941,17 +6916,17 @@ async function seedBuiltInPersistenceArtifacts2(targetDir, templateId, variables
|
|
|
6941
6916
|
async function normalizePackageManagerFiles2(targetDir, packageManagerId) {
|
|
6942
6917
|
const yarnRcPath = path11.join(targetDir, ".yarnrc.yml");
|
|
6943
6918
|
if (packageManagerId === "yarn") {
|
|
6944
|
-
await
|
|
6919
|
+
await fsp6.writeFile(yarnRcPath, `nodeLinker: node-modules
|
|
6945
6920
|
`, "utf8");
|
|
6946
6921
|
return;
|
|
6947
6922
|
}
|
|
6948
|
-
await
|
|
6923
|
+
await fsp6.rm(yarnRcPath, { force: true });
|
|
6949
6924
|
}
|
|
6950
6925
|
async function removeQueryLoopPlaceholderFiles(projectDir, templateId) {
|
|
6951
6926
|
if (templateId !== "query-loop") {
|
|
6952
6927
|
return;
|
|
6953
6928
|
}
|
|
6954
|
-
await
|
|
6929
|
+
await fsp6.rm(path11.join(projectDir, "src", "validator-toolkit.ts"), {
|
|
6955
6930
|
force: true
|
|
6956
6931
|
});
|
|
6957
6932
|
}
|
|
@@ -6962,7 +6937,7 @@ async function removeUnexpectedLockfiles2(targetDir, packageManagerId) {
|
|
|
6962
6937
|
if (keep.has(filename)) {
|
|
6963
6938
|
return;
|
|
6964
6939
|
}
|
|
6965
|
-
await
|
|
6940
|
+
await fsp6.rm(path11.join(targetDir, filename), { force: true });
|
|
6966
6941
|
}));
|
|
6967
6942
|
}
|
|
6968
6943
|
async function replaceTextRecursively(targetDir, packageManagerId, {
|
|
@@ -6985,9 +6960,9 @@ async function replaceTextRecursively(targetDir, packageManagerId, {
|
|
|
6985
6960
|
manifestPaths: repositoryManifestPaths
|
|
6986
6961
|
});
|
|
6987
6962
|
async function visit(currentPath) {
|
|
6988
|
-
const stats = await
|
|
6963
|
+
const stats = await fsp6.stat(currentPath);
|
|
6989
6964
|
if (stats.isDirectory()) {
|
|
6990
|
-
const entries = await
|
|
6965
|
+
const entries = await fsp6.readdir(currentPath);
|
|
6991
6966
|
for (const entry of entries) {
|
|
6992
6967
|
await visit(path11.join(currentPath, entry));
|
|
6993
6968
|
}
|
|
@@ -6996,10 +6971,10 @@ async function replaceTextRecursively(targetDir, packageManagerId, {
|
|
|
6996
6971
|
if (path11.basename(currentPath) === "package.json" || !textExtensions.has(path11.extname(currentPath))) {
|
|
6997
6972
|
return;
|
|
6998
6973
|
}
|
|
6999
|
-
const content = await
|
|
6974
|
+
const content = await fsp6.readFile(currentPath, "utf8");
|
|
7000
6975
|
const nextContent = replaceRepositoryReferencePlaceholders(transformPackageManagerText(content, packageManagerId), resolvedRepositoryReference);
|
|
7001
6976
|
if (nextContent !== content) {
|
|
7002
|
-
await
|
|
6977
|
+
await fsp6.writeFile(currentPath, nextContent, "utf8");
|
|
7003
6978
|
}
|
|
7004
6979
|
}
|
|
7005
6980
|
await visit(targetDir);
|
|
@@ -7073,7 +7048,7 @@ async function applyBuiltInScaffoldProjectFiles({
|
|
|
7073
7048
|
});
|
|
7074
7049
|
const readmePath = path11.join(projectDir, "README.md");
|
|
7075
7050
|
if (!await pathExists(readmePath)) {
|
|
7076
|
-
await
|
|
7051
|
+
await fsp6.writeFile(readmePath, readmeContent ?? buildReadme(templateId, variables, packageManager, {
|
|
7077
7052
|
withMigrationUi,
|
|
7078
7053
|
withTestPreset,
|
|
7079
7054
|
withWpEnv
|
|
@@ -7081,7 +7056,7 @@ async function applyBuiltInScaffoldProjectFiles({
|
|
|
7081
7056
|
}
|
|
7082
7057
|
const gitignorePath = path11.join(projectDir, ".gitignore");
|
|
7083
7058
|
const existingGitignore = await readOptionalUtf8File(gitignorePath) ?? "";
|
|
7084
|
-
await
|
|
7059
|
+
await fsp6.writeFile(gitignorePath, mergeTextLines(gitignoreContent ?? buildGitignore(), existingGitignore), "utf8");
|
|
7085
7060
|
await normalizePackageJson(projectDir, packageManager);
|
|
7086
7061
|
await applyGeneratedProjectDxPackageJson({
|
|
7087
7062
|
compoundPersistenceEnabled: variables.compoundPersistenceEnabled === "true",
|
|
@@ -7117,7 +7092,7 @@ import path15 from "path";
|
|
|
7117
7092
|
// ../wp-typia-project-tools/src/runtime/template-layers.ts
|
|
7118
7093
|
import fs5 from "fs";
|
|
7119
7094
|
import path12 from "path";
|
|
7120
|
-
import { promises as
|
|
7095
|
+
import { promises as fsp7 } from "fs";
|
|
7121
7096
|
var TEMPLATE_LAYER_MANIFEST_FILENAME = "wp-typia.layers.json";
|
|
7122
7097
|
var TEMPLATE_LAYER_MANIFEST_VERSION = 1;
|
|
7123
7098
|
function resolveLayerPath(sourceRoot, relativePath) {
|
|
@@ -7129,14 +7104,14 @@ function resolveLayerPath(sourceRoot, relativePath) {
|
|
|
7129
7104
|
return targetPath;
|
|
7130
7105
|
}
|
|
7131
7106
|
async function assertNoSymlinks(sourceDir) {
|
|
7132
|
-
const stats = await
|
|
7107
|
+
const stats = await fsp7.lstat(sourceDir);
|
|
7133
7108
|
if (stats.isSymbolicLink()) {
|
|
7134
7109
|
throw new Error(`Template layer packages may not include symbolic links: ${sourceDir}`);
|
|
7135
7110
|
}
|
|
7136
7111
|
if (!stats.isDirectory()) {
|
|
7137
7112
|
return;
|
|
7138
7113
|
}
|
|
7139
|
-
for (const entry of await
|
|
7114
|
+
for (const entry of await fsp7.readdir(sourceDir)) {
|
|
7140
7115
|
await assertNoSymlinks(path12.join(sourceDir, entry));
|
|
7141
7116
|
}
|
|
7142
7117
|
}
|
|
@@ -7170,7 +7145,7 @@ async function loadExternalTemplateLayerManifest(sourceRoot) {
|
|
|
7170
7145
|
if (!fs5.existsSync(manifestPath)) {
|
|
7171
7146
|
return null;
|
|
7172
7147
|
}
|
|
7173
|
-
const raw = JSON.parse(await
|
|
7148
|
+
const raw = JSON.parse(await fsp7.readFile(manifestPath, "utf8"));
|
|
7174
7149
|
if (!isPlainObject(raw)) {
|
|
7175
7150
|
throw new Error(`${TEMPLATE_LAYER_MANIFEST_FILENAME} must export a JSON object.`);
|
|
7176
7151
|
}
|
|
@@ -7264,7 +7239,7 @@ async function resolveExternalTemplateLayers({
|
|
|
7264
7239
|
return;
|
|
7265
7240
|
}
|
|
7266
7241
|
const layerDir = resolveLayerPath(sourceRoot, definition.path);
|
|
7267
|
-
const stats = await
|
|
7242
|
+
const stats = await fsp7.stat(layerDir).catch(() => null);
|
|
7268
7243
|
if (!stats || !stats.isDirectory()) {
|
|
7269
7244
|
throw new Error(`Layer "${layerId}" points to a missing directory: ${definition.path}`);
|
|
7270
7245
|
}
|
|
@@ -7303,7 +7278,7 @@ async function assertExternalTemplateLayersDoNotWriteProtectedOutputs({
|
|
|
7303
7278
|
|
|
7304
7279
|
// ../wp-typia-project-tools/src/runtime/template-source-external.ts
|
|
7305
7280
|
import fs7 from "fs";
|
|
7306
|
-
import { promises as
|
|
7281
|
+
import { promises as fsp8 } from "fs";
|
|
7307
7282
|
import path13 from "path";
|
|
7308
7283
|
import { pathToFileURL } from "url";
|
|
7309
7284
|
|
|
@@ -7473,7 +7448,7 @@ async function loadExternalTemplateConfig(sourceDir) {
|
|
|
7473
7448
|
label: `External template config "${entryPath}"`,
|
|
7474
7449
|
maxBytes: getExternalTemplateConfigMaxBytes()
|
|
7475
7450
|
});
|
|
7476
|
-
const entryStats = await
|
|
7451
|
+
const entryStats = await fsp8.stat(entryPath);
|
|
7477
7452
|
const moduleUrl = `${pathToFileURL(entryPath).href}?mtime=${entryStats.mtimeMs}`;
|
|
7478
7453
|
const loadedModule = await withExternalTemplateTimeout(`loading external template config "${entryPath}"`, () => import(moduleUrl));
|
|
7479
7454
|
const loadedConfig = loadedModule.default ?? loadedModule;
|
|
@@ -7612,7 +7587,7 @@ async function renderCreateBlockExternalTemplate(sourceDir, context, requestedVa
|
|
|
7612
7587
|
|
|
7613
7588
|
// ../wp-typia-project-tools/src/runtime/template-source-remote.ts
|
|
7614
7589
|
import fs8 from "fs";
|
|
7615
|
-
import { promises as
|
|
7590
|
+
import { promises as fsp9 } from "fs";
|
|
7616
7591
|
import path14 from "path";
|
|
7617
7592
|
async function cleanupSeedRootPair(cleanup, seedCleanup) {
|
|
7618
7593
|
let cleanupError;
|
|
@@ -7640,7 +7615,7 @@ async function readRemoteBlockJsonAsync(blockDir) {
|
|
|
7640
7615
|
path14.join(sourceRoot, "block.json")
|
|
7641
7616
|
]) {
|
|
7642
7617
|
if (await pathExists(candidate)) {
|
|
7643
|
-
return JSON.parse(await
|
|
7618
|
+
return JSON.parse(await fsp9.readFile(candidate, "utf8"));
|
|
7644
7619
|
}
|
|
7645
7620
|
}
|
|
7646
7621
|
throw new Error(`Unable to locate block.json in ${blockDir}`);
|
|
@@ -7667,7 +7642,7 @@ async function readTemplatePackageJsonAsync(sourceDir) {
|
|
|
7667
7642
|
maxBytes: getExternalTemplatePackageJsonMaxBytes()
|
|
7668
7643
|
});
|
|
7669
7644
|
return {
|
|
7670
|
-
packageJson: JSON.parse(await
|
|
7645
|
+
packageJson: JSON.parse(await fsp9.readFile(candidate, "utf8")),
|
|
7671
7646
|
sourcePath: candidate
|
|
7672
7647
|
};
|
|
7673
7648
|
} catch (error) {
|
|
@@ -7702,7 +7677,7 @@ async function normalizeWpTypiaTemplateSeed(seed) {
|
|
|
7702
7677
|
}
|
|
7703
7678
|
});
|
|
7704
7679
|
if (seed.assetsDir && await pathExists(seed.assetsDir)) {
|
|
7705
|
-
await
|
|
7680
|
+
await fsp9.cp(seed.assetsDir, path14.join(normalizedDir, "assets"), {
|
|
7706
7681
|
recursive: true,
|
|
7707
7682
|
force: true
|
|
7708
7683
|
});
|
|
@@ -7793,9 +7768,9 @@ async function rewriteBlockJsonImports(directory) {
|
|
|
7793
7768
|
const textExtensions = new Set([".js", ".jsx", ".ts", ".tsx"]);
|
|
7794
7769
|
const targetBlockJsonPath = path14.join(directory, "block.json");
|
|
7795
7770
|
async function visit(currentPath) {
|
|
7796
|
-
const stats = await
|
|
7771
|
+
const stats = await fsp9.stat(currentPath);
|
|
7797
7772
|
if (stats.isDirectory()) {
|
|
7798
|
-
const entries = await
|
|
7773
|
+
const entries = await fsp9.readdir(currentPath);
|
|
7799
7774
|
for (const entry of entries) {
|
|
7800
7775
|
await visit(path14.join(currentPath, entry));
|
|
7801
7776
|
}
|
|
@@ -7804,19 +7779,19 @@ async function rewriteBlockJsonImports(directory) {
|
|
|
7804
7779
|
if (!textExtensions.has(path14.extname(currentPath))) {
|
|
7805
7780
|
return;
|
|
7806
7781
|
}
|
|
7807
|
-
const content = await
|
|
7782
|
+
const content = await fsp9.readFile(currentPath, "utf8");
|
|
7808
7783
|
const relativeSpecifier = path14.relative(path14.dirname(currentPath), targetBlockJsonPath).replace(/\\/g, "/");
|
|
7809
7784
|
const normalizedSpecifier = relativeSpecifier.startsWith(".") ? relativeSpecifier : `./${relativeSpecifier}`;
|
|
7810
7785
|
const next = content.replace(/(['"])\.{1,2}\/[^'"]*block\.json\1/g, `$1${normalizedSpecifier}$1`);
|
|
7811
7786
|
if (next !== content) {
|
|
7812
|
-
await
|
|
7787
|
+
await fsp9.writeFile(currentPath, next, "utf8");
|
|
7813
7788
|
}
|
|
7814
7789
|
}
|
|
7815
7790
|
await visit(directory);
|
|
7816
7791
|
}
|
|
7817
7792
|
async function patchRemotePackageJson(templateDir, needsInteractivity) {
|
|
7818
7793
|
const packageJsonPath = path14.join(templateDir, "package.json.mustache");
|
|
7819
|
-
const packageJson = JSON.parse(await
|
|
7794
|
+
const packageJson = JSON.parse(await fsp9.readFile(packageJsonPath, "utf8"));
|
|
7820
7795
|
const existingDependencies = { ...packageJson.dependencies ?? {} };
|
|
7821
7796
|
const existingDevDependencies = { ...packageJson.devDependencies ?? {} };
|
|
7822
7797
|
delete existingDependencies["@wp-typia/project-tools"];
|
|
@@ -7836,7 +7811,7 @@ async function patchRemotePackageJson(templateDir, needsInteractivity) {
|
|
|
7836
7811
|
} else {
|
|
7837
7812
|
delete packageJson.dependencies;
|
|
7838
7813
|
}
|
|
7839
|
-
await
|
|
7814
|
+
await fsp9.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
|
|
7840
7815
|
`, "utf8");
|
|
7841
7816
|
}
|
|
7842
7817
|
async function getSeedSourceRoot(blockDir) {
|
|
@@ -7886,7 +7861,7 @@ async function removeSeedEntryConflicts(templateDir) {
|
|
|
7886
7861
|
"view.ts",
|
|
7887
7862
|
"view.tsx"
|
|
7888
7863
|
]) {
|
|
7889
|
-
await
|
|
7864
|
+
await fsp9.rm(path14.join(templateDir, "src", filename), { force: true });
|
|
7890
7865
|
}
|
|
7891
7866
|
}
|
|
7892
7867
|
async function normalizeCreateBlockSubset(seed, context) {
|
|
@@ -7895,7 +7870,7 @@ async function normalizeCreateBlockSubset(seed, context) {
|
|
|
7895
7870
|
const templateDir = path14.join(tempRoot, "template");
|
|
7896
7871
|
const blockJson = await readRemoteBlockJsonAsync(seed.blockDir);
|
|
7897
7872
|
const sourceRoot = await getSeedSourceRoot(seed.blockDir);
|
|
7898
|
-
await
|
|
7873
|
+
await fsp9.mkdir(templateDir, { recursive: true });
|
|
7899
7874
|
for (const layerDir of getBuiltInTemplateLayerDirs("basic")) {
|
|
7900
7875
|
if (!await pathExists(layerDir)) {
|
|
7901
7876
|
if (isOmittableBuiltInTemplateLayerDir("basic", layerDir)) {
|
|
@@ -7903,28 +7878,28 @@ async function normalizeCreateBlockSubset(seed, context) {
|
|
|
7903
7878
|
}
|
|
7904
7879
|
throw new Error(`Built-in template layer is missing: ${layerDir}`);
|
|
7905
7880
|
}
|
|
7906
|
-
await
|
|
7881
|
+
await fsp9.cp(layerDir, templateDir, {
|
|
7907
7882
|
recursive: true,
|
|
7908
7883
|
force: true
|
|
7909
7884
|
});
|
|
7910
7885
|
}
|
|
7911
7886
|
await removeSeedEntryConflicts(templateDir);
|
|
7912
|
-
await
|
|
7887
|
+
await fsp9.cp(sourceRoot, path14.join(templateDir, "src"), {
|
|
7913
7888
|
recursive: true,
|
|
7914
7889
|
force: true
|
|
7915
7890
|
});
|
|
7916
7891
|
const remoteRenderPath = await findSeedRenderPhp(seed);
|
|
7917
7892
|
if (remoteRenderPath) {
|
|
7918
|
-
await
|
|
7893
|
+
await fsp9.copyFile(remoteRenderPath, path14.join(templateDir, "render.php"));
|
|
7919
7894
|
}
|
|
7920
7895
|
if (seed.assetsDir && await pathExists(seed.assetsDir)) {
|
|
7921
|
-
await
|
|
7896
|
+
await fsp9.cp(seed.assetsDir, path14.join(templateDir, "assets"), {
|
|
7922
7897
|
recursive: true,
|
|
7923
7898
|
force: true
|
|
7924
7899
|
});
|
|
7925
7900
|
}
|
|
7926
|
-
await
|
|
7927
|
-
await
|
|
7901
|
+
await fsp9.writeFile(path14.join(templateDir, "src", "types.ts"), buildRemoteTypesSource(blockJson, context), "utf8");
|
|
7902
|
+
await fsp9.writeFile(path14.join(templateDir, "src", "block.json"), buildRemoteBlockJsonTemplate(blockJson), "utf8");
|
|
7928
7903
|
await rewriteBlockJsonImports(path14.join(templateDir, "src"));
|
|
7929
7904
|
const needsInteractivity = typeof blockJson.viewScriptModule === "string" || typeof blockJson.viewScript === "string" || (await Promise.all([
|
|
7930
7905
|
"view.js",
|
|
@@ -8013,7 +7988,7 @@ async function detectTemplateSourceFormat(sourceDir) {
|
|
|
8013
7988
|
// ../wp-typia-project-tools/src/runtime/template-source-seeds.ts
|
|
8014
7989
|
var import_semver = __toESM(require_semver2(), 1);
|
|
8015
7990
|
import fs11 from "fs";
|
|
8016
|
-
import { promises as
|
|
7991
|
+
import { promises as fsp11 } from "fs";
|
|
8017
7992
|
import { createRequire as createRequire2 } from "module";
|
|
8018
7993
|
import path17 from "path";
|
|
8019
7994
|
import { spawnSync } from "child_process";
|
|
@@ -11168,7 +11143,7 @@ var So = (s3) => {
|
|
|
11168
11143
|
// ../wp-typia-project-tools/src/runtime/template-source-cache.ts
|
|
11169
11144
|
import { createHash } from "crypto";
|
|
11170
11145
|
import fs10 from "fs";
|
|
11171
|
-
import { promises as
|
|
11146
|
+
import { promises as fsp10 } from "fs";
|
|
11172
11147
|
import os2 from "os";
|
|
11173
11148
|
import path16 from "path";
|
|
11174
11149
|
var EXTERNAL_TEMPLATE_CACHE_ENV = "WP_TYPIA_EXTERNAL_TEMPLATE_CACHE";
|
|
@@ -11252,7 +11227,7 @@ function createExternalTemplateCacheKey(keyParts) {
|
|
|
11252
11227
|
}
|
|
11253
11228
|
async function pathExists2(filePath) {
|
|
11254
11229
|
try {
|
|
11255
|
-
await
|
|
11230
|
+
await fsp10.access(filePath, fs10.constants.F_OK);
|
|
11256
11231
|
return true;
|
|
11257
11232
|
} catch {
|
|
11258
11233
|
return false;
|
|
@@ -11260,18 +11235,18 @@ async function pathExists2(filePath) {
|
|
|
11260
11235
|
}
|
|
11261
11236
|
async function isDirectoryPath(directory) {
|
|
11262
11237
|
try {
|
|
11263
|
-
const stats = await
|
|
11238
|
+
const stats = await fsp10.lstat(directory);
|
|
11264
11239
|
return stats.isDirectory() && !stats.isSymbolicLink();
|
|
11265
11240
|
} catch {
|
|
11266
11241
|
return false;
|
|
11267
11242
|
}
|
|
11268
11243
|
}
|
|
11269
|
-
function
|
|
11244
|
+
function getNodeErrorCode(error) {
|
|
11270
11245
|
return typeof error === "object" && error !== null && "code" in error ? String(error.code) : "";
|
|
11271
11246
|
}
|
|
11272
11247
|
async function removeTemporaryCacheEntry(entryDir) {
|
|
11273
11248
|
try {
|
|
11274
|
-
await
|
|
11249
|
+
await fsp10.rm(entryDir, { force: true, recursive: true });
|
|
11275
11250
|
} catch {}
|
|
11276
11251
|
}
|
|
11277
11252
|
function getCurrentUserCacheSegment() {
|
|
@@ -11290,7 +11265,7 @@ function getCurrentUid() {
|
|
|
11290
11265
|
}
|
|
11291
11266
|
async function isPrivateCacheDirectory(directory) {
|
|
11292
11267
|
try {
|
|
11293
|
-
const stats = await
|
|
11268
|
+
const stats = await fsp10.lstat(directory);
|
|
11294
11269
|
if (!stats.isDirectory() || stats.isSymbolicLink()) {
|
|
11295
11270
|
return false;
|
|
11296
11271
|
}
|
|
@@ -11308,11 +11283,11 @@ async function isPrivateCacheDirectory(directory) {
|
|
|
11308
11283
|
}
|
|
11309
11284
|
async function ensurePrivateCacheDirectory(directory) {
|
|
11310
11285
|
try {
|
|
11311
|
-
await
|
|
11286
|
+
await fsp10.mkdir(directory, {
|
|
11312
11287
|
mode: PRIVATE_CACHE_DIRECTORY_MODE,
|
|
11313
11288
|
recursive: true
|
|
11314
11289
|
});
|
|
11315
|
-
const stats = await
|
|
11290
|
+
const stats = await fsp10.lstat(directory);
|
|
11316
11291
|
if (!stats.isDirectory() || stats.isSymbolicLink()) {
|
|
11317
11292
|
return false;
|
|
11318
11293
|
}
|
|
@@ -11322,7 +11297,7 @@ async function ensurePrivateCacheDirectory(directory) {
|
|
|
11322
11297
|
}
|
|
11323
11298
|
if (process.platform !== "win32") {
|
|
11324
11299
|
if ((stats.mode & 63) !== 0) {
|
|
11325
|
-
await
|
|
11300
|
+
await fsp10.chmod(directory, PRIVATE_CACHE_DIRECTORY_MODE);
|
|
11326
11301
|
}
|
|
11327
11302
|
}
|
|
11328
11303
|
return isPrivateCacheDirectory(directory);
|
|
@@ -11412,7 +11387,7 @@ function parseCacheMarkerMetadata(markerText) {
|
|
|
11412
11387
|
}
|
|
11413
11388
|
async function readCacheEntryMarker(markerPath) {
|
|
11414
11389
|
try {
|
|
11415
|
-
return parseCacheMarkerMetadata(await
|
|
11390
|
+
return parseCacheMarkerMetadata(await fsp10.readFile(markerPath, "utf8"));
|
|
11416
11391
|
} catch {
|
|
11417
11392
|
return null;
|
|
11418
11393
|
}
|
|
@@ -11446,7 +11421,7 @@ async function removeCacheEntryWithinRoot(cacheRoot, entryDir) {
|
|
|
11446
11421
|
return false;
|
|
11447
11422
|
}
|
|
11448
11423
|
try {
|
|
11449
|
-
await
|
|
11424
|
+
await fsp10.rm(entryDir, { force: true, recursive: true });
|
|
11450
11425
|
return true;
|
|
11451
11426
|
} catch {
|
|
11452
11427
|
return false;
|
|
@@ -11496,7 +11471,7 @@ async function shouldSkipExternalTemplateCachePrune({
|
|
|
11496
11471
|
}
|
|
11497
11472
|
let markerText;
|
|
11498
11473
|
try {
|
|
11499
|
-
markerText = await
|
|
11474
|
+
markerText = await fsp10.readFile(getCachePruneMarkerPath(cacheRoot), "utf8");
|
|
11500
11475
|
} catch {
|
|
11501
11476
|
return false;
|
|
11502
11477
|
}
|
|
@@ -11514,7 +11489,7 @@ async function writeExternalTemplateCachePruneMarker({
|
|
|
11514
11489
|
ttlMs
|
|
11515
11490
|
}) {
|
|
11516
11491
|
try {
|
|
11517
|
-
await
|
|
11492
|
+
await fsp10.writeFile(getCachePruneMarkerPath(cacheRoot), `${JSON.stringify({
|
|
11518
11493
|
prunedAt: new Date(nowMs).toISOString(),
|
|
11519
11494
|
pruneIntervalMs,
|
|
11520
11495
|
ttlMs
|
|
@@ -11557,7 +11532,7 @@ async function pruneExternalTemplateCache(options = {}) {
|
|
|
11557
11532
|
}
|
|
11558
11533
|
let namespaceEntries;
|
|
11559
11534
|
try {
|
|
11560
|
-
namespaceEntries = await
|
|
11535
|
+
namespaceEntries = await fsp10.readdir(cacheRoot, { withFileTypes: true });
|
|
11561
11536
|
} catch {
|
|
11562
11537
|
return result;
|
|
11563
11538
|
}
|
|
@@ -11573,7 +11548,7 @@ async function pruneExternalTemplateCache(options = {}) {
|
|
|
11573
11548
|
}
|
|
11574
11549
|
let cacheEntries;
|
|
11575
11550
|
try {
|
|
11576
|
-
cacheEntries = await
|
|
11551
|
+
cacheEntries = await fsp10.readdir(namespaceDir, { withFileTypes: true });
|
|
11577
11552
|
} catch {
|
|
11578
11553
|
result.skippedEntries += 1;
|
|
11579
11554
|
continue;
|
|
@@ -11633,7 +11608,7 @@ async function findReusableExternalTemplateSourceCache(descriptor) {
|
|
|
11633
11608
|
await pruneExternalTemplateCache();
|
|
11634
11609
|
let entries;
|
|
11635
11610
|
try {
|
|
11636
|
-
entries = await
|
|
11611
|
+
entries = await fsp10.readdir(namespaceDir, { withFileTypes: true });
|
|
11637
11612
|
} catch {
|
|
11638
11613
|
return null;
|
|
11639
11614
|
}
|
|
@@ -11690,12 +11665,12 @@ async function resolveExternalTemplateSourceCache(descriptor, populateSourceDir)
|
|
|
11690
11665
|
const temporarySourceDir = path16.join(temporaryEntryDir, "source");
|
|
11691
11666
|
let populateFailed = false;
|
|
11692
11667
|
try {
|
|
11693
|
-
await
|
|
11668
|
+
await fsp10.mkdir(temporarySourceDir, {
|
|
11694
11669
|
mode: PRIVATE_CACHE_DIRECTORY_MODE,
|
|
11695
11670
|
recursive: true
|
|
11696
11671
|
});
|
|
11697
11672
|
if (process.platform !== "win32") {
|
|
11698
|
-
await
|
|
11673
|
+
await fsp10.chmod(temporaryEntryDir, PRIVATE_CACHE_DIRECTORY_MODE);
|
|
11699
11674
|
}
|
|
11700
11675
|
try {
|
|
11701
11676
|
await populateSourceDir(temporarySourceDir);
|
|
@@ -11703,14 +11678,14 @@ async function resolveExternalTemplateSourceCache(descriptor, populateSourceDir)
|
|
|
11703
11678
|
populateFailed = true;
|
|
11704
11679
|
throw error;
|
|
11705
11680
|
}
|
|
11706
|
-
await
|
|
11681
|
+
await fsp10.writeFile(path16.join(temporaryEntryDir, CACHE_MARKER_FILE), `${JSON.stringify({
|
|
11707
11682
|
createdAt: new Date().toISOString(),
|
|
11708
11683
|
key: cacheKey,
|
|
11709
11684
|
metadata: sanitizeCacheMetadata(descriptor.metadata),
|
|
11710
11685
|
namespace: descriptor.namespace
|
|
11711
11686
|
}, null, 2)}
|
|
11712
11687
|
`, "utf8");
|
|
11713
|
-
await
|
|
11688
|
+
await fsp10.rename(temporaryEntryDir, entryDir);
|
|
11714
11689
|
return {
|
|
11715
11690
|
cacheHit: false,
|
|
11716
11691
|
sourceDir
|
|
@@ -11718,12 +11693,12 @@ async function resolveExternalTemplateSourceCache(descriptor, populateSourceDir)
|
|
|
11718
11693
|
} catch (error) {
|
|
11719
11694
|
await removeTemporaryCacheEntry(temporaryEntryDir);
|
|
11720
11695
|
if (populateFailed) {
|
|
11721
|
-
if (CACHE_UNAVAILABLE_ERROR_CODES.has(
|
|
11696
|
+
if (CACHE_UNAVAILABLE_ERROR_CODES.has(getNodeErrorCode(error))) {
|
|
11722
11697
|
return null;
|
|
11723
11698
|
}
|
|
11724
11699
|
throw error;
|
|
11725
11700
|
}
|
|
11726
|
-
const errorCode =
|
|
11701
|
+
const errorCode = getNodeErrorCode(error);
|
|
11727
11702
|
if (CACHE_PUBLISH_RACE_ERROR_CODES.has(errorCode) && await isReusableFreshCacheEntry(entryDir, markerPath, sourceDir, nowMs, ttlMs)) {
|
|
11728
11703
|
return {
|
|
11729
11704
|
cacheHit: true,
|
|
@@ -11782,8 +11757,8 @@ async function downloadNpmTemplateTarball(locator, resolvedVersion, tarballUrl,
|
|
|
11782
11757
|
throw new Error(`Failed to download npm template tarball for ${locator.raw}: ${tarballResponse.status}`);
|
|
11783
11758
|
}
|
|
11784
11759
|
const tarballPath = path17.join(path17.dirname(unpackDir), "template.tgz");
|
|
11785
|
-
await
|
|
11786
|
-
await
|
|
11760
|
+
await fsp11.mkdir(unpackDir, { recursive: true });
|
|
11761
|
+
await fsp11.writeFile(tarballPath, await readBufferResponseWithLimit(tarballResponse, {
|
|
11787
11762
|
label: `npm template tarball for ${locator.raw}@${resolvedVersion}`,
|
|
11788
11763
|
maxBytes: getExternalTemplateTarballMaxBytes()
|
|
11789
11764
|
}));
|
|
@@ -11792,7 +11767,7 @@ async function downloadNpmTemplateTarball(locator, resolvedVersion, tarballUrl,
|
|
|
11792
11767
|
file: tarballPath,
|
|
11793
11768
|
strip: 1
|
|
11794
11769
|
});
|
|
11795
|
-
await
|
|
11770
|
+
await fsp11.rm(tarballPath, { force: true });
|
|
11796
11771
|
await assertNoSymlinks2(unpackDir);
|
|
11797
11772
|
}
|
|
11798
11773
|
function selectRegistryVersion(metadata, locator) {
|
|
@@ -11965,14 +11940,14 @@ function isOfficialWorkspaceTemplateSeed(seed) {
|
|
|
11965
11940
|
}
|
|
11966
11941
|
}
|
|
11967
11942
|
async function assertNoSymlinks2(sourceDir) {
|
|
11968
|
-
const stats = await
|
|
11943
|
+
const stats = await fsp11.lstat(sourceDir);
|
|
11969
11944
|
if (stats.isSymbolicLink()) {
|
|
11970
11945
|
throw new Error(`Template sources may not include symbolic links: ${sourceDir}`);
|
|
11971
11946
|
}
|
|
11972
11947
|
if (!stats.isDirectory()) {
|
|
11973
11948
|
return;
|
|
11974
11949
|
}
|
|
11975
|
-
for (const entry of await
|
|
11950
|
+
for (const entry of await fsp11.readdir(sourceDir)) {
|
|
11976
11951
|
await assertNoSymlinks2(path17.join(sourceDir, entry));
|
|
11977
11952
|
}
|
|
11978
11953
|
}
|
|
@@ -17585,15 +17560,15 @@ async function scaffoldProject({
|
|
|
17585
17560
|
});
|
|
17586
17561
|
const readmePath = path18.join(projectDir, "README.md");
|
|
17587
17562
|
if (!fs12.existsSync(readmePath)) {
|
|
17588
|
-
await
|
|
17563
|
+
await fsp12.writeFile(readmePath, buildReadme(resolvedTemplateId, variables, resolvedPackageManager, {
|
|
17589
17564
|
withMigrationUi: isBuiltInTemplate || isWorkspace ? withMigrationUi : false,
|
|
17590
17565
|
withTestPreset: isBuiltInTemplate ? withTestPreset : false,
|
|
17591
17566
|
withWpEnv: isBuiltInTemplate ? withWpEnv : false
|
|
17592
17567
|
}), "utf8");
|
|
17593
17568
|
}
|
|
17594
17569
|
const gitignorePath = path18.join(projectDir, ".gitignore");
|
|
17595
|
-
const existingGitignore = fs12.existsSync(gitignorePath) ? await
|
|
17596
|
-
await
|
|
17570
|
+
const existingGitignore = fs12.existsSync(gitignorePath) ? await fsp12.readFile(gitignorePath, "utf8") : "";
|
|
17571
|
+
await fsp12.writeFile(gitignorePath, mergeTextLines(buildGitignore(), existingGitignore), "utf8");
|
|
17597
17572
|
await normalizePackageJson(projectDir, resolvedPackageManager);
|
|
17598
17573
|
if (isBuiltInTemplate) {
|
|
17599
17574
|
const variableGroups = getScaffoldTemplateVariableGroups(variables);
|
|
@@ -17673,6 +17648,6 @@ async function resolveOptionalInteractiveExternalLayerId({
|
|
|
17673
17648
|
}
|
|
17674
17649
|
}
|
|
17675
17650
|
|
|
17676
|
-
export { syncPersistenceRestArtifacts, copyInterpolatedDirectory, listInterpolatedDirectoryOutputs, getPrimaryDevelopmentScript, getOptionalOnboardingSteps, getOptionalOnboardingNote, getOptionalOnboardingShortNote,
|
|
17651
|
+
export { syncPersistenceRestArtifacts, copyInterpolatedDirectory, listInterpolatedDirectoryOutputs, getPrimaryDevelopmentScript, getOptionalOnboardingSteps, getOptionalOnboardingNote, getOptionalOnboardingShortNote, formatNonEmptyTargetDirectoryError, require_semver2 as require_semver, parseTemplateLocator, 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 };
|
|
17677
17652
|
|
|
17678
|
-
//# debugId=
|
|
17653
|
+
//# debugId=F116A78569127ED064756E2164756E21
|