@inlang/paraglide-js 1.3.4 → 1.3.6
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/README.md +4 -4
- package/dist/cli/commands/{init.d.ts → init/command.d.ts} +1 -3
- package/dist/cli/commands/init/defaults.d.ts +13 -0
- package/dist/cli/commands/init/utils.d.ts +8 -0
- package/dist/index.js +1055 -161
- package/package.json +7 -7
- /package/dist/cli/commands/{compile.d.ts → compile/command.d.ts} +0 -0
- /package/dist/cli/commands/{compile.test.d.ts → compile/command.test.d.ts} +0 -0
- /package/dist/cli/commands/{init.test.d.ts → init/command.test.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -5540,10 +5540,10 @@ var require_compiler2 = __commonJS({
|
|
|
5540
5540
|
}
|
|
5541
5541
|
});
|
|
5542
5542
|
|
|
5543
|
-
// ../../../../lix/
|
|
5543
|
+
// ../../../../lix/packages/fs/dist/errors/FilesystemError.js
|
|
5544
5544
|
var FilesystemError;
|
|
5545
5545
|
var init_FilesystemError = __esm({
|
|
5546
|
-
"../../../../lix/
|
|
5546
|
+
"../../../../lix/packages/fs/dist/errors/FilesystemError.js"() {
|
|
5547
5547
|
"use strict";
|
|
5548
5548
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
5549
5549
|
FilesystemError = class extends Error {
|
|
@@ -5586,7 +5586,7 @@ var init_FilesystemError = __esm({
|
|
|
5586
5586
|
}
|
|
5587
5587
|
});
|
|
5588
5588
|
|
|
5589
|
-
// ../../../../lix/
|
|
5589
|
+
// ../../../../lix/packages/fs/dist/utilities/helpers.js
|
|
5590
5590
|
function assertIsAbsolutePath(path4) {
|
|
5591
5591
|
if ((path4.startsWith("/") || /^[A-Za-z]:[\\/]/.test(path4)) === false) {
|
|
5592
5592
|
{
|
|
@@ -5643,13 +5643,13 @@ function getBasename(path4) {
|
|
|
5643
5643
|
return path4.split("/").filter((x) => x).at(-1) ?? path4;
|
|
5644
5644
|
}
|
|
5645
5645
|
var init_helpers = __esm({
|
|
5646
|
-
"../../../../lix/
|
|
5646
|
+
"../../../../lix/packages/fs/dist/utilities/helpers.js"() {
|
|
5647
5647
|
"use strict";
|
|
5648
5648
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
5649
5649
|
}
|
|
5650
5650
|
});
|
|
5651
5651
|
|
|
5652
|
-
// ../../../../lix/
|
|
5652
|
+
// ../../../../lix/packages/fs/dist/memoryFs.js
|
|
5653
5653
|
function toSnapshot(fs3) {
|
|
5654
5654
|
return {
|
|
5655
5655
|
fsMap: Object.fromEntries([...fs3._state.fsMap].map(([path4, content]) => {
|
|
@@ -6057,7 +6057,7 @@ function createNodeishMemoryFs() {
|
|
|
6057
6057
|
}
|
|
6058
6058
|
}
|
|
6059
6059
|
var init_memoryFs = __esm({
|
|
6060
|
-
"../../../../lix/
|
|
6060
|
+
"../../../../lix/packages/fs/dist/memoryFs.js"() {
|
|
6061
6061
|
"use strict";
|
|
6062
6062
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
6063
6063
|
init_FilesystemError();
|
|
@@ -6065,7 +6065,7 @@ var init_memoryFs = __esm({
|
|
|
6065
6065
|
}
|
|
6066
6066
|
});
|
|
6067
6067
|
|
|
6068
|
-
// ../../../../lix/
|
|
6068
|
+
// ../../../../lix/packages/fs/dist/index.js
|
|
6069
6069
|
var dist_exports = {};
|
|
6070
6070
|
__export(dist_exports, {
|
|
6071
6071
|
assertIsAbsolutePath: () => assertIsAbsolutePath,
|
|
@@ -6078,7 +6078,7 @@ __export(dist_exports, {
|
|
|
6078
6078
|
toSnapshot: () => toSnapshot
|
|
6079
6079
|
});
|
|
6080
6080
|
var init_dist = __esm({
|
|
6081
|
-
"../../../../lix/
|
|
6081
|
+
"../../../../lix/packages/fs/dist/index.js"() {
|
|
6082
6082
|
"use strict";
|
|
6083
6083
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
6084
6084
|
init_memoryFs();
|
|
@@ -17009,8 +17009,8 @@ var require_lodash = __commonJS({
|
|
|
17009
17009
|
return value === 0 ? value : +value;
|
|
17010
17010
|
}
|
|
17011
17011
|
value = value.replace(reTrim, "");
|
|
17012
|
-
var
|
|
17013
|
-
return
|
|
17012
|
+
var isBinary2 = reIsBinary.test(value);
|
|
17013
|
+
return isBinary2 || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary2 ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
17014
17014
|
}
|
|
17015
17015
|
function keys(object) {
|
|
17016
17016
|
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
@@ -17097,8 +17097,8 @@ var require_lodash3 = __commonJS({
|
|
|
17097
17097
|
return value === 0 ? value : +value;
|
|
17098
17098
|
}
|
|
17099
17099
|
value = value.replace(reTrim, "");
|
|
17100
|
-
var
|
|
17101
|
-
return
|
|
17100
|
+
var isBinary2 = reIsBinary.test(value);
|
|
17101
|
+
return isBinary2 || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary2 ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
17102
17102
|
}
|
|
17103
17103
|
module.exports = isInteger;
|
|
17104
17104
|
}
|
|
@@ -17259,8 +17259,8 @@ var require_lodash7 = __commonJS({
|
|
|
17259
17259
|
return value === 0 ? value : +value;
|
|
17260
17260
|
}
|
|
17261
17261
|
value = value.replace(reTrim, "");
|
|
17262
|
-
var
|
|
17263
|
-
return
|
|
17262
|
+
var isBinary2 = reIsBinary.test(value);
|
|
17263
|
+
return isBinary2 || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary2 ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
17264
17264
|
}
|
|
17265
17265
|
module.exports = once;
|
|
17266
17266
|
}
|
|
@@ -20362,9 +20362,9 @@ var require_dist_node23 = __commonJS({
|
|
|
20362
20362
|
}
|
|
20363
20363
|
});
|
|
20364
20364
|
|
|
20365
|
-
// ../../../../node_modules/.pnpm/@octokit+webhooks@12.
|
|
20365
|
+
// ../../../../node_modules/.pnpm/@octokit+webhooks@12.2.0/node_modules/@octokit/webhooks/dist-node/index.js
|
|
20366
20366
|
var require_dist_node24 = __commonJS({
|
|
20367
|
-
"../../../../node_modules/.pnpm/@octokit+webhooks@12.
|
|
20367
|
+
"../../../../node_modules/.pnpm/@octokit+webhooks@12.2.0/node_modules/@octokit/webhooks/dist-node/index.js"(exports, module) {
|
|
20368
20368
|
"use strict";
|
|
20369
20369
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
20370
20370
|
var __create2 = Object.create;
|
|
@@ -20412,6 +20412,9 @@ var require_dist_node24 = __commonJS({
|
|
|
20412
20412
|
...logger
|
|
20413
20413
|
});
|
|
20414
20414
|
var emitterEventNames = [
|
|
20415
|
+
"branch_protection_configuration",
|
|
20416
|
+
"branch_protection_rule.disabled",
|
|
20417
|
+
"branch_protection_rule.enabled",
|
|
20415
20418
|
"branch_protection_rule",
|
|
20416
20419
|
"branch_protection_rule.created",
|
|
20417
20420
|
"branch_protection_rule.deleted",
|
|
@@ -20435,6 +20438,11 @@ var require_dist_node24 = __commonJS({
|
|
|
20435
20438
|
"commit_comment",
|
|
20436
20439
|
"commit_comment.created",
|
|
20437
20440
|
"create",
|
|
20441
|
+
"custom_property",
|
|
20442
|
+
"custom_property.created",
|
|
20443
|
+
"custom_property.deleted",
|
|
20444
|
+
"custom_property_values",
|
|
20445
|
+
"custom_property_values.updated",
|
|
20438
20446
|
"delete",
|
|
20439
20447
|
"dependabot_alert",
|
|
20440
20448
|
"dependabot_alert.created",
|
|
@@ -35932,7 +35940,7 @@ init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
|
35932
35940
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
35933
35941
|
import { Command as Command3 } from "commander";
|
|
35934
35942
|
|
|
35935
|
-
// src/cli/commands/compile.ts
|
|
35943
|
+
// src/cli/commands/compile/command.ts
|
|
35936
35944
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
35937
35945
|
|
|
35938
35946
|
// ../../sdk/dist/index.js
|
|
@@ -35993,6 +36001,7 @@ function lookup(languageTag, options) {
|
|
|
35993
36001
|
|
|
35994
36002
|
// ../../versioned-interfaces/language-tag/dist/validate.js
|
|
35995
36003
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
36004
|
+
var isValidLanguageTag = (languageTag) => RegExp(`${pattern}`).test(languageTag);
|
|
35996
36005
|
|
|
35997
36006
|
// ../../versioned-interfaces/translatable/dist/interface.js
|
|
35998
36007
|
var import_typebox2 = __toESM(require_typebox(), 1);
|
|
@@ -39062,16 +39071,16 @@ var createNodeishFsWithWatcher = (args) => {
|
|
|
39062
39071
|
// ../../sdk/dist/migrations/maybeCreateFirstProjectId.js
|
|
39063
39072
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
39064
39073
|
|
|
39065
|
-
// ../../../../lix/
|
|
39074
|
+
// ../../../../lix/packages/client/dist/index.js
|
|
39066
39075
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
39067
39076
|
|
|
39068
|
-
// ../../../../lix/
|
|
39077
|
+
// ../../../../lix/packages/client/dist/api.js
|
|
39069
39078
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
39070
39079
|
|
|
39071
|
-
// ../../../../lix/
|
|
39080
|
+
// ../../../../lix/packages/client/dist/openRepository.js
|
|
39072
39081
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
39073
39082
|
|
|
39074
|
-
// ../../../../lix/
|
|
39083
|
+
// ../../../../lix/packages/client/dist/helpers.js
|
|
39075
39084
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
39076
39085
|
var withProxy = ({ nodeishFs, verbose = false, description, intercept }) => {
|
|
39077
39086
|
return new Proxy(nodeishFs, {
|
|
@@ -39175,7 +39184,7 @@ function parseLixUri(uriText) {
|
|
|
39175
39184
|
};
|
|
39176
39185
|
}
|
|
39177
39186
|
|
|
39178
|
-
// ../../../../lix/
|
|
39187
|
+
// ../../../../lix/packages/client/dist/git-http/client.js
|
|
39179
39188
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
39180
39189
|
function fromValue(value) {
|
|
39181
39190
|
let queue = [value];
|
|
@@ -39299,10 +39308,10 @@ function makeHttpClient({ verbose, description, onReq, onRes }) {
|
|
|
39299
39308
|
return { request };
|
|
39300
39309
|
}
|
|
39301
39310
|
|
|
39302
|
-
// ../../../../lix/
|
|
39311
|
+
// ../../../../lix/packages/client/dist/git-http/optimize-refs.js
|
|
39303
39312
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
39304
39313
|
|
|
39305
|
-
// ../../../../lix/
|
|
39314
|
+
// ../../../../lix/packages/client/dist/git-http/helpers.js
|
|
39306
39315
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
39307
39316
|
function padHex(pad, n) {
|
|
39308
39317
|
const s = n.toString(16);
|
|
@@ -39340,7 +39349,7 @@ function decodeGitPackLines(concatenatedUint8Array) {
|
|
|
39340
39349
|
return strings;
|
|
39341
39350
|
}
|
|
39342
39351
|
|
|
39343
|
-
// ../../../../lix/
|
|
39352
|
+
// ../../../../lix/packages/client/dist/git-http/optimize-refs.js
|
|
39344
39353
|
async function optimizedRefsReq({ url, addRef }) {
|
|
39345
39354
|
if (!url.endsWith("info/refs?service=git-upload-pack")) {
|
|
39346
39355
|
return;
|
|
@@ -39400,10 +39409,10 @@ async function optimizedRefsRes({ origUrl, resBody, statusCode, resHeaders }) {
|
|
|
39400
39409
|
}
|
|
39401
39410
|
}
|
|
39402
39411
|
|
|
39403
|
-
// ../../../../lix/
|
|
39412
|
+
// ../../../../lix/packages/client/dist/openRepository.js
|
|
39404
39413
|
var import_octokit = __toESM(require_dist_node26(), 1);
|
|
39405
39414
|
|
|
39406
|
-
// ../../../../lix/
|
|
39415
|
+
// ../../../../lix/packages/client/dist/solid.js
|
|
39407
39416
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
39408
39417
|
|
|
39409
39418
|
// ../../../../node_modules/.pnpm/solid-js@1.7.11/node_modules/solid-js/dist/solid.js
|
|
@@ -40029,14 +40038,14 @@ function createProvider2(id, options) {
|
|
|
40029
40038
|
var FALLBACK2 = Symbol("fallback");
|
|
40030
40039
|
var SuspenseListContext2 = createContext2();
|
|
40031
40040
|
|
|
40032
|
-
// ../../../../lix/
|
|
40041
|
+
// ../../../../lix/packages/client/dist/solid.js
|
|
40033
40042
|
var createSignal4 = createSignal3;
|
|
40034
40043
|
var createEffect4 = createEffect3;
|
|
40035
40044
|
|
|
40036
|
-
// ../../../../lix/
|
|
40045
|
+
// ../../../../lix/packages/client/dist/git/commit.js
|
|
40037
40046
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
40038
40047
|
|
|
40039
|
-
// ../../../../lix/
|
|
40048
|
+
// ../../../../lix/packages/client/vendored/isomorphic-git/index.js
|
|
40040
40049
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
40041
40050
|
var import_async_lock = __toESM(require_async_lock(), 1);
|
|
40042
40051
|
var import_sha1 = __toESM(require_sha1(), 1);
|
|
@@ -41223,6 +41232,12 @@ var refpaths = (ref) => [
|
|
|
41223
41232
|
`refs/remotes/${ref}/HEAD`
|
|
41224
41233
|
];
|
|
41225
41234
|
var GIT_FILES = ["config", "description", "index", "shallow", "commondir"];
|
|
41235
|
+
var lock$1;
|
|
41236
|
+
async function acquireLock(ref, callback) {
|
|
41237
|
+
if (lock$1 === void 0)
|
|
41238
|
+
lock$1 = new import_async_lock.default();
|
|
41239
|
+
return lock$1.acquire(ref, callback);
|
|
41240
|
+
}
|
|
41226
41241
|
var GitRefManager = class _GitRefManager {
|
|
41227
41242
|
static async updateRemoteRefs({
|
|
41228
41243
|
fs: fs3,
|
|
@@ -41304,8 +41319,11 @@ var GitRefManager = class _GitRefManager {
|
|
|
41304
41319
|
}
|
|
41305
41320
|
}
|
|
41306
41321
|
for (const [key, value] of actualRefsToWrite) {
|
|
41307
|
-
await
|
|
41308
|
-
|
|
41322
|
+
await acquireLock(
|
|
41323
|
+
key,
|
|
41324
|
+
async () => fs3.write(join(gitdir, key), `${value.trim()}
|
|
41325
|
+
`, "utf8")
|
|
41326
|
+
);
|
|
41309
41327
|
}
|
|
41310
41328
|
return { pruned };
|
|
41311
41329
|
}
|
|
@@ -41314,19 +41332,28 @@ var GitRefManager = class _GitRefManager {
|
|
|
41314
41332
|
if (!value.match(/[0-9a-f]{40}/)) {
|
|
41315
41333
|
throw new InvalidOidError(value);
|
|
41316
41334
|
}
|
|
41317
|
-
await
|
|
41318
|
-
|
|
41335
|
+
await acquireLock(
|
|
41336
|
+
ref,
|
|
41337
|
+
async () => fs3.write(join(gitdir, ref), `${value.trim()}
|
|
41338
|
+
`, "utf8")
|
|
41339
|
+
);
|
|
41319
41340
|
}
|
|
41320
41341
|
static async writeSymbolicRef({ fs: fs3, gitdir, ref, value }) {
|
|
41321
|
-
await
|
|
41322
|
-
|
|
41342
|
+
await acquireLock(
|
|
41343
|
+
ref,
|
|
41344
|
+
async () => fs3.write(join(gitdir, ref), `ref: ${value.trim()}
|
|
41345
|
+
`, "utf8")
|
|
41346
|
+
);
|
|
41323
41347
|
}
|
|
41324
41348
|
static async deleteRef({ fs: fs3, gitdir, ref }) {
|
|
41325
41349
|
return _GitRefManager.deleteRefs({ fs: fs3, gitdir, refs: [ref] });
|
|
41326
41350
|
}
|
|
41327
41351
|
static async deleteRefs({ fs: fs3, gitdir, refs }) {
|
|
41328
41352
|
await Promise.all(refs.map((ref) => fs3.rm(join(gitdir, ref))));
|
|
41329
|
-
let text = await
|
|
41353
|
+
let text = await acquireLock(
|
|
41354
|
+
"packed-refs",
|
|
41355
|
+
async () => fs3.read(`${gitdir}/packed-refs`, { encoding: "utf8" })
|
|
41356
|
+
);
|
|
41330
41357
|
const packed = GitPackedRefs.from(text);
|
|
41331
41358
|
const beforeSize = packed.refs.size;
|
|
41332
41359
|
for (const ref of refs) {
|
|
@@ -41336,7 +41363,10 @@ var GitRefManager = class _GitRefManager {
|
|
|
41336
41363
|
}
|
|
41337
41364
|
if (packed.refs.size < beforeSize) {
|
|
41338
41365
|
text = packed.toString();
|
|
41339
|
-
await
|
|
41366
|
+
await acquireLock(
|
|
41367
|
+
"packed-refs",
|
|
41368
|
+
async () => fs3.write(`${gitdir}/packed-refs`, text, { encoding: "utf8" })
|
|
41369
|
+
);
|
|
41340
41370
|
}
|
|
41341
41371
|
}
|
|
41342
41372
|
/**
|
|
@@ -41354,7 +41384,6 @@ var GitRefManager = class _GitRefManager {
|
|
|
41354
41384
|
return ref;
|
|
41355
41385
|
}
|
|
41356
41386
|
}
|
|
41357
|
-
let sha;
|
|
41358
41387
|
if (ref.startsWith("ref: ")) {
|
|
41359
41388
|
ref = ref.slice("ref: ".length);
|
|
41360
41389
|
return _GitRefManager.resolve({ fs: fs3, gitdir, ref, depth });
|
|
@@ -41365,7 +41394,10 @@ var GitRefManager = class _GitRefManager {
|
|
|
41365
41394
|
const packedMap = await _GitRefManager.packedRefs({ fs: fs3, gitdir });
|
|
41366
41395
|
const allpaths = refpaths(ref).filter((p) => !GIT_FILES.includes(p));
|
|
41367
41396
|
for (const ref2 of allpaths) {
|
|
41368
|
-
sha = await
|
|
41397
|
+
const sha = await acquireLock(
|
|
41398
|
+
ref2,
|
|
41399
|
+
async () => await fs3.read(`${gitdir}/${ref2}`, { encoding: "utf8" }) || packedMap.get(ref2)
|
|
41400
|
+
);
|
|
41369
41401
|
if (sha) {
|
|
41370
41402
|
return _GitRefManager.resolve({ fs: fs3, gitdir, ref: sha.trim(), depth });
|
|
41371
41403
|
}
|
|
@@ -41387,7 +41419,11 @@ var GitRefManager = class _GitRefManager {
|
|
|
41387
41419
|
const packedMap = await _GitRefManager.packedRefs({ fs: fs3, gitdir });
|
|
41388
41420
|
const allpaths = refpaths(ref);
|
|
41389
41421
|
for (const ref2 of allpaths) {
|
|
41390
|
-
|
|
41422
|
+
const refExists = await acquireLock(
|
|
41423
|
+
ref2,
|
|
41424
|
+
async () => fs3.exists(`${gitdir}/${ref2}`)
|
|
41425
|
+
);
|
|
41426
|
+
if (refExists)
|
|
41391
41427
|
return ref2;
|
|
41392
41428
|
if (packedMap.has(ref2))
|
|
41393
41429
|
return ref2;
|
|
@@ -41431,7 +41467,10 @@ var GitRefManager = class _GitRefManager {
|
|
|
41431
41467
|
throw new NotFoundError(ref);
|
|
41432
41468
|
}
|
|
41433
41469
|
static async packedRefs({ fs: fs3, gitdir }) {
|
|
41434
|
-
const text = await
|
|
41470
|
+
const text = await acquireLock(
|
|
41471
|
+
"packed-refs",
|
|
41472
|
+
async () => fs3.read(`${gitdir}/packed-refs`, { encoding: "utf8" })
|
|
41473
|
+
);
|
|
41435
41474
|
const packed = GitPackedRefs.from(text);
|
|
41436
41475
|
return packed.refs;
|
|
41437
41476
|
}
|
|
@@ -44399,7 +44438,7 @@ async function _branch({
|
|
|
44399
44438
|
gitdir,
|
|
44400
44439
|
ref,
|
|
44401
44440
|
object,
|
|
44402
|
-
checkout:
|
|
44441
|
+
checkout: checkout4 = false,
|
|
44403
44442
|
force = false
|
|
44404
44443
|
}) {
|
|
44405
44444
|
if (ref !== import_clean_git_ref.default.clean(ref)) {
|
|
@@ -44420,7 +44459,7 @@ async function _branch({
|
|
|
44420
44459
|
if (oid) {
|
|
44421
44460
|
await GitRefManager.writeRef({ fs: fs3, gitdir, ref: fullref, value: oid });
|
|
44422
44461
|
}
|
|
44423
|
-
if (
|
|
44462
|
+
if (checkout4) {
|
|
44424
44463
|
await GitRefManager.writeSymbolicRef({
|
|
44425
44464
|
fs: fs3,
|
|
44426
44465
|
gitdir,
|
|
@@ -44435,7 +44474,7 @@ async function branch({
|
|
|
44435
44474
|
gitdir = join(dir, ".git"),
|
|
44436
44475
|
ref,
|
|
44437
44476
|
object,
|
|
44438
|
-
checkout:
|
|
44477
|
+
checkout: checkout4 = false,
|
|
44439
44478
|
force = false
|
|
44440
44479
|
}) {
|
|
44441
44480
|
try {
|
|
@@ -44447,7 +44486,7 @@ async function branch({
|
|
|
44447
44486
|
gitdir,
|
|
44448
44487
|
ref,
|
|
44449
44488
|
object,
|
|
44450
|
-
checkout:
|
|
44489
|
+
checkout: checkout4,
|
|
44451
44490
|
force
|
|
44452
44491
|
});
|
|
44453
44492
|
} catch (err) {
|
|
@@ -45336,14 +45375,14 @@ var GitRemoteManager = class {
|
|
|
45336
45375
|
);
|
|
45337
45376
|
}
|
|
45338
45377
|
};
|
|
45339
|
-
var lock$
|
|
45378
|
+
var lock$2 = null;
|
|
45340
45379
|
var GitShallowManager = class {
|
|
45341
45380
|
static async read({ fs: fs3, gitdir }) {
|
|
45342
|
-
if (lock$
|
|
45343
|
-
lock$
|
|
45381
|
+
if (lock$2 === null)
|
|
45382
|
+
lock$2 = new import_async_lock.default();
|
|
45344
45383
|
const filepath = join(gitdir, "shallow");
|
|
45345
45384
|
const oids = /* @__PURE__ */ new Set();
|
|
45346
|
-
await lock$
|
|
45385
|
+
await lock$2.acquire(filepath, async function() {
|
|
45347
45386
|
const text = await fs3.read(filepath, { encoding: "utf8" });
|
|
45348
45387
|
if (text === null)
|
|
45349
45388
|
return oids;
|
|
@@ -45354,18 +45393,18 @@ var GitShallowManager = class {
|
|
|
45354
45393
|
return oids;
|
|
45355
45394
|
}
|
|
45356
45395
|
static async write({ fs: fs3, gitdir, oids }) {
|
|
45357
|
-
if (lock$
|
|
45358
|
-
lock$
|
|
45396
|
+
if (lock$2 === null)
|
|
45397
|
+
lock$2 = new import_async_lock.default();
|
|
45359
45398
|
const filepath = join(gitdir, "shallow");
|
|
45360
45399
|
if (oids.size > 0) {
|
|
45361
45400
|
const text = [...oids].join("\n") + "\n";
|
|
45362
|
-
await lock$
|
|
45401
|
+
await lock$2.acquire(filepath, async function() {
|
|
45363
45402
|
await fs3.write(filepath, text, {
|
|
45364
45403
|
encoding: "utf8"
|
|
45365
45404
|
});
|
|
45366
45405
|
});
|
|
45367
45406
|
} else {
|
|
45368
|
-
await lock$
|
|
45407
|
+
await lock$2.acquire(filepath, async function() {
|
|
45369
45408
|
await fs3.rm(filepath);
|
|
45370
45409
|
});
|
|
45371
45410
|
}
|
|
@@ -48922,7 +48961,7 @@ async function _renameBranch({
|
|
|
48922
48961
|
gitdir,
|
|
48923
48962
|
oldref,
|
|
48924
48963
|
ref,
|
|
48925
|
-
checkout:
|
|
48964
|
+
checkout: checkout4 = false
|
|
48926
48965
|
}) {
|
|
48927
48966
|
if (ref !== import_clean_git_ref.default.clean(ref)) {
|
|
48928
48967
|
throw new InvalidRefNameError(ref, import_clean_git_ref.default.clean(ref));
|
|
@@ -48950,7 +48989,7 @@ async function _renameBranch({
|
|
|
48950
48989
|
fullname: true
|
|
48951
48990
|
});
|
|
48952
48991
|
const isCurrentBranch = fullCurrentBranchRef === fulloldref;
|
|
48953
|
-
if (
|
|
48992
|
+
if (checkout4 || isCurrentBranch) {
|
|
48954
48993
|
await GitRefManager.writeSymbolicRef({
|
|
48955
48994
|
fs: fs3,
|
|
48956
48995
|
gitdir,
|
|
@@ -48965,7 +49004,7 @@ async function renameBranch({
|
|
|
48965
49004
|
gitdir = join(dir, ".git"),
|
|
48966
49005
|
ref,
|
|
48967
49006
|
oldref,
|
|
48968
|
-
checkout:
|
|
49007
|
+
checkout: checkout4 = false
|
|
48969
49008
|
}) {
|
|
48970
49009
|
try {
|
|
48971
49010
|
assertParameter("fs", fs3);
|
|
@@ -48977,7 +49016,7 @@ async function renameBranch({
|
|
|
48977
49016
|
gitdir,
|
|
48978
49017
|
ref,
|
|
48979
49018
|
oldref,
|
|
48980
|
-
checkout:
|
|
49019
|
+
checkout: checkout4
|
|
48981
49020
|
});
|
|
48982
49021
|
} catch (err) {
|
|
48983
49022
|
err.caller = "git.renameBranch";
|
|
@@ -49200,9 +49239,9 @@ async function status({
|
|
|
49200
49239
|
async function getOidAtPath({ fs: fs3, cache, gitdir, tree, path: path4 }) {
|
|
49201
49240
|
if (typeof path4 === "string")
|
|
49202
49241
|
path4 = path4.split("/");
|
|
49203
|
-
const
|
|
49242
|
+
const dirname3 = path4.shift();
|
|
49204
49243
|
for (const entry of tree) {
|
|
49205
|
-
if (entry.path ===
|
|
49244
|
+
if (entry.path === dirname3) {
|
|
49206
49245
|
if (path4.length === 0) {
|
|
49207
49246
|
return entry.oid;
|
|
49208
49247
|
}
|
|
@@ -49649,6 +49688,241 @@ async function writeTree({ fs: fs3, dir, gitdir = join(dir, ".git"), tree }) {
|
|
|
49649
49688
|
throw err;
|
|
49650
49689
|
}
|
|
49651
49690
|
}
|
|
49691
|
+
async function writeRefsAdResponse({ capabilities, refs, symrefs }) {
|
|
49692
|
+
const stream = [];
|
|
49693
|
+
let syms = "";
|
|
49694
|
+
for (const [key, value] of Object.entries(symrefs)) {
|
|
49695
|
+
syms += `symref=${key}:${value} `;
|
|
49696
|
+
}
|
|
49697
|
+
let caps = `\0${[...capabilities].join(" ")} ${syms}agent=${pkg.agent}`;
|
|
49698
|
+
for (const [key, value] of Object.entries(refs)) {
|
|
49699
|
+
stream.push(GitPktLine.encode(`${value} ${key}${caps}
|
|
49700
|
+
`));
|
|
49701
|
+
caps = "";
|
|
49702
|
+
}
|
|
49703
|
+
stream.push(GitPktLine.flush());
|
|
49704
|
+
return stream;
|
|
49705
|
+
}
|
|
49706
|
+
async function uploadPack({
|
|
49707
|
+
fs: fs3,
|
|
49708
|
+
dir,
|
|
49709
|
+
gitdir = join(dir, ".git"),
|
|
49710
|
+
advertiseRefs = false
|
|
49711
|
+
}) {
|
|
49712
|
+
try {
|
|
49713
|
+
if (advertiseRefs) {
|
|
49714
|
+
const capabilities = [
|
|
49715
|
+
"thin-pack",
|
|
49716
|
+
"side-band",
|
|
49717
|
+
"side-band-64k",
|
|
49718
|
+
"shallow",
|
|
49719
|
+
"deepen-since",
|
|
49720
|
+
"deepen-not",
|
|
49721
|
+
"allow-tip-sha1-in-want",
|
|
49722
|
+
"allow-reachable-sha1-in-want"
|
|
49723
|
+
];
|
|
49724
|
+
let keys = await GitRefManager.listRefs({
|
|
49725
|
+
fs: fs3,
|
|
49726
|
+
gitdir,
|
|
49727
|
+
filepath: "refs"
|
|
49728
|
+
});
|
|
49729
|
+
keys = keys.map((ref) => `refs/${ref}`);
|
|
49730
|
+
const refs = {};
|
|
49731
|
+
keys.unshift("HEAD");
|
|
49732
|
+
for (const key of keys) {
|
|
49733
|
+
refs[key] = await GitRefManager.resolve({ fs: fs3, gitdir, ref: key });
|
|
49734
|
+
}
|
|
49735
|
+
const symrefs = {};
|
|
49736
|
+
symrefs.HEAD = await GitRefManager.resolve({
|
|
49737
|
+
fs: fs3,
|
|
49738
|
+
gitdir,
|
|
49739
|
+
ref: "HEAD",
|
|
49740
|
+
depth: 2
|
|
49741
|
+
});
|
|
49742
|
+
return writeRefsAdResponse({
|
|
49743
|
+
capabilities,
|
|
49744
|
+
refs,
|
|
49745
|
+
symrefs
|
|
49746
|
+
});
|
|
49747
|
+
}
|
|
49748
|
+
} catch (err) {
|
|
49749
|
+
err.caller = "git.uploadPack";
|
|
49750
|
+
throw err;
|
|
49751
|
+
}
|
|
49752
|
+
}
|
|
49753
|
+
var deepget = (keys, map) => {
|
|
49754
|
+
for (const key of keys) {
|
|
49755
|
+
if (!map.has(key))
|
|
49756
|
+
map.set(key, /* @__PURE__ */ new Map());
|
|
49757
|
+
map = map.get(key);
|
|
49758
|
+
}
|
|
49759
|
+
return map;
|
|
49760
|
+
};
|
|
49761
|
+
var DeepMap = class {
|
|
49762
|
+
constructor() {
|
|
49763
|
+
this._root = /* @__PURE__ */ new Map();
|
|
49764
|
+
}
|
|
49765
|
+
set(keys, value) {
|
|
49766
|
+
const lastKey = keys.pop();
|
|
49767
|
+
const lastMap = deepget(keys, this._root);
|
|
49768
|
+
lastMap.set(lastKey, value);
|
|
49769
|
+
}
|
|
49770
|
+
get(keys) {
|
|
49771
|
+
const lastKey = keys.pop();
|
|
49772
|
+
const lastMap = deepget(keys, this._root);
|
|
49773
|
+
return lastMap.get(lastKey);
|
|
49774
|
+
}
|
|
49775
|
+
has(keys) {
|
|
49776
|
+
const lastKey = keys.pop();
|
|
49777
|
+
const lastMap = deepget(keys, this._root);
|
|
49778
|
+
return lastMap.has(lastKey);
|
|
49779
|
+
}
|
|
49780
|
+
};
|
|
49781
|
+
function fromEntries(map) {
|
|
49782
|
+
const o = {};
|
|
49783
|
+
for (const [key, value] of map) {
|
|
49784
|
+
o[key] = value;
|
|
49785
|
+
}
|
|
49786
|
+
return o;
|
|
49787
|
+
}
|
|
49788
|
+
function fromNodeStream(stream) {
|
|
49789
|
+
const asyncIterator = Object.getOwnPropertyDescriptor(
|
|
49790
|
+
stream,
|
|
49791
|
+
Symbol.asyncIterator
|
|
49792
|
+
);
|
|
49793
|
+
if (asyncIterator && asyncIterator.enumerable) {
|
|
49794
|
+
return stream;
|
|
49795
|
+
}
|
|
49796
|
+
let ended = false;
|
|
49797
|
+
const queue = [];
|
|
49798
|
+
let defer = {};
|
|
49799
|
+
stream.on("data", (chunk) => {
|
|
49800
|
+
queue.push(chunk);
|
|
49801
|
+
if (defer.resolve) {
|
|
49802
|
+
defer.resolve({ value: queue.shift(), done: false });
|
|
49803
|
+
defer = {};
|
|
49804
|
+
}
|
|
49805
|
+
});
|
|
49806
|
+
stream.on("error", (err) => {
|
|
49807
|
+
if (defer.reject) {
|
|
49808
|
+
defer.reject(err);
|
|
49809
|
+
defer = {};
|
|
49810
|
+
}
|
|
49811
|
+
});
|
|
49812
|
+
stream.on("end", () => {
|
|
49813
|
+
ended = true;
|
|
49814
|
+
if (defer.resolve) {
|
|
49815
|
+
defer.resolve({ done: true });
|
|
49816
|
+
defer = {};
|
|
49817
|
+
}
|
|
49818
|
+
});
|
|
49819
|
+
return {
|
|
49820
|
+
next() {
|
|
49821
|
+
return new Promise((resolve3, reject) => {
|
|
49822
|
+
if (queue.length === 0 && ended) {
|
|
49823
|
+
return resolve3({ done: true });
|
|
49824
|
+
} else if (queue.length > 0) {
|
|
49825
|
+
return resolve3({ value: queue.shift(), done: false });
|
|
49826
|
+
} else if (queue.length === 0 && !ended) {
|
|
49827
|
+
defer = { resolve: resolve3, reject };
|
|
49828
|
+
}
|
|
49829
|
+
});
|
|
49830
|
+
},
|
|
49831
|
+
return() {
|
|
49832
|
+
stream.removeAllListeners();
|
|
49833
|
+
if (stream.destroy)
|
|
49834
|
+
stream.destroy();
|
|
49835
|
+
},
|
|
49836
|
+
[Symbol.asyncIterator]() {
|
|
49837
|
+
return this;
|
|
49838
|
+
}
|
|
49839
|
+
};
|
|
49840
|
+
}
|
|
49841
|
+
function fromStream2(stream) {
|
|
49842
|
+
if (stream[Symbol.asyncIterator])
|
|
49843
|
+
return stream;
|
|
49844
|
+
const reader = stream.getReader();
|
|
49845
|
+
return {
|
|
49846
|
+
next() {
|
|
49847
|
+
return reader.read();
|
|
49848
|
+
},
|
|
49849
|
+
return() {
|
|
49850
|
+
reader.releaseLock();
|
|
49851
|
+
return {};
|
|
49852
|
+
},
|
|
49853
|
+
[Symbol.asyncIterator]() {
|
|
49854
|
+
return this;
|
|
49855
|
+
}
|
|
49856
|
+
};
|
|
49857
|
+
}
|
|
49858
|
+
function isBinary(buffer) {
|
|
49859
|
+
const MAX_XDIFF_SIZE = 1024 * 1024 * 1023;
|
|
49860
|
+
if (buffer.length > MAX_XDIFF_SIZE)
|
|
49861
|
+
return true;
|
|
49862
|
+
return buffer.slice(0, 8e3).some((value) => value === 0);
|
|
49863
|
+
}
|
|
49864
|
+
async function sleep(ms) {
|
|
49865
|
+
return new Promise((resolve3, reject) => setTimeout(resolve3, ms));
|
|
49866
|
+
}
|
|
49867
|
+
async function parseUploadPackRequest(stream) {
|
|
49868
|
+
const read = GitPktLine.streamReader(stream);
|
|
49869
|
+
let done = false;
|
|
49870
|
+
let capabilities = null;
|
|
49871
|
+
const wants = [];
|
|
49872
|
+
const haves = [];
|
|
49873
|
+
const shallows = [];
|
|
49874
|
+
let depth;
|
|
49875
|
+
let since;
|
|
49876
|
+
const exclude = [];
|
|
49877
|
+
let relative = false;
|
|
49878
|
+
while (!done) {
|
|
49879
|
+
const line = await read();
|
|
49880
|
+
if (line === true)
|
|
49881
|
+
break;
|
|
49882
|
+
if (line === null)
|
|
49883
|
+
continue;
|
|
49884
|
+
const [key, value, ...rest] = line.toString("utf8").trim().split(" ");
|
|
49885
|
+
if (!capabilities)
|
|
49886
|
+
capabilities = rest;
|
|
49887
|
+
switch (key) {
|
|
49888
|
+
case "want":
|
|
49889
|
+
wants.push(value);
|
|
49890
|
+
break;
|
|
49891
|
+
case "have":
|
|
49892
|
+
haves.push(value);
|
|
49893
|
+
break;
|
|
49894
|
+
case "shallow":
|
|
49895
|
+
shallows.push(value);
|
|
49896
|
+
break;
|
|
49897
|
+
case "deepen":
|
|
49898
|
+
depth = parseInt(value);
|
|
49899
|
+
break;
|
|
49900
|
+
case "deepen-since":
|
|
49901
|
+
since = parseInt(value);
|
|
49902
|
+
break;
|
|
49903
|
+
case "deepen-not":
|
|
49904
|
+
exclude.push(value);
|
|
49905
|
+
break;
|
|
49906
|
+
case "deepen-relative":
|
|
49907
|
+
relative = true;
|
|
49908
|
+
break;
|
|
49909
|
+
case "done":
|
|
49910
|
+
done = true;
|
|
49911
|
+
break;
|
|
49912
|
+
}
|
|
49913
|
+
}
|
|
49914
|
+
return {
|
|
49915
|
+
capabilities,
|
|
49916
|
+
wants,
|
|
49917
|
+
haves,
|
|
49918
|
+
shallows,
|
|
49919
|
+
depth,
|
|
49920
|
+
since,
|
|
49921
|
+
exclude,
|
|
49922
|
+
relative,
|
|
49923
|
+
done
|
|
49924
|
+
};
|
|
49925
|
+
}
|
|
49652
49926
|
var index = {
|
|
49653
49927
|
Errors,
|
|
49654
49928
|
STAGE,
|
|
@@ -49712,16 +49986,134 @@ var index = {
|
|
|
49712
49986
|
tag,
|
|
49713
49987
|
version,
|
|
49714
49988
|
walk,
|
|
49989
|
+
_walk,
|
|
49715
49990
|
writeBlob,
|
|
49716
49991
|
writeCommit,
|
|
49717
49992
|
writeObject,
|
|
49718
49993
|
writeRef,
|
|
49719
49994
|
writeTag,
|
|
49720
|
-
writeTree
|
|
49995
|
+
writeTree,
|
|
49996
|
+
_listObjects: listObjects,
|
|
49997
|
+
_pack,
|
|
49998
|
+
_uploadPack: uploadPack,
|
|
49999
|
+
_GitConfigManager: GitConfigManager,
|
|
50000
|
+
_GitIgnoreManager: GitIgnoreManager,
|
|
50001
|
+
_GitIndexManager: GitIndexManager,
|
|
50002
|
+
_GitRefManager: GitRefManager,
|
|
50003
|
+
_GitRemoteHTTP: GitRemoteHTTP,
|
|
50004
|
+
_GitRemoteManager: GitRemoteManager,
|
|
50005
|
+
_GitShallowManager: GitShallowManager,
|
|
50006
|
+
_FileSystem: FileSystem,
|
|
50007
|
+
_GitAnnotatedTag: GitAnnotatedTag,
|
|
50008
|
+
_GitCommit: GitCommit,
|
|
50009
|
+
_GitConfig: GitConfig,
|
|
50010
|
+
_GitIndex: GitIndex,
|
|
50011
|
+
_GitObject: GitObject,
|
|
50012
|
+
_GitPackIndex: GitPackIndex,
|
|
50013
|
+
_GitPktLine: GitPktLine,
|
|
50014
|
+
_GitRefSpec: GitRefSpec,
|
|
50015
|
+
_GitRefSpecSet: GitRefSpecSet,
|
|
50016
|
+
_GitSideBand: GitSideBand,
|
|
50017
|
+
_GitTree: GitTree,
|
|
50018
|
+
_GitWalkerFs: GitWalkerFs,
|
|
50019
|
+
_GitWalkerIndex: GitWalkerIndex,
|
|
50020
|
+
_GitWalkerRepo: GitWalkerRepo,
|
|
50021
|
+
_RunningMinimum: RunningMinimum,
|
|
50022
|
+
_expandOid,
|
|
50023
|
+
_expandOidLoose: expandOidLoose,
|
|
50024
|
+
_expandOidPacked: expandOidPacked,
|
|
50025
|
+
_hasObject: hasObject,
|
|
50026
|
+
_hasObjectLoose: hasObjectLoose,
|
|
50027
|
+
_hasObjectPacked: hasObjectPacked,
|
|
50028
|
+
_hashObject: hashObject,
|
|
50029
|
+
_readObject,
|
|
50030
|
+
_readObjectLoose: readObjectLoose,
|
|
50031
|
+
_readObjectPacked: readObjectPacked,
|
|
50032
|
+
_readPackIndex: readPackIndex,
|
|
50033
|
+
_writeObject,
|
|
50034
|
+
_writeObjectLoose: writeObjectLoose,
|
|
50035
|
+
_BufferCursor: BufferCursor,
|
|
50036
|
+
_DeepMap: DeepMap,
|
|
50037
|
+
_FIFO: FIFO,
|
|
50038
|
+
_StreamReader: StreamReader,
|
|
50039
|
+
_abbreviateRef: abbreviateRef,
|
|
50040
|
+
_applyDelta: applyDelta,
|
|
50041
|
+
_arrayRange: arrayRange,
|
|
50042
|
+
_assertParameter: assertParameter,
|
|
50043
|
+
// _asyncIteratorToStream,
|
|
50044
|
+
_basename: basename,
|
|
50045
|
+
_calculateBasicAuthHeader: calculateBasicAuthHeader,
|
|
50046
|
+
_collect: collect2,
|
|
50047
|
+
_compareAge: compareAge,
|
|
50048
|
+
_comparePath: comparePath,
|
|
50049
|
+
_compareRefNames: compareRefNames,
|
|
50050
|
+
_compareStats: compareStats,
|
|
50051
|
+
_compareStrings: compareStrings,
|
|
50052
|
+
_compareTreeEntryPath: compareTreeEntryPath,
|
|
50053
|
+
_deflate: deflate,
|
|
50054
|
+
_dirname: dirname,
|
|
50055
|
+
_emptyPackfile: emptyPackfile,
|
|
50056
|
+
_extractAuthFromUrl: extractAuthFromUrl,
|
|
50057
|
+
_filterCapabilities: filterCapabilities,
|
|
50058
|
+
_flat: flat,
|
|
50059
|
+
_flatFileListToDirectoryStructure: flatFileListToDirectoryStructure,
|
|
50060
|
+
_forAwait: forAwait2,
|
|
50061
|
+
_formatAuthor: formatAuthor,
|
|
50062
|
+
_formatInfoRefs: formatInfoRefs,
|
|
50063
|
+
_fromEntries: fromEntries,
|
|
50064
|
+
_fromNodeStream: fromNodeStream,
|
|
50065
|
+
_fromStream: fromStream2,
|
|
50066
|
+
_fromValue: fromValue2,
|
|
50067
|
+
_getIterator: getIterator2,
|
|
50068
|
+
_listpack: listpack,
|
|
50069
|
+
_utils_hashObject: hashObject$1,
|
|
50070
|
+
_indent: indent,
|
|
50071
|
+
_inflate: inflate,
|
|
50072
|
+
_isBinary: isBinary,
|
|
50073
|
+
_join: join,
|
|
50074
|
+
_mergeFile: mergeFile,
|
|
50075
|
+
_mergeTree: mergeTree,
|
|
50076
|
+
_mode2type: mode2type,
|
|
50077
|
+
_modified: modified,
|
|
50078
|
+
_normalizeAuthorObject: normalizeAuthorObject,
|
|
50079
|
+
_normalizeCommitterObject: normalizeCommitterObject,
|
|
50080
|
+
_normalizeMode: normalizeMode,
|
|
50081
|
+
_normalizeNewlines: normalizeNewlines,
|
|
50082
|
+
_normalizePath: normalizePath2,
|
|
50083
|
+
_normalizeStats: normalizeStats,
|
|
50084
|
+
_outdent: outdent,
|
|
50085
|
+
_padHex: padHex2,
|
|
50086
|
+
_parseAuthor: parseAuthor,
|
|
50087
|
+
_pkg: pkg,
|
|
50088
|
+
_posixifyPathBuffer: posixifyPathBuffer,
|
|
50089
|
+
_resolveBlob: resolveBlob,
|
|
50090
|
+
_resolveCommit: resolveCommit,
|
|
50091
|
+
_resolveFileIdInTree: resolveFileIdInTree,
|
|
50092
|
+
_resolveFilepath: resolveFilepath,
|
|
50093
|
+
_resolveTree: resolveTree,
|
|
50094
|
+
_rmRecursive: rmRecursive,
|
|
50095
|
+
_shasum: shasum,
|
|
50096
|
+
_sleep: sleep,
|
|
50097
|
+
_splitLines: splitLines,
|
|
50098
|
+
// _symbols,
|
|
50099
|
+
_toHex: toHex,
|
|
50100
|
+
_translateSSHtoHTTP: translateSSHtoHTTP,
|
|
50101
|
+
_unionOfIterators: unionOfIterators,
|
|
50102
|
+
_worthWalking: worthWalking,
|
|
50103
|
+
_parseCapabilitiesV2: parseCapabilitiesV2,
|
|
50104
|
+
_parseListRefsResponse: parseListRefsResponse,
|
|
50105
|
+
_parseReceivePackResponse: parseReceivePackResponse,
|
|
50106
|
+
_parseRefsAdResponse: parseRefsAdResponse,
|
|
50107
|
+
_parseUploadPackRequest: parseUploadPackRequest,
|
|
50108
|
+
_parseUploadPackResponse: parseUploadPackResponse,
|
|
50109
|
+
_writeListRefsRequest: writeListRefsRequest,
|
|
50110
|
+
_writeReceivePackRequest: writeReceivePackRequest,
|
|
50111
|
+
_writeRefsAdResponse: writeRefsAdResponse,
|
|
50112
|
+
_writeUploadPackRequest: writeUploadPackRequest
|
|
49721
50113
|
};
|
|
49722
50114
|
var isomorphic_git_default = index;
|
|
49723
50115
|
|
|
49724
|
-
// ../../../../lix/
|
|
50116
|
+
// ../../../../lix/packages/client/dist/git/commit.js
|
|
49725
50117
|
init_dist();
|
|
49726
50118
|
async function commit2({ cache, fs: fs3, dir, ref, author, message }) {
|
|
49727
50119
|
const fileStates = {};
|
|
@@ -49827,10 +50219,10 @@ async function commit2({ cache, fs: fs3, dir, ref, author, message }) {
|
|
|
49827
50219
|
});
|
|
49828
50220
|
}
|
|
49829
50221
|
|
|
49830
|
-
// ../../../../lix/
|
|
50222
|
+
// ../../../../lix/packages/client/dist/git/status-list.js
|
|
49831
50223
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
49832
50224
|
|
|
49833
|
-
// ../../../../lix/
|
|
50225
|
+
// ../../../../lix/packages/client/dist/git/helpers.js
|
|
49834
50226
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
49835
50227
|
var fileModeTypeMapping = {
|
|
49836
50228
|
"40": "folder",
|
|
@@ -49842,18 +50234,8 @@ function modeToFileType(mode) {
|
|
|
49842
50234
|
return fileModeTypeMapping[fileMode] || "unknown";
|
|
49843
50235
|
}
|
|
49844
50236
|
|
|
49845
|
-
// ../../../../lix/
|
|
50237
|
+
// ../../../../lix/packages/client/dist/git/status-list.js
|
|
49846
50238
|
var { walk: walk2, TREE: TREE2, WORKDIR: WORKDIR2, STAGE: STAGE2, isIgnored: isIgnored2 } = isomorphic_git_default;
|
|
49847
|
-
var worthWalking2 = (filepath, root) => {
|
|
49848
|
-
if (filepath === "." || root == void 0 || root.length === 0 || root === "." || root === filepath) {
|
|
49849
|
-
return true;
|
|
49850
|
-
}
|
|
49851
|
-
if (root.length > filepath.length) {
|
|
49852
|
-
return root.startsWith(filepath + "/");
|
|
49853
|
-
} else {
|
|
49854
|
-
return filepath.startsWith(root + "/");
|
|
49855
|
-
}
|
|
49856
|
-
};
|
|
49857
50239
|
function normalizePath3(path4) {
|
|
49858
50240
|
return path4.replace(/\/\.\//g, "/").replace(/\/{2,}/g, "/").replace(/^\/\.$/, "/").replace(/^\.\/$/, ".").replace(/^\.\//, "").replace(/\/\.$/, "").replace(/(.+)\/$/, "$1").replace(/^$/, ".");
|
|
49859
50241
|
}
|
|
@@ -49902,7 +50284,7 @@ async function statusList({
|
|
|
49902
50284
|
return null;
|
|
49903
50285
|
}
|
|
49904
50286
|
}
|
|
49905
|
-
if (!filepaths.some((base) =>
|
|
50287
|
+
if (!filepaths.some((base) => worthWalking(filepath, base))) {
|
|
49906
50288
|
return null;
|
|
49907
50289
|
}
|
|
49908
50290
|
if (filter && !filter(filepath)) {
|
|
@@ -50021,7 +50403,430 @@ async function statusList({
|
|
|
50021
50403
|
}
|
|
50022
50404
|
}
|
|
50023
50405
|
|
|
50024
|
-
// ../../../../lix/
|
|
50406
|
+
// ../../../../lix/packages/client/dist/git/checkout.js
|
|
50407
|
+
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
50408
|
+
|
|
50409
|
+
// ../../../../lix/packages/client/dist/git/_checkout.js
|
|
50410
|
+
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
50411
|
+
async function _checkout2({ fs: fs3, cache, onProgress, dir, gitdir, remote, ref, filepaths, noCheckout, noUpdateHead, dryRun, force, track = true }) {
|
|
50412
|
+
let oid;
|
|
50413
|
+
try {
|
|
50414
|
+
oid = await GitRefManager.resolve({ fs: fs3, gitdir, ref });
|
|
50415
|
+
} catch (err) {
|
|
50416
|
+
if (ref === "HEAD")
|
|
50417
|
+
throw err;
|
|
50418
|
+
const remoteRef = `${remote}/${ref}`;
|
|
50419
|
+
oid = await GitRefManager.resolve({
|
|
50420
|
+
fs: fs3,
|
|
50421
|
+
gitdir,
|
|
50422
|
+
ref: remoteRef
|
|
50423
|
+
});
|
|
50424
|
+
if (track) {
|
|
50425
|
+
const config2 = await GitConfigManager.get({ fs: fs3, gitdir });
|
|
50426
|
+
await config2.set(`branch.${ref}.remote`, remote);
|
|
50427
|
+
await config2.set(`branch.${ref}.merge`, `refs/heads/${ref}`);
|
|
50428
|
+
await GitConfigManager.save({ fs: fs3, gitdir, config: config2 });
|
|
50429
|
+
}
|
|
50430
|
+
await GitRefManager.writeRef({
|
|
50431
|
+
fs: fs3,
|
|
50432
|
+
gitdir,
|
|
50433
|
+
ref: `refs/heads/${ref}`,
|
|
50434
|
+
value: oid
|
|
50435
|
+
});
|
|
50436
|
+
}
|
|
50437
|
+
if (!noCheckout) {
|
|
50438
|
+
let ops;
|
|
50439
|
+
try {
|
|
50440
|
+
ops = await analyze2({
|
|
50441
|
+
fs: fs3,
|
|
50442
|
+
cache,
|
|
50443
|
+
onProgress,
|
|
50444
|
+
dir,
|
|
50445
|
+
gitdir,
|
|
50446
|
+
ref,
|
|
50447
|
+
force,
|
|
50448
|
+
filepaths
|
|
50449
|
+
});
|
|
50450
|
+
} catch (err) {
|
|
50451
|
+
if (err instanceof Errors.NotFoundError && err.data.what === oid) {
|
|
50452
|
+
throw new Errors.CommitNotFetchedError(ref, oid);
|
|
50453
|
+
} else {
|
|
50454
|
+
throw err;
|
|
50455
|
+
}
|
|
50456
|
+
}
|
|
50457
|
+
const conflicts = ops.filter(([method]) => method === "conflict").map(([method, fullpath]) => fullpath);
|
|
50458
|
+
if (conflicts.length > 0) {
|
|
50459
|
+
throw new Errors.CheckoutConflictError(conflicts);
|
|
50460
|
+
}
|
|
50461
|
+
const errors = ops.filter(([method]) => method === "error").map(([method, fullpath]) => fullpath);
|
|
50462
|
+
if (errors.length > 0) {
|
|
50463
|
+
throw new Errors.InternalError(errors.join(", "));
|
|
50464
|
+
}
|
|
50465
|
+
if (dryRun) {
|
|
50466
|
+
return;
|
|
50467
|
+
}
|
|
50468
|
+
let count = 0;
|
|
50469
|
+
const total = ops.length;
|
|
50470
|
+
await GitIndexManager.acquire({ fs: fs3, gitdir, cache }, async function(index2) {
|
|
50471
|
+
await Promise.all(
|
|
50472
|
+
// @ts-ignore
|
|
50473
|
+
ops.filter(([method]) => method === "delete" || method === "delete-index").map(async function([method, fullpath]) {
|
|
50474
|
+
const filepath = `${dir}/${fullpath}`;
|
|
50475
|
+
if (method === "delete") {
|
|
50476
|
+
await fs3.rm(filepath);
|
|
50477
|
+
}
|
|
50478
|
+
index2.delete({ filepath: fullpath });
|
|
50479
|
+
if (onProgress) {
|
|
50480
|
+
await onProgress({
|
|
50481
|
+
phase: "Updating workdir",
|
|
50482
|
+
loaded: ++count,
|
|
50483
|
+
total
|
|
50484
|
+
});
|
|
50485
|
+
}
|
|
50486
|
+
})
|
|
50487
|
+
);
|
|
50488
|
+
});
|
|
50489
|
+
await GitIndexManager.acquire({ fs: fs3, gitdir, cache }, async function(index2) {
|
|
50490
|
+
for (const [method, fullpath] of ops) {
|
|
50491
|
+
if (method === "rmdir" || method === "rmdir-index") {
|
|
50492
|
+
const filepath = `${dir}/${fullpath}`;
|
|
50493
|
+
try {
|
|
50494
|
+
if (method === "rmdir-index") {
|
|
50495
|
+
index2.delete({ filepath: fullpath });
|
|
50496
|
+
}
|
|
50497
|
+
await fs3.rmdir(filepath);
|
|
50498
|
+
if (onProgress) {
|
|
50499
|
+
await onProgress({
|
|
50500
|
+
phase: "Updating workdir",
|
|
50501
|
+
loaded: ++count,
|
|
50502
|
+
total
|
|
50503
|
+
});
|
|
50504
|
+
}
|
|
50505
|
+
} catch (e) {
|
|
50506
|
+
if (e.code === "ENOTEMPTY") {
|
|
50507
|
+
console.log(`Did not delete ${fullpath} because directory is not empty`);
|
|
50508
|
+
} else {
|
|
50509
|
+
throw e;
|
|
50510
|
+
}
|
|
50511
|
+
}
|
|
50512
|
+
}
|
|
50513
|
+
}
|
|
50514
|
+
});
|
|
50515
|
+
await Promise.all(ops.filter(([method]) => method === "mkdir" || method === "mkdir-index").map(async function([_, fullpath]) {
|
|
50516
|
+
const filepath = `${dir}/${fullpath}`;
|
|
50517
|
+
await fs3.mkdir(filepath);
|
|
50518
|
+
if (onProgress) {
|
|
50519
|
+
await onProgress({
|
|
50520
|
+
phase: "Updating workdir",
|
|
50521
|
+
loaded: ++count,
|
|
50522
|
+
total
|
|
50523
|
+
});
|
|
50524
|
+
}
|
|
50525
|
+
}));
|
|
50526
|
+
await GitIndexManager.acquire({ fs: fs3, gitdir, cache }, async function(index2) {
|
|
50527
|
+
await Promise.all(
|
|
50528
|
+
// @ts-ignore
|
|
50529
|
+
ops.filter(
|
|
50530
|
+
// @ts-ignore
|
|
50531
|
+
([method]) => method === "create" || method === "create-index" || method === "update" || method === "mkdir-index"
|
|
50532
|
+
).map(async function([method, fullpath, oid2, mode, chmod]) {
|
|
50533
|
+
const filepath = `${dir}/${fullpath}`;
|
|
50534
|
+
try {
|
|
50535
|
+
if (method !== "create-index" && method !== "mkdir-index") {
|
|
50536
|
+
const { object } = await _readObject({ fs: fs3, cache, gitdir, oid: oid2 });
|
|
50537
|
+
if (chmod) {
|
|
50538
|
+
await fs3.rm(filepath);
|
|
50539
|
+
}
|
|
50540
|
+
if (mode === 33188) {
|
|
50541
|
+
await fs3.write(filepath, object);
|
|
50542
|
+
} else if (mode === 33261) {
|
|
50543
|
+
await fs3.write(filepath, object, { mode: 511 });
|
|
50544
|
+
} else if (mode === 40960) {
|
|
50545
|
+
await fs3.writelink(filepath, object);
|
|
50546
|
+
} else {
|
|
50547
|
+
throw new Errors.InternalError(`Invalid mode 0o${mode.toString(8)} detected in blob ${oid2}`);
|
|
50548
|
+
}
|
|
50549
|
+
}
|
|
50550
|
+
const stats = await fs3.lstat(filepath);
|
|
50551
|
+
if (mode === 33261) {
|
|
50552
|
+
stats.mode = 493;
|
|
50553
|
+
}
|
|
50554
|
+
if (method === "mkdir-index") {
|
|
50555
|
+
stats.mode = 57344;
|
|
50556
|
+
}
|
|
50557
|
+
index2.insert({
|
|
50558
|
+
filepath: fullpath,
|
|
50559
|
+
stats,
|
|
50560
|
+
oid: oid2
|
|
50561
|
+
});
|
|
50562
|
+
if (onProgress) {
|
|
50563
|
+
await onProgress({
|
|
50564
|
+
phase: "Updating workdir",
|
|
50565
|
+
loaded: ++count,
|
|
50566
|
+
total
|
|
50567
|
+
});
|
|
50568
|
+
}
|
|
50569
|
+
} catch (e) {
|
|
50570
|
+
console.log(e);
|
|
50571
|
+
}
|
|
50572
|
+
})
|
|
50573
|
+
);
|
|
50574
|
+
});
|
|
50575
|
+
}
|
|
50576
|
+
if (!noUpdateHead) {
|
|
50577
|
+
const fullRef = await GitRefManager.expand({ fs: fs3, gitdir, ref });
|
|
50578
|
+
if (fullRef.startsWith("refs/heads")) {
|
|
50579
|
+
await GitRefManager.writeSymbolicRef({
|
|
50580
|
+
fs: fs3,
|
|
50581
|
+
gitdir,
|
|
50582
|
+
ref: "HEAD",
|
|
50583
|
+
value: fullRef
|
|
50584
|
+
});
|
|
50585
|
+
} else {
|
|
50586
|
+
await GitRefManager.writeRef({ fs: fs3, gitdir, ref: "HEAD", value: oid });
|
|
50587
|
+
}
|
|
50588
|
+
}
|
|
50589
|
+
}
|
|
50590
|
+
async function analyze2({ fs: fs3, cache, onProgress, dir, gitdir, ref, force, filepaths }) {
|
|
50591
|
+
let count = 0;
|
|
50592
|
+
return _walk({
|
|
50593
|
+
fs: fs3,
|
|
50594
|
+
cache,
|
|
50595
|
+
dir,
|
|
50596
|
+
gitdir,
|
|
50597
|
+
trees: [TREE({ ref }), WORKDIR(), STAGE()],
|
|
50598
|
+
// @ts-ignore
|
|
50599
|
+
map: async function(fullpath, [commit3, workdir, stage]) {
|
|
50600
|
+
if (fullpath === ".")
|
|
50601
|
+
return;
|
|
50602
|
+
if (filepaths && !filepaths.some((base) => worthWalking(fullpath, base))) {
|
|
50603
|
+
return null;
|
|
50604
|
+
}
|
|
50605
|
+
if (onProgress) {
|
|
50606
|
+
await onProgress({ phase: "Analyzing workdir", loaded: ++count });
|
|
50607
|
+
}
|
|
50608
|
+
const key = [!!stage, !!commit3, !!workdir].map(Number).join("");
|
|
50609
|
+
switch (key) {
|
|
50610
|
+
case "000":
|
|
50611
|
+
return;
|
|
50612
|
+
case "001":
|
|
50613
|
+
if (force && filepaths && filepaths.includes(fullpath)) {
|
|
50614
|
+
return ["delete", fullpath];
|
|
50615
|
+
}
|
|
50616
|
+
return;
|
|
50617
|
+
case "010": {
|
|
50618
|
+
switch (await commit3.type()) {
|
|
50619
|
+
case "tree": {
|
|
50620
|
+
return ["mkdir", fullpath];
|
|
50621
|
+
}
|
|
50622
|
+
case "blob": {
|
|
50623
|
+
return ["create", fullpath, await commit3.oid(), await commit3.mode()];
|
|
50624
|
+
}
|
|
50625
|
+
case "commit": {
|
|
50626
|
+
return ["mkdir-index", fullpath, await commit3.oid(), await commit3.mode()];
|
|
50627
|
+
}
|
|
50628
|
+
default: {
|
|
50629
|
+
return ["error", `new entry Unhandled type ${await commit3.type()}`];
|
|
50630
|
+
}
|
|
50631
|
+
}
|
|
50632
|
+
}
|
|
50633
|
+
case "011": {
|
|
50634
|
+
switch (`${await commit3.type()}-${await workdir.type()}`) {
|
|
50635
|
+
case "tree-tree": {
|
|
50636
|
+
return;
|
|
50637
|
+
}
|
|
50638
|
+
case "tree-blob":
|
|
50639
|
+
case "blob-tree": {
|
|
50640
|
+
return ["conflict", fullpath];
|
|
50641
|
+
}
|
|
50642
|
+
case "blob-blob": {
|
|
50643
|
+
if (await commit3.oid() !== await workdir.oid()) {
|
|
50644
|
+
if (force) {
|
|
50645
|
+
return [
|
|
50646
|
+
"update",
|
|
50647
|
+
fullpath,
|
|
50648
|
+
// @ts-ignore
|
|
50649
|
+
await commit3.oid(),
|
|
50650
|
+
// @ts-ignore
|
|
50651
|
+
await commit3.mode(),
|
|
50652
|
+
// @ts-ignore
|
|
50653
|
+
await commit3.mode() !== await workdir.mode()
|
|
50654
|
+
];
|
|
50655
|
+
} else {
|
|
50656
|
+
return ["conflict", fullpath];
|
|
50657
|
+
}
|
|
50658
|
+
} else {
|
|
50659
|
+
if (await commit3.mode() !== await workdir.mode()) {
|
|
50660
|
+
if (force) {
|
|
50661
|
+
return ["update", fullpath, await commit3.oid(), await commit3.mode(), true];
|
|
50662
|
+
} else {
|
|
50663
|
+
return ["conflict", fullpath];
|
|
50664
|
+
}
|
|
50665
|
+
} else {
|
|
50666
|
+
return ["create-index", fullpath, await commit3.oid(), await commit3.mode()];
|
|
50667
|
+
}
|
|
50668
|
+
}
|
|
50669
|
+
}
|
|
50670
|
+
case "commit-tree": {
|
|
50671
|
+
return;
|
|
50672
|
+
}
|
|
50673
|
+
case "commit-blob": {
|
|
50674
|
+
return ["conflict", fullpath];
|
|
50675
|
+
}
|
|
50676
|
+
default: {
|
|
50677
|
+
return ["error", `new entry Unhandled type ${commit3.type}`];
|
|
50678
|
+
}
|
|
50679
|
+
}
|
|
50680
|
+
}
|
|
50681
|
+
case "100": {
|
|
50682
|
+
return ["delete-index", fullpath];
|
|
50683
|
+
}
|
|
50684
|
+
case "101": {
|
|
50685
|
+
switch (await stage.type()) {
|
|
50686
|
+
case "tree": {
|
|
50687
|
+
return ["rmdir", fullpath];
|
|
50688
|
+
}
|
|
50689
|
+
case "blob": {
|
|
50690
|
+
if (await stage.oid() !== await workdir.oid()) {
|
|
50691
|
+
if (force) {
|
|
50692
|
+
return ["delete", fullpath];
|
|
50693
|
+
} else {
|
|
50694
|
+
return ["conflict", fullpath];
|
|
50695
|
+
}
|
|
50696
|
+
} else {
|
|
50697
|
+
return ["delete", fullpath];
|
|
50698
|
+
}
|
|
50699
|
+
}
|
|
50700
|
+
case "commit": {
|
|
50701
|
+
return ["rmdir-index", fullpath];
|
|
50702
|
+
}
|
|
50703
|
+
default: {
|
|
50704
|
+
return ["error", `delete entry Unhandled type ${await stage.type()}`];
|
|
50705
|
+
}
|
|
50706
|
+
}
|
|
50707
|
+
}
|
|
50708
|
+
case "110":
|
|
50709
|
+
case "111": {
|
|
50710
|
+
switch (`${await stage.type()}-${await commit3.type()}`) {
|
|
50711
|
+
case "tree-tree": {
|
|
50712
|
+
return;
|
|
50713
|
+
}
|
|
50714
|
+
case "blob-blob": {
|
|
50715
|
+
if (
|
|
50716
|
+
// @ts-ignore
|
|
50717
|
+
await stage.oid() === await commit3.oid() && // @ts-ignore
|
|
50718
|
+
await stage.mode() === await commit3.mode() && !force
|
|
50719
|
+
) {
|
|
50720
|
+
return;
|
|
50721
|
+
}
|
|
50722
|
+
if (workdir) {
|
|
50723
|
+
if (
|
|
50724
|
+
// @ts-ignore
|
|
50725
|
+
await workdir.oid() !== await stage.oid() && // @ts-ignore
|
|
50726
|
+
await workdir.oid() !== await commit3.oid()
|
|
50727
|
+
) {
|
|
50728
|
+
if (force) {
|
|
50729
|
+
return [
|
|
50730
|
+
"update",
|
|
50731
|
+
fullpath,
|
|
50732
|
+
// @ts-ignore
|
|
50733
|
+
await commit3.oid(),
|
|
50734
|
+
// @ts-ignore
|
|
50735
|
+
await commit3.mode(),
|
|
50736
|
+
// @ts-ignore
|
|
50737
|
+
await commit3.mode() !== await workdir.mode()
|
|
50738
|
+
];
|
|
50739
|
+
} else {
|
|
50740
|
+
return ["conflict", fullpath];
|
|
50741
|
+
}
|
|
50742
|
+
}
|
|
50743
|
+
} else if (force) {
|
|
50744
|
+
return [
|
|
50745
|
+
"update",
|
|
50746
|
+
fullpath,
|
|
50747
|
+
// @ts-ignore
|
|
50748
|
+
await commit3.oid(),
|
|
50749
|
+
// @ts-ignore
|
|
50750
|
+
await commit3.mode(),
|
|
50751
|
+
// @ts-ignore
|
|
50752
|
+
await commit3.mode() !== await stage.mode()
|
|
50753
|
+
];
|
|
50754
|
+
}
|
|
50755
|
+
if (await commit3.mode() !== await stage.mode()) {
|
|
50756
|
+
return ["update", fullpath, await commit3.oid(), await commit3.mode(), true];
|
|
50757
|
+
}
|
|
50758
|
+
if (await commit3.oid() !== await stage.oid()) {
|
|
50759
|
+
return ["update", fullpath, await commit3.oid(), await commit3.mode(), false];
|
|
50760
|
+
} else {
|
|
50761
|
+
return;
|
|
50762
|
+
}
|
|
50763
|
+
}
|
|
50764
|
+
case "tree-blob": {
|
|
50765
|
+
return ["update-dir-to-blob", fullpath, await commit3.oid()];
|
|
50766
|
+
}
|
|
50767
|
+
case "blob-tree": {
|
|
50768
|
+
return ["update-blob-to-tree", fullpath];
|
|
50769
|
+
}
|
|
50770
|
+
case "commit-commit": {
|
|
50771
|
+
return ["mkdir-index", fullpath, await commit3.oid(), await commit3.mode()];
|
|
50772
|
+
}
|
|
50773
|
+
default: {
|
|
50774
|
+
return [
|
|
50775
|
+
"error",
|
|
50776
|
+
// @ts-ignore
|
|
50777
|
+
`update entry Unhandled type ${await stage.type()}-${await commit3.type()}`
|
|
50778
|
+
];
|
|
50779
|
+
}
|
|
50780
|
+
}
|
|
50781
|
+
}
|
|
50782
|
+
}
|
|
50783
|
+
},
|
|
50784
|
+
// Modify the default flat mapping
|
|
50785
|
+
reduce: async function(parent, children3) {
|
|
50786
|
+
children3 = flat(children3);
|
|
50787
|
+
if (!parent) {
|
|
50788
|
+
return children3;
|
|
50789
|
+
} else if (parent && parent[0] === "rmdir") {
|
|
50790
|
+
children3.push(parent);
|
|
50791
|
+
return children3;
|
|
50792
|
+
} else {
|
|
50793
|
+
children3.unshift(parent);
|
|
50794
|
+
return children3;
|
|
50795
|
+
}
|
|
50796
|
+
}
|
|
50797
|
+
});
|
|
50798
|
+
}
|
|
50799
|
+
|
|
50800
|
+
// ../../../../lix/packages/client/dist/git/checkout.js
|
|
50801
|
+
async function checkout2({ fs: fs3, onProgress, dir, gitdir = join(dir, ".git"), remote = "origin", ref: _ref, filepaths, noCheckout = false, noUpdateHead = _ref === void 0, dryRun = false, force = false, track = true, cache = {} }) {
|
|
50802
|
+
try {
|
|
50803
|
+
assertParameter("fs", fs3);
|
|
50804
|
+
assertParameter("dir", dir);
|
|
50805
|
+
assertParameter("gitdir", gitdir);
|
|
50806
|
+
const ref = _ref || "HEAD";
|
|
50807
|
+
return await _checkout2({
|
|
50808
|
+
fs: new FileSystem(fs3),
|
|
50809
|
+
cache,
|
|
50810
|
+
onProgress,
|
|
50811
|
+
dir,
|
|
50812
|
+
gitdir,
|
|
50813
|
+
remote,
|
|
50814
|
+
ref,
|
|
50815
|
+
filepaths,
|
|
50816
|
+
noCheckout,
|
|
50817
|
+
noUpdateHead,
|
|
50818
|
+
dryRun,
|
|
50819
|
+
force,
|
|
50820
|
+
track
|
|
50821
|
+
});
|
|
50822
|
+
} catch (err) {
|
|
50823
|
+
err.caller = "git.checkout";
|
|
50824
|
+
throw err;
|
|
50825
|
+
}
|
|
50826
|
+
}
|
|
50827
|
+
|
|
50828
|
+
// ../../../../lix/packages/client/dist/openRepository.js
|
|
50829
|
+
var checkout3 = checkout2;
|
|
50025
50830
|
var whitelistedExperimentalRepos = [
|
|
50026
50831
|
"inlang/example",
|
|
50027
50832
|
"inlang/ci-test-repo",
|
|
@@ -50071,7 +50876,7 @@ async function openRepository(url, args) {
|
|
|
50071
50876
|
freshClone = true;
|
|
50072
50877
|
}
|
|
50073
50878
|
}
|
|
50074
|
-
const { protocol, lixHost, repoHost, owner, repoName, username, password } = parseLixUri(url);
|
|
50879
|
+
const { protocol, lixHost, repoHost, owner, repoName, username, password, namespace } = parseLixUri(url);
|
|
50075
50880
|
if (debug2 && (username || password)) {
|
|
50076
50881
|
console.warn("username and password and providers other than github are not supported yet. Only local commands will work.");
|
|
50077
50882
|
}
|
|
@@ -50079,8 +50884,12 @@ async function openRepository(url, args) {
|
|
|
50079
50884
|
const experimentalFeatures = args.experimentalFeatures || (isWhitelistedRepo ? { lazyClone: true, lixCommit: true } : {});
|
|
50080
50885
|
const lazyFS = typeof experimentalFeatures.lazyClone === "undefined" ? freshClone : experimentalFeatures.lazyClone;
|
|
50081
50886
|
const cache = lazyFS ? {} : void 0;
|
|
50082
|
-
|
|
50083
|
-
|
|
50887
|
+
let gitProxyUrl;
|
|
50888
|
+
let gitHubProxyUrl;
|
|
50889
|
+
if (namespace === "git") {
|
|
50890
|
+
gitProxyUrl = lixHost ? `${protocol}//${lixHost}/git-proxy` : "";
|
|
50891
|
+
gitHubProxyUrl = lixHost ? `${protocol}//${lixHost}/github-proxy` : "";
|
|
50892
|
+
}
|
|
50084
50893
|
debug2 && console.info({
|
|
50085
50894
|
gitProxyUrl,
|
|
50086
50895
|
gitHubProxyUrl,
|
|
@@ -50107,8 +50916,8 @@ async function openRepository(url, args) {
|
|
|
50107
50916
|
}
|
|
50108
50917
|
});
|
|
50109
50918
|
const gitUrl = repoName ? `https://${repoHost}/${owner}/${repoName}` : "";
|
|
50110
|
-
if (!gitUrl) {
|
|
50111
|
-
console.warn("valid repo url / local repo not found, only
|
|
50919
|
+
if (!gitUrl && debug2) {
|
|
50920
|
+
console.warn("valid repo url / local repo not found, only fs features available outside of repo");
|
|
50112
50921
|
}
|
|
50113
50922
|
const expFeatures = Object.entries(experimentalFeatures).filter(([_, value]) => value).map(([key]) => key);
|
|
50114
50923
|
if (expFeatures.length) {
|
|
@@ -50132,7 +50941,7 @@ async function openRepository(url, args) {
|
|
|
50132
50941
|
})) {
|
|
50133
50942
|
await rawFs.rm(placeholder);
|
|
50134
50943
|
}
|
|
50135
|
-
const res = await
|
|
50944
|
+
const res = await checkout3({
|
|
50136
50945
|
fs: withProxy({
|
|
50137
50946
|
nodeishFs: rawFs,
|
|
50138
50947
|
verbose: debug2,
|
|
@@ -50160,7 +50969,7 @@ async function openRepository(url, args) {
|
|
|
50160
50969
|
if (!experimentalFeatures.lazyClone) {
|
|
50161
50970
|
return;
|
|
50162
50971
|
}
|
|
50163
|
-
await
|
|
50972
|
+
await checkout3({
|
|
50164
50973
|
fs: withProxy({
|
|
50165
50974
|
nodeishFs: rawFs,
|
|
50166
50975
|
verbose: debug2,
|
|
@@ -50212,7 +51021,7 @@ async function openRepository(url, args) {
|
|
|
50212
51021
|
}
|
|
50213
51022
|
});
|
|
50214
51023
|
if (gitignoreFiles.length) {
|
|
50215
|
-
await
|
|
51024
|
+
await checkout3({
|
|
50216
51025
|
fs: withProxy({
|
|
50217
51026
|
nodeishFs: rawFs,
|
|
50218
51027
|
verbose: debug2,
|
|
@@ -50438,7 +51247,7 @@ async function openRepository(url, args) {
|
|
|
50438
51247
|
if (lazyFS) {
|
|
50439
51248
|
throw new Error("not implemented for lazy lix mode yet, use openRepo with different branch instead");
|
|
50440
51249
|
}
|
|
50441
|
-
await
|
|
51250
|
+
await checkout3({
|
|
50442
51251
|
fs: withProxy({
|
|
50443
51252
|
nodeishFs: rawFs,
|
|
50444
51253
|
verbose: debug2,
|
|
@@ -50452,6 +51261,9 @@ async function openRepository(url, args) {
|
|
|
50452
51261
|
status: status2,
|
|
50453
51262
|
statusList: statusList2,
|
|
50454
51263
|
async forkStatus() {
|
|
51264
|
+
if (!gitUrl) {
|
|
51265
|
+
throw new Error("Could not find repo url, only github supported for forkStatus at the moment");
|
|
51266
|
+
}
|
|
50455
51267
|
const repo = await this;
|
|
50456
51268
|
const { isFork, parent } = await repo.getMeta();
|
|
50457
51269
|
if (!isFork) {
|
|
@@ -50590,6 +51402,9 @@ async function openRepository(url, args) {
|
|
|
50590
51402
|
}
|
|
50591
51403
|
},
|
|
50592
51404
|
push() {
|
|
51405
|
+
if (!gitUrl) {
|
|
51406
|
+
throw new Error("Could not find repo url, only github supported for push at the moment");
|
|
51407
|
+
}
|
|
50593
51408
|
return isomorphic_git_default.push({
|
|
50594
51409
|
fs: withProxy({
|
|
50595
51410
|
nodeishFs: rawFs,
|
|
@@ -50605,6 +51420,9 @@ async function openRepository(url, args) {
|
|
|
50605
51420
|
});
|
|
50606
51421
|
},
|
|
50607
51422
|
async pull(cmdArgs) {
|
|
51423
|
+
if (!gitUrl) {
|
|
51424
|
+
throw new Error("Could not find repo url, only github supported for pull at the moment");
|
|
51425
|
+
}
|
|
50608
51426
|
const pullFs = withProxy({
|
|
50609
51427
|
nodeishFs: rawFs,
|
|
50610
51428
|
verbose: debug2,
|
|
@@ -50648,7 +51466,7 @@ async function openRepository(url, args) {
|
|
|
50648
51466
|
await emptyWorkdir();
|
|
50649
51467
|
experimentalFeatures.lazyClone = false;
|
|
50650
51468
|
console.info('checking out "HEAD" after pull');
|
|
50651
|
-
await
|
|
51469
|
+
await checkout3({
|
|
50652
51470
|
fs: rawFs,
|
|
50653
51471
|
cache,
|
|
50654
51472
|
dir,
|
|
@@ -50656,7 +51474,7 @@ async function openRepository(url, args) {
|
|
|
50656
51474
|
noCheckout: false
|
|
50657
51475
|
});
|
|
50658
51476
|
} else {
|
|
50659
|
-
await
|
|
51477
|
+
await checkout3({
|
|
50660
51478
|
fs: rawFs,
|
|
50661
51479
|
cache,
|
|
50662
51480
|
dir,
|
|
@@ -50683,6 +51501,9 @@ async function openRepository(url, args) {
|
|
|
50683
51501
|
});
|
|
50684
51502
|
},
|
|
50685
51503
|
async mergeUpstream(cmdArgs) {
|
|
51504
|
+
if (!gitUrl) {
|
|
51505
|
+
throw new Error("Could not find repo url, only github supported for mergeUpstream at the moment");
|
|
51506
|
+
}
|
|
50686
51507
|
const branch2 = (cmdArgs == null ? void 0 : cmdArgs.branch) || await isomorphic_git_default.currentBranch({
|
|
50687
51508
|
fs: withProxy({
|
|
50688
51509
|
nodeishFs: rawFs,
|
|
@@ -50744,6 +51565,9 @@ async function openRepository(url, args) {
|
|
|
50744
51565
|
}) || void 0;
|
|
50745
51566
|
},
|
|
50746
51567
|
async getBranches() {
|
|
51568
|
+
if (!gitUrl) {
|
|
51569
|
+
throw new Error("Could not find repo url, only github supported for getBranches at the moment");
|
|
51570
|
+
}
|
|
50747
51571
|
const serverRefs = await isomorphic_git_default.listServerRefs({
|
|
50748
51572
|
url: gitUrl,
|
|
50749
51573
|
corsProxy: gitProxyUrl,
|
|
@@ -50818,6 +51642,9 @@ async function openRepository(url, args) {
|
|
|
50818
51642
|
*/
|
|
50819
51643
|
async getMeta() {
|
|
50820
51644
|
var _a2, _b, _c;
|
|
51645
|
+
if (!gitUrl) {
|
|
51646
|
+
throw new Error("Could not find repo url, only github supported for getMeta at the moment");
|
|
51647
|
+
}
|
|
50821
51648
|
const res = await github.request("GET /repos/{owner}/{repo}", {
|
|
50822
51649
|
owner,
|
|
50823
51650
|
repo: repoName
|
|
@@ -50852,10 +51679,10 @@ async function openRepository(url, args) {
|
|
|
50852
51679
|
};
|
|
50853
51680
|
}
|
|
50854
51681
|
|
|
50855
|
-
// ../../../../lix/
|
|
51682
|
+
// ../../../../lix/packages/client/dist/index.js
|
|
50856
51683
|
init_dist();
|
|
50857
51684
|
|
|
50858
|
-
// ../../../../lix/
|
|
51685
|
+
// ../../../../lix/packages/client/dist/hash.js
|
|
50859
51686
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
50860
51687
|
async function hash(inputStr) {
|
|
50861
51688
|
var _a;
|
|
@@ -50873,7 +51700,7 @@ async function hash(inputStr) {
|
|
|
50873
51700
|
return [...new Uint8Array(idDigest)].map((b) => ("00" + b.toString(16)).slice(-2)).join("");
|
|
50874
51701
|
}
|
|
50875
51702
|
|
|
50876
|
-
// ../../../../lix/
|
|
51703
|
+
// ../../../../lix/packages/client/dist/mockRepo.js
|
|
50877
51704
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
50878
51705
|
init_dist();
|
|
50879
51706
|
|
|
@@ -56024,7 +56851,7 @@ export function isAvailableLanguageTag(thing) {
|
|
|
56024
56851
|
};
|
|
56025
56852
|
};
|
|
56026
56853
|
|
|
56027
|
-
// src/cli/commands/compile.ts
|
|
56854
|
+
// src/cli/commands/compile/command.ts
|
|
56028
56855
|
import nodeFsPromises from "node:fs/promises";
|
|
56029
56856
|
import { resolve } from "node:path";
|
|
56030
56857
|
import { Command } from "commander";
|
|
@@ -56127,7 +56954,7 @@ var Logger = class {
|
|
|
56127
56954
|
}
|
|
56128
56955
|
};
|
|
56129
56956
|
|
|
56130
|
-
// src/cli/commands/compile.ts
|
|
56957
|
+
// src/cli/commands/compile/command.ts
|
|
56131
56958
|
var compileCommand = new Command().name("compile").summary("Compiles inlang Paraglide-JS.").requiredOption("--project <path>", 'The path to the inlang project. Example: "./project.inlang"').requiredOption(
|
|
56132
56959
|
"--outdir <path>",
|
|
56133
56960
|
'The path to the output directory. Example: "./src/paraglide"',
|
|
@@ -56193,31 +57020,13 @@ var exitIfErrors = (project, logger) => {
|
|
|
56193
57020
|
return project;
|
|
56194
57021
|
};
|
|
56195
57022
|
|
|
56196
|
-
// src/cli/commands/init.ts
|
|
57023
|
+
// src/cli/commands/init/command.ts
|
|
56197
57024
|
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
56198
57025
|
import { Command as Command2 } from "commander";
|
|
56199
57026
|
import consola2 from "consola";
|
|
56200
|
-
import { resolve as resolve2 } from "node:path";
|
|
56201
|
-
import { detectJsonFormatting } from "@inlang/detect-json-formatting";
|
|
56202
|
-
import JSON5 from "json5";
|
|
56203
|
-
import childProcess from "node:child_process";
|
|
56204
|
-
|
|
56205
|
-
// src/cli/state.ts
|
|
56206
|
-
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
56207
|
-
import path3 from "node:path";
|
|
56208
|
-
import fs2 from "node:fs";
|
|
56209
|
-
import { fileURLToPath } from "node:url";
|
|
56210
|
-
var version2 = (() => {
|
|
56211
|
-
const currentFilePath = fileURLToPath(import.meta.url).split(path3.sep).join(path3.posix.sep);
|
|
56212
|
-
const paraglideDirectory = currentFilePath.slice(
|
|
56213
|
-
0,
|
|
56214
|
-
currentFilePath.indexOf("/paraglide-js/") + "/paraglide-js".length
|
|
56215
|
-
);
|
|
56216
|
-
return JSON.parse(fs2.readFileSync(`${paraglideDirectory}/package.json`, "utf-8")).version;
|
|
56217
|
-
})();
|
|
56218
|
-
|
|
56219
|
-
// src/cli/commands/init.ts
|
|
56220
57027
|
import dedent2 from "dedent";
|
|
57028
|
+
import * as nodePath from "node:path";
|
|
57029
|
+
import JSON5 from "json5";
|
|
56221
57030
|
import nodeFsPromises2 from "node:fs/promises";
|
|
56222
57031
|
|
|
56223
57032
|
// ../../cross-sell/cross-sell-sherlock/dist/index.js
|
|
@@ -56304,13 +57113,79 @@ async function add2(args) {
|
|
|
56304
57113
|
await addRecommendationToWorkspace(args.fs, args.workingDirectory);
|
|
56305
57114
|
}
|
|
56306
57115
|
|
|
56307
|
-
// src/cli/commands/init.ts
|
|
57116
|
+
// src/cli/commands/init/command.ts
|
|
57117
|
+
import { detectJsonFormatting } from "@inlang/detect-json-formatting";
|
|
57118
|
+
|
|
57119
|
+
// src/cli/state.ts
|
|
57120
|
+
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
57121
|
+
import path3 from "node:path";
|
|
57122
|
+
import fs2 from "node:fs";
|
|
57123
|
+
import { fileURLToPath } from "node:url";
|
|
57124
|
+
var version2 = (() => {
|
|
57125
|
+
const currentFilePath = fileURLToPath(import.meta.url).split(path3.sep).join(path3.posix.sep);
|
|
57126
|
+
const paraglideDirectory = currentFilePath.slice(
|
|
57127
|
+
0,
|
|
57128
|
+
currentFilePath.indexOf("/paraglide-js/") + "/paraglide-js".length
|
|
57129
|
+
);
|
|
57130
|
+
return JSON.parse(fs2.readFileSync(`${paraglideDirectory}/package.json`, "utf-8")).version;
|
|
57131
|
+
})();
|
|
57132
|
+
|
|
57133
|
+
// src/cli/commands/init/utils.ts
|
|
57134
|
+
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
57135
|
+
import childProcess from "node:child_process";
|
|
57136
|
+
function execAsync(command) {
|
|
57137
|
+
return new Promise((resolve3, reject) => {
|
|
57138
|
+
childProcess.exec(command, (error, stdout) => {
|
|
57139
|
+
if (error) {
|
|
57140
|
+
reject(error);
|
|
57141
|
+
} else {
|
|
57142
|
+
resolve3(stdout);
|
|
57143
|
+
}
|
|
57144
|
+
});
|
|
57145
|
+
});
|
|
57146
|
+
}
|
|
57147
|
+
|
|
57148
|
+
// src/cli/commands/init/defaults.ts
|
|
57149
|
+
init_define_ENV_DEFINED_IN_BUILD_STEP();
|
|
57150
|
+
var newProjectTemplate = {
|
|
57151
|
+
$schema: "https://inlang.com/schema/project-settings",
|
|
57152
|
+
sourceLanguageTag: "en",
|
|
57153
|
+
languageTags: ["en"],
|
|
57154
|
+
modules: [
|
|
57155
|
+
// for instant gratification, we're adding common rules
|
|
57156
|
+
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js",
|
|
57157
|
+
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js",
|
|
57158
|
+
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js",
|
|
57159
|
+
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-valid-js-identifier@latest/dist/index.js",
|
|
57160
|
+
// default to the message format plugin because it supports all features
|
|
57161
|
+
"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@latest/dist/index.js",
|
|
57162
|
+
// the m function matcher should be installed by default in case Sherlock (VS Code extension) is adopted
|
|
57163
|
+
"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@latest/dist/index.js"
|
|
57164
|
+
],
|
|
57165
|
+
"plugin.inlang.messageFormat": {
|
|
57166
|
+
pathPattern: "./messages/{languageTag}.json"
|
|
57167
|
+
}
|
|
57168
|
+
};
|
|
57169
|
+
function getNewProjectTemplate() {
|
|
57170
|
+
if (!("structuredClone" in globalThis)) {
|
|
57171
|
+
try {
|
|
57172
|
+
return JSON.parse(JSON.stringify(newProjectTemplate));
|
|
57173
|
+
} catch {
|
|
57174
|
+
throw new Error(
|
|
57175
|
+
"structuredClone is not supported in your Node Version. Please use version 17 or higher"
|
|
57176
|
+
);
|
|
57177
|
+
}
|
|
57178
|
+
}
|
|
57179
|
+
return structuredClone(newProjectTemplate);
|
|
57180
|
+
}
|
|
56308
57181
|
var DEFAULT_PROJECT_PATH = "./project.inlang";
|
|
57182
|
+
|
|
57183
|
+
// src/cli/commands/init/command.ts
|
|
56309
57184
|
var ADAPTER_LINKS = {
|
|
56310
|
-
sveltekit: "https://inlang.com/m/dxnzrydw/
|
|
56311
|
-
nextjs: "https://inlang.com/m/osslbuzt/
|
|
56312
|
-
astro: "https://inlang.com/m/iljlwzfs/
|
|
56313
|
-
solidstart: "https://inlang.com/m/n860p17j/
|
|
57185
|
+
sveltekit: "https://inlang.com/m/dxnzrydw/paraglide-sveltekit-i18n",
|
|
57186
|
+
nextjs: "https://inlang.com/m/osslbuzt/paraglide-next-i18n",
|
|
57187
|
+
astro: "https://inlang.com/m/iljlwzfs/paraglide-astro-i18n",
|
|
57188
|
+
solidstart: "https://inlang.com/m/n860p17j/paraglide-solidstart-i18n",
|
|
56314
57189
|
vite: "https://github.com/opral/monorepo/tree/main/inlang/source-code/paraglide/paraglide-js-adapter-vite"
|
|
56315
57190
|
};
|
|
56316
57191
|
var initCommand = new Command2().name("init").summary("Initializes inlang Paraglide-JS.").action(async () => {
|
|
@@ -56318,7 +57193,7 @@ var initCommand = new Command2().name("init").summary("Initializes inlang Paragl
|
|
|
56318
57193
|
nodeishFs: nodeFsPromises2,
|
|
56319
57194
|
path: process.cwd()
|
|
56320
57195
|
});
|
|
56321
|
-
const repo = await openRepository(repoRoot ?? process.cwd(), {
|
|
57196
|
+
const repo = await openRepository(repoRoot ?? "file://" + process.cwd(), {
|
|
56322
57197
|
nodeishFs: nodeFsPromises2
|
|
56323
57198
|
});
|
|
56324
57199
|
const ctx = {
|
|
@@ -56339,7 +57214,7 @@ var initCommand = new Command2().name("init").summary("Initializes inlang Paragl
|
|
|
56339
57214
|
await maybeChangeTsConfigAllowJs(ctx);
|
|
56340
57215
|
await maybeAddVsCodeExtension({ projectPath }, ctx);
|
|
56341
57216
|
telemetry.capture({ event: "PARAGLIDE-JS init finished" });
|
|
56342
|
-
const absoluteSettingsPath =
|
|
57217
|
+
const absoluteSettingsPath = nodePath.resolve(projectPath, "settings.json");
|
|
56343
57218
|
const relativeSettingsFilePath = absoluteSettingsPath.replace(process.cwd(), ".");
|
|
56344
57219
|
let successMessage = dedent2`inlang Paraglide-JS has been set up sucessfully.
|
|
56345
57220
|
|
|
@@ -56391,7 +57266,7 @@ var maybeAddVsCodeExtension = async (args, ctx) => {
|
|
|
56391
57266
|
if (response === false)
|
|
56392
57267
|
return;
|
|
56393
57268
|
const project = await loadProject({
|
|
56394
|
-
projectPath:
|
|
57269
|
+
projectPath: nodePath.resolve(process.cwd(), args.projectPath),
|
|
56395
57270
|
repo: ctx.repo
|
|
56396
57271
|
});
|
|
56397
57272
|
const settings = project.settings();
|
|
@@ -56457,7 +57332,7 @@ var existingProjectFlow = async (args, ctx) => {
|
|
|
56457
57332
|
return createNewProjectFlow(ctx);
|
|
56458
57333
|
}
|
|
56459
57334
|
const project = await loadProject({
|
|
56460
|
-
projectPath:
|
|
57335
|
+
projectPath: nodePath.resolve(process.cwd(), args.existingProjectPath),
|
|
56461
57336
|
repo: ctx.repo
|
|
56462
57337
|
});
|
|
56463
57338
|
if (project.errors().length > 0) {
|
|
@@ -56468,15 +57343,69 @@ var existingProjectFlow = async (args, ctx) => {
|
|
|
56468
57343
|
process.exit(1);
|
|
56469
57344
|
}
|
|
56470
57345
|
};
|
|
57346
|
+
function parseLanguageTagInput(input) {
|
|
57347
|
+
const languageTags = input.replaceAll(/[,:\s]/g, " ").split(" ").filter(Boolean).map((tag2) => tag2.toLowerCase());
|
|
57348
|
+
const validLanguageTags = [];
|
|
57349
|
+
const invalidLanguageTags = [];
|
|
57350
|
+
for (const tag2 of languageTags) {
|
|
57351
|
+
if (isValidLanguageTag(tag2)) {
|
|
57352
|
+
validLanguageTags.push(tag2);
|
|
57353
|
+
} else {
|
|
57354
|
+
invalidLanguageTags.push(tag2);
|
|
57355
|
+
}
|
|
57356
|
+
}
|
|
57357
|
+
return {
|
|
57358
|
+
validLanguageTags,
|
|
57359
|
+
invalidLanguageTags
|
|
57360
|
+
};
|
|
57361
|
+
}
|
|
57362
|
+
async function promptForLanguageTags(initialLanguageTags = []) {
|
|
57363
|
+
const languageTagsInput = await prompt("Which languages do you want to support?", {
|
|
57364
|
+
type: "text",
|
|
57365
|
+
placeholder: "en, de-ch, ar",
|
|
57366
|
+
initial: initialLanguageTags.length ? initialLanguageTags.join(", ") : void 0
|
|
57367
|
+
}) ?? "";
|
|
57368
|
+
const { invalidLanguageTags, validLanguageTags } = parseLanguageTagInput(languageTagsInput);
|
|
57369
|
+
if (validLanguageTags.length === 0) {
|
|
57370
|
+
consola2.warn("You must specify at least one language tag");
|
|
57371
|
+
return await promptForLanguageTags();
|
|
57372
|
+
}
|
|
57373
|
+
if (invalidLanguageTags.length > 0) {
|
|
57374
|
+
const message = invalidLanguageTags.length === 1 ? invalidLanguageTags[0] + " isn't a valid language tag. Please stick to IEEE BCP-47 Language Tags" : invalidLanguageTags.map((tag2) => `"${tag2}"`).join(", ") + " aren't valid language tags. Please stick to IEEE BCP-47 Language Tags";
|
|
57375
|
+
consola2.warn(message);
|
|
57376
|
+
return await promptForLanguageTags(validLanguageTags);
|
|
57377
|
+
}
|
|
57378
|
+
return validLanguageTags;
|
|
57379
|
+
}
|
|
56471
57380
|
var createNewProjectFlow = async (ctx) => {
|
|
57381
|
+
const languageTags = await promptForLanguageTags();
|
|
57382
|
+
const settings = getNewProjectTemplate();
|
|
57383
|
+
const sourceLanguageTag = languageTags.at(0);
|
|
57384
|
+
if (!sourceLanguageTag)
|
|
57385
|
+
throw new Error("sourceLanguageTag is not defined");
|
|
57386
|
+
settings.languageTags = languageTags;
|
|
57387
|
+
settings.sourceLanguageTag = sourceLanguageTag;
|
|
57388
|
+
const messagePath = settings["plugin.inlang.messageFormat"].pathPattern;
|
|
57389
|
+
const messageDir = nodePath.dirname(nodePath.resolve(process.cwd(), messagePath));
|
|
57390
|
+
ctx.repo.nodeishFs.mkdir(messageDir, { recursive: true });
|
|
57391
|
+
for (const languageTag of languageTags) {
|
|
57392
|
+
const languageFile = nodePath.resolve(messageDir, languageTag + ".json");
|
|
57393
|
+
ctx.repo.nodeishFs.writeFile(
|
|
57394
|
+
languageFile,
|
|
57395
|
+
dedent2`
|
|
57396
|
+
{
|
|
57397
|
+
"$schema": "https://inlang.com/schema/inlang-message-format"
|
|
57398
|
+
}`
|
|
57399
|
+
);
|
|
57400
|
+
}
|
|
56472
57401
|
ctx.logger.info(`Creating a new inlang project in the current working directory.`);
|
|
56473
57402
|
await ctx.repo.nodeishFs.mkdir(DEFAULT_PROJECT_PATH, { recursive: true });
|
|
56474
57403
|
await ctx.repo.nodeishFs.writeFile(
|
|
56475
57404
|
DEFAULT_PROJECT_PATH + "/settings.json",
|
|
56476
|
-
JSON.stringify(
|
|
57405
|
+
JSON.stringify(settings, void 0, 2)
|
|
56477
57406
|
);
|
|
56478
57407
|
const project = await loadProject({
|
|
56479
|
-
projectPath:
|
|
57408
|
+
projectPath: nodePath.resolve(process.cwd(), DEFAULT_PROJECT_PATH),
|
|
56480
57409
|
repo: ctx.repo
|
|
56481
57410
|
});
|
|
56482
57411
|
if (project.errors().length > 0) {
|
|
@@ -56491,30 +57420,6 @@ var createNewProjectFlow = async (ctx) => {
|
|
|
56491
57420
|
ctx.logger.success("Successfully created a new inlang project.");
|
|
56492
57421
|
}
|
|
56493
57422
|
};
|
|
56494
|
-
var newProjectTemplate = {
|
|
56495
|
-
$schema: "https://inlang.com/schema/project-settings",
|
|
56496
|
-
// defaulting to english to not overwhelm new users
|
|
56497
|
-
// with prompts. The user can change this later.
|
|
56498
|
-
sourceLanguageTag: "en",
|
|
56499
|
-
languageTags: ["en"],
|
|
56500
|
-
modules: [
|
|
56501
|
-
// for instant gratification, we're adding common rules
|
|
56502
|
-
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js",
|
|
56503
|
-
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js",
|
|
56504
|
-
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js",
|
|
56505
|
-
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js",
|
|
56506
|
-
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-valid-js-identifier@latest/dist/index.js",
|
|
56507
|
-
// default to the message format plugin because it supports all features
|
|
56508
|
-
"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@latest/dist/index.js",
|
|
56509
|
-
// the m function matcher should be installed by default in case Sherlock (VS Code extension) is adopted
|
|
56510
|
-
"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@latest/dist/index.js"
|
|
56511
|
-
],
|
|
56512
|
-
"plugin.inlang.messageFormat": {
|
|
56513
|
-
// using .inlang/paraglide-js as directory to avoid future conflicts when an official .inlang
|
|
56514
|
-
// directory is introduced, see https://github.com/opral/monorepo/discussions/1418
|
|
56515
|
-
pathPattern: "./messages/{languageTag}.json"
|
|
56516
|
-
}
|
|
56517
|
-
};
|
|
56518
57423
|
var checkIfPackageJsonExists = async (ctx) => {
|
|
56519
57424
|
const packageJsonPath = await findPackageJson(ctx.repo.nodeishFs, process.cwd());
|
|
56520
57425
|
if (!packageJsonPath) {
|
|
@@ -56600,7 +57505,7 @@ var maybeChangeTsConfigModuleResolution = async (ctx) => {
|
|
|
56600
57505
|
let parentTsConfig;
|
|
56601
57506
|
if (tsconfig.extends) {
|
|
56602
57507
|
try {
|
|
56603
|
-
const parentTsConfigPath =
|
|
57508
|
+
const parentTsConfigPath = nodePath.resolve(process.cwd(), tsconfig.extends);
|
|
56604
57509
|
const parentTsConfigFile = await ctx.repo.nodeishFs.readFile(parentTsConfigPath, {
|
|
56605
57510
|
encoding: "utf-8"
|
|
56606
57511
|
});
|
|
@@ -56719,17 +57624,6 @@ var prompt = async (message, options) => {
|
|
|
56719
57624
|
}
|
|
56720
57625
|
return response;
|
|
56721
57626
|
};
|
|
56722
|
-
function execAsync(command) {
|
|
56723
|
-
return new Promise((resolve3, reject) => {
|
|
56724
|
-
childProcess.exec(command, (error, stdout) => {
|
|
56725
|
-
if (error) {
|
|
56726
|
-
reject(error);
|
|
56727
|
-
} else {
|
|
56728
|
-
resolve3(stdout);
|
|
56729
|
-
}
|
|
56730
|
-
});
|
|
56731
|
-
});
|
|
56732
|
-
}
|
|
56733
57627
|
|
|
56734
57628
|
// src/cli/main.ts
|
|
56735
57629
|
var cli = new Command3().name("paraglide-js").addCommand(compileCommand).addCommand(initCommand).showHelpAfterError().version(version2);
|