@dereekb/dbx-cli 13.15.0 → 13.16.0
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/firebase-api-manifest/main.js +147 -132
- package/firebase-api-manifest/package.json +3 -3
- package/generate-firestore-indexes/main.js +37 -24
- package/generate-firestore-indexes/package.json +2 -2
- package/generate-mcp-manifest/main.js +49 -37
- package/generate-mcp-manifest/package.json +3 -3
- package/index.cjs.js +527 -321
- package/index.esm.js +527 -321
- package/lint-cache/package.json +2 -2
- package/manifest-extract/index.cjs.js +131 -118
- package/manifest-extract/index.esm.js +131 -118
- package/manifest-extract/package.json +2 -2
- package/package.json +6 -6
- package/test/index.cjs.js +1 -1
- package/test/index.esm.js +1 -1
- package/test/package.json +9 -9
package/index.esm.js
CHANGED
|
@@ -7062,11 +7062,11 @@ function resolveAuthSetupPrompt(input) {
|
|
|
7062
7062
|
tokenType: tokenResponse.token_type,
|
|
7063
7063
|
scope: tokenResponse.scope,
|
|
7064
7064
|
expiresAt: expiresAt
|
|
7065
|
-
}, sessionExpiresAt
|
|
7065
|
+
}, sessionExpiresAt == null ? {} : {
|
|
7066
7066
|
sessionExpiresAt: sessionExpiresAt
|
|
7067
|
-
}
|
|
7067
|
+
}, rotationDisabled == null ? {} : {
|
|
7068
7068
|
rotationDisabled: rotationDisabled
|
|
7069
|
-
}
|
|
7069
|
+
});
|
|
7070
7070
|
return [
|
|
7071
7071
|
4,
|
|
7072
7072
|
tokens.set(envName, entry)
|
|
@@ -9286,7 +9286,7 @@ function _ts_generator$_(thisArg, body) {
|
|
|
9286
9286
|
});
|
|
9287
9287
|
return function(argv) {
|
|
9288
9288
|
return _async_to_generator$_(function() {
|
|
9289
|
-
var _argv__, command, _ref,
|
|
9289
|
+
var _argv__, command, _ref, envName, env, entry, e;
|
|
9290
9290
|
return _ts_generator$_(this, function(_state) {
|
|
9291
9291
|
switch(_state.label){
|
|
9292
9292
|
case 0:
|
|
@@ -9305,9 +9305,9 @@ function _ts_generator$_(thisArg, body) {
|
|
|
9305
9305
|
case 1:
|
|
9306
9306
|
_state.trys.push([
|
|
9307
9307
|
1,
|
|
9308
|
-
|
|
9308
|
+
4,
|
|
9309
9309
|
,
|
|
9310
|
-
|
|
9310
|
+
5
|
|
9311
9311
|
]);
|
|
9312
9312
|
return [
|
|
9313
9313
|
4,
|
|
@@ -9320,86 +9320,18 @@ function _ts_generator$_(thisArg, body) {
|
|
|
9320
9320
|
})
|
|
9321
9321
|
];
|
|
9322
9322
|
case 2:
|
|
9323
|
-
|
|
9323
|
+
_ref = _state.sent(), envName = _ref.envName, env = _ref.env;
|
|
9324
9324
|
return [
|
|
9325
9325
|
4,
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
entry = (_readEnvTokenEntry = readEnvTokenEntry({
|
|
9332
|
-
cliName: input.cliName
|
|
9333
|
-
})) !== null && _readEnvTokenEntry !== void 0 ? _readEnvTokenEntry : undefined;
|
|
9334
|
-
}
|
|
9335
|
-
if (!(entry === null || entry === void 0 ? void 0 : entry.accessToken) && !(entry === null || entry === void 0 ? void 0 : entry.refreshToken)) {
|
|
9336
|
-
throw new CliError({
|
|
9337
|
-
message: 'No tokens for env "'.concat(envName, '". Run `').concat(input.cliName, " auth login --env ").concat(envName, "`."),
|
|
9338
|
-
code: 'NOT_LOGGED_IN'
|
|
9339
|
-
});
|
|
9340
|
-
}
|
|
9341
|
-
if (!(!entry.accessToken || isTokenExpired(entry))) return [
|
|
9342
|
-
3,
|
|
9343
|
-
8
|
|
9344
|
-
];
|
|
9345
|
-
if (!entry.refreshToken) {
|
|
9346
|
-
throw new CliError({
|
|
9347
|
-
message: 'Token for env "'.concat(envName, '" is expired and no refresh token is cached. Re-login.'),
|
|
9348
|
-
code: 'TOKEN_EXPIRED',
|
|
9349
|
-
suggestion: "Run `".concat(input.cliName, " auth login --env ").concat(envName, "`.")
|
|
9350
|
-
});
|
|
9351
|
-
}
|
|
9352
|
-
return [
|
|
9353
|
-
4,
|
|
9354
|
-
discoverOidcMetadata({
|
|
9355
|
-
issuer: env.oidcIssuer,
|
|
9356
|
-
fallbackBaseUrl: env.apiBaseUrl
|
|
9357
|
-
})
|
|
9358
|
-
];
|
|
9359
|
-
case 4:
|
|
9360
|
-
meta = _state.sent();
|
|
9361
|
-
suppliedRefreshToken = entry.refreshToken;
|
|
9362
|
-
return [
|
|
9363
|
-
4,
|
|
9364
|
-
refreshAccessToken({
|
|
9365
|
-
tokenEndpoint: meta.token_endpoint,
|
|
9366
|
-
clientId: env.clientId,
|
|
9367
|
-
clientSecret: env.clientSecret,
|
|
9368
|
-
refreshToken: suppliedRefreshToken
|
|
9326
|
+
resolveAccessTokenEntry({
|
|
9327
|
+
cliName: input.cliName,
|
|
9328
|
+
envName: envName,
|
|
9329
|
+
env: env,
|
|
9330
|
+
tokens: tokens
|
|
9369
9331
|
})
|
|
9370
9332
|
];
|
|
9371
|
-
case
|
|
9372
|
-
|
|
9373
|
-
entry = _object_spread_props$l(_object_spread$A({}, entry), {
|
|
9374
|
-
accessToken: refreshed.access_token,
|
|
9375
|
-
refreshToken: (_refreshed_refresh_token = refreshed.refresh_token) !== null && _refreshed_refresh_token !== void 0 ? _refreshed_refresh_token : entry.refreshToken,
|
|
9376
|
-
tokenType: (_refreshed_token_type = refreshed.token_type) !== null && _refreshed_token_type !== void 0 ? _refreshed_token_type : entry.tokenType,
|
|
9377
|
-
scope: (_refreshed_scope = refreshed.scope) !== null && _refreshed_scope !== void 0 ? _refreshed_scope : entry.scope,
|
|
9378
|
-
expiresAt: Date.now() + ((_refreshed_expires_in = refreshed.expires_in) !== null && _refreshed_expires_in !== void 0 ? _refreshed_expires_in : 0) * 1000
|
|
9379
|
-
});
|
|
9380
|
-
if (!entry.fromEnv) return [
|
|
9381
|
-
3,
|
|
9382
|
-
6
|
|
9383
|
-
];
|
|
9384
|
-
// Service tokens do not rotate, so a one-shot env-sourced invocation is durable without
|
|
9385
|
-
// persisting. If a *rotating* refresh token was supplied, the rotation is lost on exit —
|
|
9386
|
-
// warn that env credentials should be non-rotating service tokens.
|
|
9387
|
-
if (refreshed.refresh_token != null && refreshed.refresh_token !== suppliedRefreshToken) {
|
|
9388
|
-
process.stderr.write('Warning: the refresh token supplied via environment rotated on use; the rotated token cannot be persisted for a one-shot invocation. Use a non-rotating service token (auth login --service-token).\n');
|
|
9389
|
-
}
|
|
9390
|
-
return [
|
|
9391
|
-
3,
|
|
9392
|
-
8
|
|
9393
|
-
];
|
|
9394
|
-
case 6:
|
|
9395
|
-
return [
|
|
9396
|
-
4,
|
|
9397
|
-
tokens.set(envName, entry)
|
|
9398
|
-
];
|
|
9399
|
-
case 7:
|
|
9400
|
-
_state.sent();
|
|
9401
|
-
_state.label = 8;
|
|
9402
|
-
case 8:
|
|
9333
|
+
case 3:
|
|
9334
|
+
entry = _state.sent();
|
|
9403
9335
|
setCliContext(createCliContext({
|
|
9404
9336
|
cliName: input.cliName,
|
|
9405
9337
|
envName: envName,
|
|
@@ -9409,17 +9341,17 @@ function _ts_generator$_(thisArg, body) {
|
|
|
9409
9341
|
}));
|
|
9410
9342
|
return [
|
|
9411
9343
|
3,
|
|
9412
|
-
|
|
9344
|
+
5
|
|
9413
9345
|
];
|
|
9414
|
-
case
|
|
9346
|
+
case 4:
|
|
9415
9347
|
e = _state.sent();
|
|
9416
9348
|
outputError(e);
|
|
9417
9349
|
process.exit(CLI_EXIT_CODE_AUTH);
|
|
9418
9350
|
return [
|
|
9419
9351
|
3,
|
|
9420
|
-
|
|
9352
|
+
5
|
|
9421
9353
|
];
|
|
9422
|
-
case
|
|
9354
|
+
case 5:
|
|
9423
9355
|
return [
|
|
9424
9356
|
2
|
|
9425
9357
|
];
|
|
@@ -9428,6 +9360,146 @@ function _ts_generator$_(thisArg, body) {
|
|
|
9428
9360
|
})();
|
|
9429
9361
|
};
|
|
9430
9362
|
}
|
|
9363
|
+
/**
|
|
9364
|
+
* Resolves the access-token entry for an env: prefers the cached token, falls
|
|
9365
|
+
* back to an env-supplied token, requires at least one token to be present,
|
|
9366
|
+
* and refreshes when the access token is missing or expired.
|
|
9367
|
+
*
|
|
9368
|
+
* @param input - The CLI name, resolved env, env name, and token cache store.
|
|
9369
|
+
* @returns The resolved (and refreshed when necessary) token entry.
|
|
9370
|
+
* @throws {CliError} When no tokens are available for the env.
|
|
9371
|
+
*/ function resolveAccessTokenEntry(input) {
|
|
9372
|
+
return _async_to_generator$_(function() {
|
|
9373
|
+
var _ref, cliName, envName, env, tokens, entry, _readEnvTokenEntry;
|
|
9374
|
+
return _ts_generator$_(this, function(_state) {
|
|
9375
|
+
switch(_state.label){
|
|
9376
|
+
case 0:
|
|
9377
|
+
cliName = input.cliName, envName = input.envName, env = input.env, tokens = input.tokens;
|
|
9378
|
+
return [
|
|
9379
|
+
4,
|
|
9380
|
+
tokens.get(envName)
|
|
9381
|
+
];
|
|
9382
|
+
case 1:
|
|
9383
|
+
entry = (_ref = _state.sent()) !== null && _ref !== void 0 ? _ref : undefined;
|
|
9384
|
+
if (!entry) {
|
|
9385
|
+
entry = (_readEnvTokenEntry = readEnvTokenEntry({
|
|
9386
|
+
cliName: cliName
|
|
9387
|
+
})) !== null && _readEnvTokenEntry !== void 0 ? _readEnvTokenEntry : undefined;
|
|
9388
|
+
}
|
|
9389
|
+
if (!(entry === null || entry === void 0 ? void 0 : entry.accessToken) && !(entry === null || entry === void 0 ? void 0 : entry.refreshToken)) {
|
|
9390
|
+
throw new CliError({
|
|
9391
|
+
message: 'No tokens for env "'.concat(envName, '". Run `').concat(cliName, " auth login --env ").concat(envName, "`."),
|
|
9392
|
+
code: 'NOT_LOGGED_IN'
|
|
9393
|
+
});
|
|
9394
|
+
}
|
|
9395
|
+
if (!(!entry.accessToken || isTokenExpired(entry))) return [
|
|
9396
|
+
3,
|
|
9397
|
+
3
|
|
9398
|
+
];
|
|
9399
|
+
return [
|
|
9400
|
+
4,
|
|
9401
|
+
refreshTokenEntry({
|
|
9402
|
+
cliName: cliName,
|
|
9403
|
+
envName: envName,
|
|
9404
|
+
env: env,
|
|
9405
|
+
tokens: tokens,
|
|
9406
|
+
entry: entry
|
|
9407
|
+
})
|
|
9408
|
+
];
|
|
9409
|
+
case 2:
|
|
9410
|
+
entry = _state.sent();
|
|
9411
|
+
_state.label = 3;
|
|
9412
|
+
case 3:
|
|
9413
|
+
return [
|
|
9414
|
+
2,
|
|
9415
|
+
entry
|
|
9416
|
+
];
|
|
9417
|
+
}
|
|
9418
|
+
});
|
|
9419
|
+
})();
|
|
9420
|
+
}
|
|
9421
|
+
/**
|
|
9422
|
+
* Refreshes an absent/expired access token via OIDC. Cache-sourced entries are
|
|
9423
|
+
* persisted; env-sourced service tokens are durable for the one-shot
|
|
9424
|
+
* invocation and not written back (and a rotated env refresh token is warned
|
|
9425
|
+
* about, since it cannot be persisted).
|
|
9426
|
+
*
|
|
9427
|
+
* @param input - The CLI name, env, env name, token store, and the entry to refresh.
|
|
9428
|
+
* @returns The refreshed token entry.
|
|
9429
|
+
* @throws {CliError} When the entry is expired and has no refresh token.
|
|
9430
|
+
*/ function refreshTokenEntry(input) {
|
|
9431
|
+
return _async_to_generator$_(function() {
|
|
9432
|
+
var _refreshed_refresh_token, _refreshed_token_type, _refreshed_scope, _refreshed_expires_in, cliName, envName, env, tokens, entry, meta, suppliedRefreshToken, refreshed, updated;
|
|
9433
|
+
return _ts_generator$_(this, function(_state) {
|
|
9434
|
+
switch(_state.label){
|
|
9435
|
+
case 0:
|
|
9436
|
+
cliName = input.cliName, envName = input.envName, env = input.env, tokens = input.tokens, entry = input.entry;
|
|
9437
|
+
if (!entry.refreshToken) {
|
|
9438
|
+
throw new CliError({
|
|
9439
|
+
message: 'Token for env "'.concat(envName, '" is expired and no refresh token is cached. Re-login.'),
|
|
9440
|
+
code: 'TOKEN_EXPIRED',
|
|
9441
|
+
suggestion: "Run `".concat(cliName, " auth login --env ").concat(envName, "`.")
|
|
9442
|
+
});
|
|
9443
|
+
}
|
|
9444
|
+
return [
|
|
9445
|
+
4,
|
|
9446
|
+
discoverOidcMetadata({
|
|
9447
|
+
issuer: env.oidcIssuer,
|
|
9448
|
+
fallbackBaseUrl: env.apiBaseUrl
|
|
9449
|
+
})
|
|
9450
|
+
];
|
|
9451
|
+
case 1:
|
|
9452
|
+
meta = _state.sent();
|
|
9453
|
+
suppliedRefreshToken = entry.refreshToken;
|
|
9454
|
+
return [
|
|
9455
|
+
4,
|
|
9456
|
+
refreshAccessToken({
|
|
9457
|
+
tokenEndpoint: meta.token_endpoint,
|
|
9458
|
+
clientId: env.clientId,
|
|
9459
|
+
clientSecret: env.clientSecret,
|
|
9460
|
+
refreshToken: suppliedRefreshToken
|
|
9461
|
+
})
|
|
9462
|
+
];
|
|
9463
|
+
case 2:
|
|
9464
|
+
refreshed = _state.sent();
|
|
9465
|
+
updated = _object_spread_props$l(_object_spread$A({}, entry), {
|
|
9466
|
+
accessToken: refreshed.access_token,
|
|
9467
|
+
refreshToken: (_refreshed_refresh_token = refreshed.refresh_token) !== null && _refreshed_refresh_token !== void 0 ? _refreshed_refresh_token : entry.refreshToken,
|
|
9468
|
+
tokenType: (_refreshed_token_type = refreshed.token_type) !== null && _refreshed_token_type !== void 0 ? _refreshed_token_type : entry.tokenType,
|
|
9469
|
+
scope: (_refreshed_scope = refreshed.scope) !== null && _refreshed_scope !== void 0 ? _refreshed_scope : entry.scope,
|
|
9470
|
+
expiresAt: Date.now() + ((_refreshed_expires_in = refreshed.expires_in) !== null && _refreshed_expires_in !== void 0 ? _refreshed_expires_in : 0) * 1000
|
|
9471
|
+
});
|
|
9472
|
+
if (!updated.fromEnv) return [
|
|
9473
|
+
3,
|
|
9474
|
+
3
|
|
9475
|
+
];
|
|
9476
|
+
// Service tokens do not rotate, so a one-shot env-sourced invocation is durable without
|
|
9477
|
+
// persisting. If a *rotating* refresh token was supplied, the rotation is lost on exit —
|
|
9478
|
+
// warn that env credentials should be non-rotating service tokens.
|
|
9479
|
+
if (refreshed.refresh_token != null && refreshed.refresh_token !== suppliedRefreshToken) {
|
|
9480
|
+
process.stderr.write('Warning: the refresh token supplied via environment rotated on use; the rotated token cannot be persisted for a one-shot invocation. Use a non-rotating service token (auth login --service-token).\n');
|
|
9481
|
+
}
|
|
9482
|
+
return [
|
|
9483
|
+
3,
|
|
9484
|
+
5
|
|
9485
|
+
];
|
|
9486
|
+
case 3:
|
|
9487
|
+
return [
|
|
9488
|
+
4,
|
|
9489
|
+
tokens.set(envName, updated)
|
|
9490
|
+
];
|
|
9491
|
+
case 4:
|
|
9492
|
+
_state.sent();
|
|
9493
|
+
_state.label = 5;
|
|
9494
|
+
case 5:
|
|
9495
|
+
return [
|
|
9496
|
+
2,
|
|
9497
|
+
updated
|
|
9498
|
+
];
|
|
9499
|
+
}
|
|
9500
|
+
});
|
|
9501
|
+
})();
|
|
9502
|
+
}
|
|
9431
9503
|
/**
|
|
9432
9504
|
* Test-only middleware that skips OIDC discovery, disk token loading, and token refresh, attaching
|
|
9433
9505
|
* a pre-built {@link CliContext} directly via {@link setCliContext}.
|
|
@@ -11280,6 +11352,7 @@ function hideGlobalOptions(yargs, names) {
|
|
|
11280
11352
|
* @returns Multi-section epilogue string, or `undefined` when the entry has no
|
|
11281
11353
|
* metadata worth surfacing.
|
|
11282
11354
|
*/ function buildEntryEpilogue(entry, context) {
|
|
11355
|
+
var _sections, _sections1;
|
|
11283
11356
|
var dataHelpFormat = context.dataHelpFormat, helpMode = context.helpMode;
|
|
11284
11357
|
var showAction = helpMode === 'action' || helpMode === 'both';
|
|
11285
11358
|
var showParams = helpMode === 'params' || helpMode === 'both';
|
|
@@ -11288,31 +11361,67 @@ function hideGlobalOptions(yargs, names) {
|
|
|
11288
11361
|
var actionSection = buildActionSection(entry);
|
|
11289
11362
|
if (actionSection) sections.push(actionSection);
|
|
11290
11363
|
}
|
|
11291
|
-
var
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
schemaSections = renderParamsSchemaSections(entry, dataHelpFormat);
|
|
11297
|
-
(_sections = sections).push.apply(_sections, _to_consumable_array$P(schemaSections));
|
|
11298
|
-
var resultSection = buildResultSection(entry);
|
|
11299
|
-
if (resultSection) {
|
|
11300
|
-
sections.push(resultSection);
|
|
11301
|
-
} else if (entry.resultTypeName) {
|
|
11302
|
-
sections.push("Result: ".concat(entry.resultTypeName));
|
|
11303
|
-
}
|
|
11304
|
-
}
|
|
11364
|
+
var params = showParams ? collectParamsSections(entry, dataHelpFormat) : {
|
|
11365
|
+
sections: [],
|
|
11366
|
+
schemaCount: 0
|
|
11367
|
+
};
|
|
11368
|
+
(_sections = sections).push.apply(_sections, _to_consumable_array$P(params.sections));
|
|
11305
11369
|
if (entry.sourceFile) {
|
|
11306
11370
|
sections.push("Source: ".concat(entry.sourceFile));
|
|
11307
11371
|
}
|
|
11308
|
-
|
|
11372
|
+
(_sections1 = sections).push.apply(_sections1, _to_consumable_array$P(collectHelpHints({
|
|
11373
|
+
entry: entry,
|
|
11374
|
+
helpMode: helpMode,
|
|
11375
|
+
dataHelpFormat: dataHelpFormat,
|
|
11376
|
+
showParams: showParams,
|
|
11377
|
+
schemaCount: params.schemaCount
|
|
11378
|
+
})));
|
|
11379
|
+
return sections.length > 0 ? sections.join('\n\n') : undefined;
|
|
11380
|
+
}
|
|
11381
|
+
/**
|
|
11382
|
+
* Collects the params-side help sections (params interface, schema renders,
|
|
11383
|
+
* result) for an entry, reporting how many schema sections were produced so
|
|
11384
|
+
* the caller can decide whether to surface the schema-format hint.
|
|
11385
|
+
*
|
|
11386
|
+
* @param entry - The manifest entry being documented.
|
|
11387
|
+
* @param dataHelpFormat - The requested schema render format.
|
|
11388
|
+
* @returns The ordered sections and the number of schema sections produced.
|
|
11389
|
+
*/ function collectParamsSections(entry, dataHelpFormat) {
|
|
11390
|
+
var _sections;
|
|
11391
|
+
var sections = [];
|
|
11392
|
+
var paramsSection = buildParamsSection(entry);
|
|
11393
|
+
if (paramsSection) sections.push(paramsSection);
|
|
11394
|
+
var schemaSections = renderParamsSchemaSections(entry, dataHelpFormat);
|
|
11395
|
+
(_sections = sections).push.apply(_sections, _to_consumable_array$P(schemaSections));
|
|
11396
|
+
var resultSection = buildResultSection(entry);
|
|
11397
|
+
if (resultSection) {
|
|
11398
|
+
sections.push(resultSection);
|
|
11399
|
+
} else if (entry.resultTypeName) {
|
|
11400
|
+
sections.push("Result: ".concat(entry.resultTypeName));
|
|
11401
|
+
}
|
|
11402
|
+
return {
|
|
11403
|
+
sections: sections,
|
|
11404
|
+
schemaCount: schemaSections.length
|
|
11405
|
+
};
|
|
11406
|
+
}
|
|
11407
|
+
/**
|
|
11408
|
+
* Builds the trailing `--help` hint lines: how to switch the schema format,
|
|
11409
|
+
* and (in `both` mode, when there is something to focus on) how to narrow the
|
|
11410
|
+
* help to a single section.
|
|
11411
|
+
*
|
|
11412
|
+
* @param input - The entry, help mode, schema format, params visibility, and schema-section count.
|
|
11413
|
+
* @returns The hint lines (possibly empty).
|
|
11414
|
+
*/ function collectHelpHints(input) {
|
|
11415
|
+
var entry = input.entry, helpMode = input.helpMode, dataHelpFormat = input.dataHelpFormat, showParams = input.showParams, schemaCount = input.schemaCount;
|
|
11416
|
+
var hints = [];
|
|
11417
|
+
if (showParams && schemaCount > 0 && dataHelpFormat !== 'both') {
|
|
11309
11418
|
var other = dataHelpFormat === 'jsonschema' ? 'arktype' : 'jsonschema';
|
|
11310
|
-
|
|
11419
|
+
hints.push("(Pass --data-help=".concat(other, " or --data-help=both to switch the schema format above.)"));
|
|
11311
11420
|
}
|
|
11312
11421
|
if (helpMode === 'both' && (entry.description || entry.paramsTypeDescription || entry.paramsFields && entry.paramsFields.length > 0)) {
|
|
11313
|
-
|
|
11422
|
+
hints.push("(Pass --help-mode=action or --help-mode=params to focus this help on a single section.)");
|
|
11314
11423
|
}
|
|
11315
|
-
return
|
|
11424
|
+
return hints;
|
|
11316
11425
|
}
|
|
11317
11426
|
function buildActionSection(entry) {
|
|
11318
11427
|
return entry.description ? "About:\n".concat(indentLines(entry.description, ' ')) : undefined;
|
|
@@ -11328,31 +11437,8 @@ function buildParamsSection(entry) {
|
|
|
11328
11437
|
lines.push(indentLines(entry.paramsTypeDescription, ' '));
|
|
11329
11438
|
}
|
|
11330
11439
|
if (entry.paramsFields && entry.paramsFields.length > 0) {
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
try {
|
|
11334
|
-
for(var _iterator = entry.paramsFields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
11335
|
-
var field = _step.value;
|
|
11336
|
-
var header = " - ".concat(field.name, ": ").concat(field.typeText);
|
|
11337
|
-
lines.push(header);
|
|
11338
|
-
if (field.description) {
|
|
11339
|
-
lines.push(indentLines(field.description, ' '));
|
|
11340
|
-
}
|
|
11341
|
-
}
|
|
11342
|
-
} catch (err) {
|
|
11343
|
-
_didIteratorError = true;
|
|
11344
|
-
_iteratorError = err;
|
|
11345
|
-
} finally{
|
|
11346
|
-
try {
|
|
11347
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
11348
|
-
_iterator.return();
|
|
11349
|
-
}
|
|
11350
|
-
} finally{
|
|
11351
|
-
if (_didIteratorError) {
|
|
11352
|
-
throw _iteratorError;
|
|
11353
|
-
}
|
|
11354
|
-
}
|
|
11355
|
-
}
|
|
11440
|
+
var _lines;
|
|
11441
|
+
(_lines = lines).push.apply(_lines, _to_consumable_array$P(buildFieldLines(entry.paramsFields)));
|
|
11356
11442
|
}
|
|
11357
11443
|
result = lines.join('\n');
|
|
11358
11444
|
}
|
|
@@ -11369,36 +11455,49 @@ function buildResultSection(entry) {
|
|
|
11369
11455
|
lines.push(indentLines(entry.resultTypeDescription, ' '));
|
|
11370
11456
|
}
|
|
11371
11457
|
if (entry.resultFields && entry.resultFields.length > 0) {
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
try {
|
|
11375
|
-
for(var _iterator = entry.resultFields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
11376
|
-
var field = _step.value;
|
|
11377
|
-
var header = " - ".concat(field.name, ": ").concat(field.typeText);
|
|
11378
|
-
lines.push(header);
|
|
11379
|
-
if (field.description) {
|
|
11380
|
-
lines.push(indentLines(field.description, ' '));
|
|
11381
|
-
}
|
|
11382
|
-
}
|
|
11383
|
-
} catch (err) {
|
|
11384
|
-
_didIteratorError = true;
|
|
11385
|
-
_iteratorError = err;
|
|
11386
|
-
} finally{
|
|
11387
|
-
try {
|
|
11388
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
11389
|
-
_iterator.return();
|
|
11390
|
-
}
|
|
11391
|
-
} finally{
|
|
11392
|
-
if (_didIteratorError) {
|
|
11393
|
-
throw _iteratorError;
|
|
11394
|
-
}
|
|
11395
|
-
}
|
|
11396
|
-
}
|
|
11458
|
+
var _lines;
|
|
11459
|
+
(_lines = lines).push.apply(_lines, _to_consumable_array$P(buildFieldLines(entry.resultFields)));
|
|
11397
11460
|
}
|
|
11398
11461
|
result = lines.join('\n');
|
|
11399
11462
|
}
|
|
11400
11463
|
return result;
|
|
11401
11464
|
}
|
|
11465
|
+
/**
|
|
11466
|
+
* Renders the `Fields:` block shared by the params and result help sections —
|
|
11467
|
+
* one `- name: type` header per field, with its indented description below.
|
|
11468
|
+
*
|
|
11469
|
+
* @param fields - The manifest fields to render.
|
|
11470
|
+
* @returns The lines for the fields block, beginning with a blank line and the `Fields:` header.
|
|
11471
|
+
*/ function buildFieldLines(fields) {
|
|
11472
|
+
var lines = [
|
|
11473
|
+
'',
|
|
11474
|
+
'Fields:'
|
|
11475
|
+
];
|
|
11476
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
11477
|
+
try {
|
|
11478
|
+
for(var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
11479
|
+
var field = _step.value;
|
|
11480
|
+
lines.push(" - ".concat(field.name, ": ").concat(field.typeText));
|
|
11481
|
+
if (field.description) {
|
|
11482
|
+
lines.push(indentLines(field.description, ' '));
|
|
11483
|
+
}
|
|
11484
|
+
}
|
|
11485
|
+
} catch (err) {
|
|
11486
|
+
_didIteratorError = true;
|
|
11487
|
+
_iteratorError = err;
|
|
11488
|
+
} finally{
|
|
11489
|
+
try {
|
|
11490
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
11491
|
+
_iterator.return();
|
|
11492
|
+
}
|
|
11493
|
+
} finally{
|
|
11494
|
+
if (_didIteratorError) {
|
|
11495
|
+
throw _iteratorError;
|
|
11496
|
+
}
|
|
11497
|
+
}
|
|
11498
|
+
}
|
|
11499
|
+
return lines;
|
|
11500
|
+
}
|
|
11402
11501
|
function indentLines(text, indent) {
|
|
11403
11502
|
return text.split('\n').map(function(line) {
|
|
11404
11503
|
return "".concat(indent).concat(line);
|
|
@@ -11407,25 +11506,38 @@ function indentLines(text, indent) {
|
|
|
11407
11506
|
function renderParamsSchemaSections(entry, dataHelpFormat) {
|
|
11408
11507
|
var sections = [];
|
|
11409
11508
|
if (entry.paramsValidator) {
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11509
|
+
sections = collectSchemaSections(entry, dataHelpFormat);
|
|
11510
|
+
}
|
|
11511
|
+
return sections;
|
|
11512
|
+
}
|
|
11513
|
+
/**
|
|
11514
|
+
* Renders the requested params-schema sections (JSON Schema and/or arktype),
|
|
11515
|
+
* with a last-ditch arktype-expression fallback when the requested format
|
|
11516
|
+
* produced nothing usable. Assumes the entry has a bound params validator.
|
|
11517
|
+
*
|
|
11518
|
+
* @param entry - The manifest entry whose params validator is rendered.
|
|
11519
|
+
* @param dataHelpFormat - The requested schema render format.
|
|
11520
|
+
* @returns The rendered schema sections (possibly empty).
|
|
11521
|
+
*/ function collectSchemaSections(entry, dataHelpFormat) {
|
|
11522
|
+
var sections = [];
|
|
11523
|
+
if (dataHelpFormat === 'jsonschema' || dataHelpFormat === 'both') {
|
|
11524
|
+
var jsonSchemaSection = renderJsonSchemaSection(entry);
|
|
11525
|
+
if (jsonSchemaSection) {
|
|
11526
|
+
sections.push(jsonSchemaSection);
|
|
11415
11527
|
}
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11528
|
+
}
|
|
11529
|
+
if (dataHelpFormat === 'arktype' || dataHelpFormat === 'both') {
|
|
11530
|
+
var arktypeSection = renderArktypeExpressionSection(entry);
|
|
11531
|
+
if (arktypeSection) {
|
|
11532
|
+
sections.push(arktypeSection);
|
|
11421
11533
|
}
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11534
|
+
}
|
|
11535
|
+
if (sections.length === 0) {
|
|
11536
|
+
// Last-ditch fallback when the requested format produced nothing usable
|
|
11537
|
+
// (e.g. arktype was requested but the bound validator has no expression).
|
|
11538
|
+
var expression = readArktypeExpression(entry);
|
|
11539
|
+
if (expression) {
|
|
11540
|
+
sections.push("Params Schema (arktype): ".concat(expression));
|
|
11429
11541
|
}
|
|
11430
11542
|
}
|
|
11431
11543
|
return sections;
|
|
@@ -19799,28 +19911,50 @@ function buildModelEntry(args) {
|
|
|
19799
19911
|
sourceFile: input.sourceFile,
|
|
19800
19912
|
fields: fields,
|
|
19801
19913
|
enums: relevantEnums.map(function(e) {
|
|
19802
|
-
return
|
|
19803
|
-
name: e.name,
|
|
19804
|
-
values: e.values.map(function(v) {
|
|
19805
|
-
return v.description ? {
|
|
19806
|
-
name: v.name,
|
|
19807
|
-
value: v.value,
|
|
19808
|
-
description: v.description
|
|
19809
|
-
} : {
|
|
19810
|
-
name: v.name,
|
|
19811
|
-
value: v.value
|
|
19812
|
-
};
|
|
19813
|
-
})
|
|
19814
|
-
}, e.description ? {
|
|
19815
|
-
description: e.description
|
|
19816
|
-
} : {});
|
|
19914
|
+
return buildModelEnumEntry(e);
|
|
19817
19915
|
}),
|
|
19818
19916
|
detectionHints: detectionHints
|
|
19819
19917
|
}), groupName ? {
|
|
19820
19918
|
modelGroup: groupName
|
|
19821
19919
|
} : {}, collectionKind ? {
|
|
19822
19920
|
collectionKind: collectionKind
|
|
19823
|
-
} : {}, markers
|
|
19921
|
+
} : {}, buildModelMarkerFlags(markers), buildModelArchetypeFields(archetypeInfo), compositeKey ? {
|
|
19922
|
+
compositeKey: compositeKey
|
|
19923
|
+
} : {}, iface.tags.dbxModelRead ? {
|
|
19924
|
+
read: iface.tags.dbxModelRead
|
|
19925
|
+
} : {});
|
|
19926
|
+
}
|
|
19927
|
+
/**
|
|
19928
|
+
* Projects one extracted enum into the manifest enum shape, omitting empty
|
|
19929
|
+
* value/enum descriptions.
|
|
19930
|
+
*
|
|
19931
|
+
* @param e - The extracted enum.
|
|
19932
|
+
* @returns The manifest enum entry.
|
|
19933
|
+
*/ function buildModelEnumEntry(e) {
|
|
19934
|
+
return _object_spread$u({
|
|
19935
|
+
name: e.name,
|
|
19936
|
+
values: e.values.map(function(v) {
|
|
19937
|
+
return v.description ? {
|
|
19938
|
+
name: v.name,
|
|
19939
|
+
value: v.value,
|
|
19940
|
+
description: v.description
|
|
19941
|
+
} : {
|
|
19942
|
+
name: v.name,
|
|
19943
|
+
value: v.value
|
|
19944
|
+
};
|
|
19945
|
+
})
|
|
19946
|
+
}, e.description ? {
|
|
19947
|
+
description: e.description
|
|
19948
|
+
} : {});
|
|
19949
|
+
}
|
|
19950
|
+
/**
|
|
19951
|
+
* Builds the optional keyed-by/aggregation marker flags portion of a model
|
|
19952
|
+
* entry, including each flag only when set.
|
|
19953
|
+
*
|
|
19954
|
+
* @param markers - The computed marker flags.
|
|
19955
|
+
* @returns A partial model entry with only the active marker fields.
|
|
19956
|
+
*/ function buildModelMarkerFlags(markers) {
|
|
19957
|
+
return _object_spread$u({}, markers.userKeyedById ? {
|
|
19824
19958
|
userKeyedById: true
|
|
19825
19959
|
} : {}, markers.hasUserUidField ? {
|
|
19826
19960
|
hasUserUidField: true
|
|
@@ -19836,14 +19970,19 @@ function buildModelEntry(args) {
|
|
|
19836
19970
|
organizationalGroupRoot: true
|
|
19837
19971
|
} : {}, markers.aggregatesFromNonEmpty ? {
|
|
19838
19972
|
aggregatesFrom: markers.aggregatesFrom
|
|
19839
|
-
} : {}
|
|
19973
|
+
} : {});
|
|
19974
|
+
}
|
|
19975
|
+
/**
|
|
19976
|
+
* Builds the optional archetype portion of a model entry, including the
|
|
19977
|
+
* archetype list and per-slug axes only when present.
|
|
19978
|
+
*
|
|
19979
|
+
* @param archetypeInfo - The computed archetype info.
|
|
19980
|
+
* @returns A partial model entry with only the present archetype fields.
|
|
19981
|
+
*/ function buildModelArchetypeFields(archetypeInfo) {
|
|
19982
|
+
return _object_spread$u({}, archetypeInfo.archetypes.length > 0 ? {
|
|
19840
19983
|
archetypes: archetypeInfo.archetypes
|
|
19841
19984
|
} : {}, archetypeInfo.archetypeAxesBySlug ? {
|
|
19842
19985
|
archetypeAxesBySlug: archetypeInfo.archetypeAxesBySlug
|
|
19843
|
-
} : {}, compositeKey ? {
|
|
19844
|
-
compositeKey: compositeKey
|
|
19845
|
-
} : {}, iface.tags.dbxModelRead ? {
|
|
19846
|
-
read: iface.tags.dbxModelRead
|
|
19847
19986
|
} : {});
|
|
19848
19987
|
}
|
|
19849
19988
|
function filterRelevantEnums(fields, enums) {
|
|
@@ -20893,25 +21032,8 @@ var COMPOSITE_KEY_MODEL_NAME_RE = /^[A-Za-z][A-Za-z0-9_$]*$/;
|
|
|
20893
21032
|
var key = token.slice(0, eq).trim();
|
|
20894
21033
|
var v = token.slice(eq + 1).trim();
|
|
20895
21034
|
if (key === 'from') {
|
|
20896
|
-
|
|
20897
|
-
|
|
20898
|
-
} else if (v.length > 0) {
|
|
20899
|
-
// Tolerate the wildcard mixed with concrete entries here; the
|
|
20900
|
-
// validator emits MODEL_COMPOSITE_KEY_WILDCARD_MIXED when it sees both.
|
|
20901
|
-
var parts = v.split(',').map(function(p) {
|
|
20902
|
-
return p.trim();
|
|
20903
|
-
}).filter(function(p) {
|
|
20904
|
-
return p.length > 0;
|
|
20905
|
-
});
|
|
20906
|
-
if (parts.includes('*')) {
|
|
20907
|
-
// Preserve the literal list so the validator can flag the mix.
|
|
20908
|
-
fromValue = parts;
|
|
20909
|
-
} else {
|
|
20910
|
-
fromValue = parts.filter(function(p) {
|
|
20911
|
-
return COMPOSITE_KEY_MODEL_NAME_RE.test(p);
|
|
20912
|
-
});
|
|
20913
|
-
}
|
|
20914
|
-
}
|
|
21035
|
+
var parsedFrom = parseCompositeKeyFromValue(v);
|
|
21036
|
+
if (parsedFrom !== undefined) fromValue = parsedFrom;
|
|
20915
21037
|
} else if (key === 'encoding' && (v === 'two-way' || v === 'one-way')) encoding = v;
|
|
20916
21038
|
}
|
|
20917
21039
|
} catch (err) {
|
|
@@ -20933,6 +21055,32 @@ var COMPOSITE_KEY_MODEL_NAME_RE = /^[A-Za-z][A-Za-z0-9_$]*$/;
|
|
|
20933
21055
|
encoding: encoding
|
|
20934
21056
|
};
|
|
20935
21057
|
}
|
|
21058
|
+
/**
|
|
21059
|
+
* Parses the `from=` value of a `@dbxModelCompositeKey` tag into the wildcard
|
|
21060
|
+
* `'*'` or a concrete model-name list. Returns `undefined` for an empty value
|
|
21061
|
+
* so the caller leaves any previously-parsed `from` untouched.
|
|
21062
|
+
*
|
|
21063
|
+
* @param v - The raw text after `from=`.
|
|
21064
|
+
* @returns `'*'`, the parsed model-name list, or `undefined` when the value is empty.
|
|
21065
|
+
*/ function parseCompositeKeyFromValue(v) {
|
|
21066
|
+
var result;
|
|
21067
|
+
if (v === '*') {
|
|
21068
|
+
result = '*';
|
|
21069
|
+
} else if (v.length > 0) {
|
|
21070
|
+
// Tolerate the wildcard mixed with concrete entries here; the validator
|
|
21071
|
+
// emits MODEL_COMPOSITE_KEY_WILDCARD_MIXED when it sees both.
|
|
21072
|
+
var parts = v.split(',').map(function(p) {
|
|
21073
|
+
return p.trim();
|
|
21074
|
+
}).filter(function(p) {
|
|
21075
|
+
return p.length > 0;
|
|
21076
|
+
});
|
|
21077
|
+
// Preserve the literal list (incl. `*`) so the validator can flag the mix.
|
|
21078
|
+
result = parts.includes('*') ? parts : parts.filter(function(p) {
|
|
21079
|
+
return COMPOSITE_KEY_MODEL_NAME_RE.test(p);
|
|
21080
|
+
});
|
|
21081
|
+
}
|
|
21082
|
+
return result;
|
|
21083
|
+
}
|
|
20936
21084
|
function takeFirstTagText(current, tag) {
|
|
20937
21085
|
var _tag_getCommentText;
|
|
20938
21086
|
if (current !== undefined) return current;
|
|
@@ -30974,14 +31122,7 @@ var EMPTY_ROLE_CONST_RESOLUTION = {
|
|
|
30974
31122
|
*/ function resolveRoleConstByName(name, ctx) {
|
|
30975
31123
|
var result;
|
|
30976
31124
|
var scalar = ctx.knownRoles.get(name);
|
|
30977
|
-
if (scalar
|
|
30978
|
-
result = {
|
|
30979
|
-
roles: [
|
|
30980
|
-
scalar
|
|
30981
|
-
],
|
|
30982
|
-
unresolved: []
|
|
30983
|
-
};
|
|
30984
|
-
} else {
|
|
31125
|
+
if (scalar === undefined) {
|
|
30985
31126
|
var arrayExpr = ctx.localArrayRoles.get(name);
|
|
30986
31127
|
if (arrayExpr === undefined) {
|
|
30987
31128
|
result = {
|
|
@@ -30999,6 +31140,13 @@ var EMPTY_ROLE_CONST_RESOLUTION = {
|
|
|
30999
31140
|
seen: nextSeen
|
|
31000
31141
|
}));
|
|
31001
31142
|
}
|
|
31143
|
+
} else {
|
|
31144
|
+
result = {
|
|
31145
|
+
roles: [
|
|
31146
|
+
scalar
|
|
31147
|
+
],
|
|
31148
|
+
unresolved: []
|
|
31149
|
+
};
|
|
31002
31150
|
}
|
|
31003
31151
|
return result;
|
|
31004
31152
|
}
|
|
@@ -42803,7 +42951,7 @@ var DEFAULT_EXCLUDE = [
|
|
|
42803
42951
|
* @returns Map keyed by entry slug → reference count + locations.
|
|
42804
42952
|
*/ function scanFactoryReferences(input) {
|
|
42805
42953
|
return _async_to_generator$z(function() {
|
|
42806
|
-
var projectRoot, entries, _input_include, include, _input_exclude, exclude, _input_readFile, readFile, _input_globber, globber, result, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, entry, namesBySlug, declFilePathsBySlug, declFilePaths, filePaths, combinedPattern, sitesBySlug, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1,
|
|
42954
|
+
var projectRoot, entries, _input_include, include, _input_exclude, exclude, _input_readFile, readFile, _input_globber, globber, result, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, entry, namesBySlug, declFilePathsBySlug, declFilePaths, filePaths, combinedPattern, sitesBySlug, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, _step_value, slug, sites;
|
|
42807
42955
|
return _ts_generator$z(this, function(_state) {
|
|
42808
42956
|
switch(_state.label){
|
|
42809
42957
|
case 0:
|
|
@@ -42836,7 +42984,7 @@ var DEFAULT_EXCLUDE = [
|
|
|
42836
42984
|
}
|
|
42837
42985
|
if (!(entries.length > 0)) return [
|
|
42838
42986
|
3,
|
|
42839
|
-
|
|
42987
|
+
3
|
|
42840
42988
|
];
|
|
42841
42989
|
namesBySlug = buildNameLookup(entries);
|
|
42842
42990
|
declFilePathsBySlug = buildDeclFilePathLookup(entries);
|
|
@@ -42854,14 +43002,27 @@ var DEFAULT_EXCLUDE = [
|
|
|
42854
43002
|
combinedPattern = buildCombinedRegex(Array.from(namesBySlug.values()));
|
|
42855
43003
|
if (!(combinedPattern !== undefined)) return [
|
|
42856
43004
|
3,
|
|
42857
|
-
|
|
43005
|
+
3
|
|
42858
43006
|
];
|
|
42859
|
-
|
|
43007
|
+
return [
|
|
43008
|
+
4,
|
|
43009
|
+
collectReferenceSites({
|
|
43010
|
+
entries: entries,
|
|
43011
|
+
filePaths: filePaths,
|
|
43012
|
+
projectRoot: projectRoot,
|
|
43013
|
+
declFilePaths: declFilePaths,
|
|
43014
|
+
readFile: readFile,
|
|
43015
|
+
combinedPattern: combinedPattern,
|
|
43016
|
+
namesBySlug: namesBySlug
|
|
43017
|
+
})
|
|
43018
|
+
];
|
|
43019
|
+
case 2:
|
|
43020
|
+
sitesBySlug = _state.sent();
|
|
42860
43021
|
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
42861
43022
|
try {
|
|
42862
|
-
for(_iterator1 =
|
|
42863
|
-
|
|
42864
|
-
|
|
43023
|
+
for(_iterator1 = sitesBySlug[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
43024
|
+
_step_value = _sliced_to_array$2(_step1.value, 2), slug = _step_value[0], sites = _step_value[1];
|
|
43025
|
+
result.set(slug, tallyReferenceSites(sites));
|
|
42865
43026
|
}
|
|
42866
43027
|
} catch (err) {
|
|
42867
43028
|
_didIteratorError1 = true;
|
|
@@ -42877,30 +43038,72 @@ var DEFAULT_EXCLUDE = [
|
|
|
42877
43038
|
}
|
|
42878
43039
|
}
|
|
42879
43040
|
}
|
|
42880
|
-
|
|
42881
|
-
|
|
42882
|
-
|
|
42883
|
-
_state.trys.push([
|
|
43041
|
+
_state.label = 3;
|
|
43042
|
+
case 3:
|
|
43043
|
+
return [
|
|
42884
43044
|
2,
|
|
43045
|
+
result
|
|
43046
|
+
];
|
|
43047
|
+
}
|
|
43048
|
+
});
|
|
43049
|
+
})();
|
|
43050
|
+
}
|
|
43051
|
+
/**
|
|
43052
|
+
* Seeds an empty site list per entry slug, then scans every non-declaration
|
|
43053
|
+
* file for factory references, accumulating the hits per slug.
|
|
43054
|
+
*
|
|
43055
|
+
* @param input - The entries, globbed file paths, project root, declaration-file guard set, reader, combined pattern, and name lookup.
|
|
43056
|
+
* @returns The reference sites discovered, keyed by entry slug.
|
|
43057
|
+
*/ function collectReferenceSites(input) {
|
|
43058
|
+
return _async_to_generator$z(function() {
|
|
43059
|
+
var entries, filePaths, projectRoot, declFilePaths, readFile, combinedPattern, namesBySlug, sitesBySlug, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, entry, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, relPath, absolutePath, err;
|
|
43060
|
+
return _ts_generator$z(this, function(_state) {
|
|
43061
|
+
switch(_state.label){
|
|
43062
|
+
case 0:
|
|
43063
|
+
entries = input.entries, filePaths = input.filePaths, projectRoot = input.projectRoot, declFilePaths = input.declFilePaths, readFile = input.readFile, combinedPattern = input.combinedPattern, namesBySlug = input.namesBySlug;
|
|
43064
|
+
sitesBySlug = new Map();
|
|
43065
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
43066
|
+
try {
|
|
43067
|
+
for(_iterator = entries[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
43068
|
+
entry = _step.value;
|
|
43069
|
+
sitesBySlug.set(entry.slug, []);
|
|
43070
|
+
}
|
|
43071
|
+
} catch (err) {
|
|
43072
|
+
_didIteratorError = true;
|
|
43073
|
+
_iteratorError = err;
|
|
43074
|
+
} finally{
|
|
43075
|
+
try {
|
|
43076
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
43077
|
+
_iterator.return();
|
|
43078
|
+
}
|
|
43079
|
+
} finally{
|
|
43080
|
+
if (_didIteratorError) {
|
|
43081
|
+
throw _iteratorError;
|
|
43082
|
+
}
|
|
43083
|
+
}
|
|
43084
|
+
}
|
|
43085
|
+
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
43086
|
+
_state.label = 1;
|
|
43087
|
+
case 1:
|
|
43088
|
+
_state.trys.push([
|
|
43089
|
+
1,
|
|
43090
|
+
6,
|
|
42885
43091
|
7,
|
|
42886
|
-
8
|
|
42887
|
-
9
|
|
43092
|
+
8
|
|
42888
43093
|
]);
|
|
42889
|
-
|
|
42890
|
-
_state.label =
|
|
42891
|
-
case
|
|
42892
|
-
if (!!(
|
|
43094
|
+
_iterator1 = filePaths[Symbol.iterator]();
|
|
43095
|
+
_state.label = 2;
|
|
43096
|
+
case 2:
|
|
43097
|
+
if (!!(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done)) return [
|
|
42893
43098
|
3,
|
|
42894
|
-
|
|
43099
|
+
5
|
|
42895
43100
|
];
|
|
42896
|
-
relPath =
|
|
43101
|
+
relPath = _step1.value;
|
|
42897
43102
|
absolutePath = resolve(projectRoot, relPath);
|
|
42898
|
-
if (declFilePaths.has(absolutePath))
|
|
42899
|
-
|
|
42900
|
-
|
|
42901
|
-
|
|
42902
|
-
];
|
|
42903
|
-
}
|
|
43103
|
+
if (!!declFilePaths.has(absolutePath)) return [
|
|
43104
|
+
3,
|
|
43105
|
+
4
|
|
43106
|
+
];
|
|
42904
43107
|
return [
|
|
42905
43108
|
4,
|
|
42906
43109
|
scanOneFile({
|
|
@@ -42912,100 +43115,87 @@ var DEFAULT_EXCLUDE = [
|
|
|
42912
43115
|
sitesBySlug: sitesBySlug
|
|
42913
43116
|
})
|
|
42914
43117
|
];
|
|
42915
|
-
case
|
|
43118
|
+
case 3:
|
|
42916
43119
|
_state.sent();
|
|
42917
|
-
_state.label =
|
|
42918
|
-
case
|
|
42919
|
-
|
|
43120
|
+
_state.label = 4;
|
|
43121
|
+
case 4:
|
|
43122
|
+
_iteratorNormalCompletion1 = true;
|
|
42920
43123
|
return [
|
|
42921
43124
|
3,
|
|
42922
|
-
|
|
43125
|
+
2
|
|
42923
43126
|
];
|
|
42924
|
-
case
|
|
43127
|
+
case 5:
|
|
42925
43128
|
return [
|
|
42926
43129
|
3,
|
|
42927
|
-
|
|
43130
|
+
8
|
|
42928
43131
|
];
|
|
42929
|
-
case
|
|
43132
|
+
case 6:
|
|
42930
43133
|
err = _state.sent();
|
|
42931
|
-
|
|
42932
|
-
|
|
43134
|
+
_didIteratorError1 = true;
|
|
43135
|
+
_iteratorError1 = err;
|
|
42933
43136
|
return [
|
|
42934
43137
|
3,
|
|
42935
|
-
|
|
43138
|
+
8
|
|
42936
43139
|
];
|
|
42937
|
-
case
|
|
43140
|
+
case 7:
|
|
42938
43141
|
try {
|
|
42939
|
-
if (!
|
|
42940
|
-
|
|
43142
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
43143
|
+
_iterator1.return();
|
|
42941
43144
|
}
|
|
42942
43145
|
} finally{
|
|
42943
|
-
if (
|
|
42944
|
-
throw
|
|
43146
|
+
if (_didIteratorError1) {
|
|
43147
|
+
throw _iteratorError1;
|
|
42945
43148
|
}
|
|
42946
43149
|
}
|
|
42947
43150
|
return [
|
|
42948
43151
|
7
|
|
42949
43152
|
];
|
|
42950
|
-
case
|
|
42951
|
-
_iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
|
|
42952
|
-
try {
|
|
42953
|
-
for(_iterator3 = sitesBySlug[Symbol.iterator](); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
|
|
42954
|
-
_step_value = _sliced_to_array$2(_step3.value, 2), slug = _step_value[0], sites = _step_value[1];
|
|
42955
|
-
specCount = 0;
|
|
42956
|
-
_iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = undefined;
|
|
42957
|
-
try {
|
|
42958
|
-
for(_iterator4 = sites[Symbol.iterator](); !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true){
|
|
42959
|
-
site = _step4.value;
|
|
42960
|
-
if (site.isSpec) {
|
|
42961
|
-
specCount += 1;
|
|
42962
|
-
}
|
|
42963
|
-
}
|
|
42964
|
-
} catch (err) {
|
|
42965
|
-
_didIteratorError4 = true;
|
|
42966
|
-
_iteratorError4 = err;
|
|
42967
|
-
} finally{
|
|
42968
|
-
try {
|
|
42969
|
-
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
|
42970
|
-
_iterator4.return();
|
|
42971
|
-
}
|
|
42972
|
-
} finally{
|
|
42973
|
-
if (_didIteratorError4) {
|
|
42974
|
-
throw _iteratorError4;
|
|
42975
|
-
}
|
|
42976
|
-
}
|
|
42977
|
-
}
|
|
42978
|
-
result.set(slug, {
|
|
42979
|
-
count: sites.length,
|
|
42980
|
-
productionCount: sites.length - specCount,
|
|
42981
|
-
specCount: specCount,
|
|
42982
|
-
referencedBy: sites
|
|
42983
|
-
});
|
|
42984
|
-
}
|
|
42985
|
-
} catch (err) {
|
|
42986
|
-
_didIteratorError3 = true;
|
|
42987
|
-
_iteratorError3 = err;
|
|
42988
|
-
} finally{
|
|
42989
|
-
try {
|
|
42990
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
42991
|
-
_iterator3.return();
|
|
42992
|
-
}
|
|
42993
|
-
} finally{
|
|
42994
|
-
if (_didIteratorError3) {
|
|
42995
|
-
throw _iteratorError3;
|
|
42996
|
-
}
|
|
42997
|
-
}
|
|
42998
|
-
}
|
|
42999
|
-
_state.label = 10;
|
|
43000
|
-
case 10:
|
|
43153
|
+
case 8:
|
|
43001
43154
|
return [
|
|
43002
43155
|
2,
|
|
43003
|
-
|
|
43156
|
+
sitesBySlug
|
|
43004
43157
|
];
|
|
43005
43158
|
}
|
|
43006
43159
|
});
|
|
43007
43160
|
})();
|
|
43008
43161
|
}
|
|
43162
|
+
/**
|
|
43163
|
+
* Tallies one slug's reference sites into a {@link FactoryReferenceCount},
|
|
43164
|
+
* splitting production callers from spec-only callers.
|
|
43165
|
+
*
|
|
43166
|
+
* @param sites - The reference sites found for one factory.
|
|
43167
|
+
* @returns The total/production/spec counts plus the sites themselves.
|
|
43168
|
+
*/ function tallyReferenceSites(sites) {
|
|
43169
|
+
var specCount = 0;
|
|
43170
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
43171
|
+
try {
|
|
43172
|
+
for(var _iterator = sites[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
43173
|
+
var site = _step.value;
|
|
43174
|
+
if (site.isSpec) {
|
|
43175
|
+
specCount += 1;
|
|
43176
|
+
}
|
|
43177
|
+
}
|
|
43178
|
+
} catch (err) {
|
|
43179
|
+
_didIteratorError = true;
|
|
43180
|
+
_iteratorError = err;
|
|
43181
|
+
} finally{
|
|
43182
|
+
try {
|
|
43183
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
43184
|
+
_iterator.return();
|
|
43185
|
+
}
|
|
43186
|
+
} finally{
|
|
43187
|
+
if (_didIteratorError) {
|
|
43188
|
+
throw _iteratorError;
|
|
43189
|
+
}
|
|
43190
|
+
}
|
|
43191
|
+
}
|
|
43192
|
+
return {
|
|
43193
|
+
count: sites.length,
|
|
43194
|
+
productionCount: sites.length - specCount,
|
|
43195
|
+
specCount: specCount,
|
|
43196
|
+
referencedBy: sites
|
|
43197
|
+
};
|
|
43198
|
+
}
|
|
43009
43199
|
/**
|
|
43010
43200
|
* Returns true when the supplied workspace-relative subpath looks like a
|
|
43011
43201
|
* Vitest/Jest spec file. The scanner uses this to tag each
|
|
@@ -43160,7 +43350,7 @@ function buildCombinedRegex(names) {
|
|
|
43160
43350
|
return result;
|
|
43161
43351
|
}
|
|
43162
43352
|
function escapeRegex(value) {
|
|
43163
|
-
return value.
|
|
43353
|
+
return value.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw(_templateObject()));
|
|
43164
43354
|
}
|
|
43165
43355
|
function computeLineOffsets(contents) {
|
|
43166
43356
|
var offsets = [
|
|
@@ -51668,10 +51858,9 @@ function collectExternalCssUtilitySources(configResult) {
|
|
|
51668
51858
|
try {
|
|
51669
51859
|
for(var _iterator = ((_ref = cluster === null || cluster === void 0 ? void 0 : cluster.sources) !== null && _ref !== void 0 ? _ref : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
51670
51860
|
var source = _step.value;
|
|
51671
|
-
var absolute = isAbsolute(source) ? source : resolve(baseDir, source);
|
|
51672
51861
|
externalSources.push({
|
|
51673
51862
|
origin: 'external',
|
|
51674
|
-
path:
|
|
51863
|
+
path: toAbsolutePath$1(baseDir, source)
|
|
51675
51864
|
});
|
|
51676
51865
|
}
|
|
51677
51866
|
} catch (err) {
|
|
@@ -51694,10 +51883,9 @@ function collectExternalCssUtilitySources(configResult) {
|
|
|
51694
51883
|
var scan = _step1.value;
|
|
51695
51884
|
var out = scan.out;
|
|
51696
51885
|
if (typeof out === 'string' && out.length > 0) {
|
|
51697
|
-
var absolute1 = isAbsolute(out) ? out : resolve(baseDir, out);
|
|
51698
51886
|
externalSources.push({
|
|
51699
51887
|
origin: 'external',
|
|
51700
|
-
path:
|
|
51888
|
+
path: toAbsolutePath$1(baseDir, out)
|
|
51701
51889
|
});
|
|
51702
51890
|
}
|
|
51703
51891
|
}
|
|
@@ -51718,6 +51906,16 @@ function collectExternalCssUtilitySources(configResult) {
|
|
|
51718
51906
|
}
|
|
51719
51907
|
return externalSources;
|
|
51720
51908
|
}
|
|
51909
|
+
/**
|
|
51910
|
+
* Resolves `value` against `baseDir` when it is relative, leaving an
|
|
51911
|
+
* already-absolute path untouched (so its original spelling is preserved).
|
|
51912
|
+
*
|
|
51913
|
+
* @param baseDir - Directory a relative `value` is resolved against.
|
|
51914
|
+
* @param value - An absolute or relative path.
|
|
51915
|
+
* @returns The absolute path.
|
|
51916
|
+
*/ function toAbsolutePath$1(baseDir, value) {
|
|
51917
|
+
return isAbsolute(value) ? value : resolve(baseDir, value);
|
|
51918
|
+
}
|
|
51721
51919
|
/**
|
|
51722
51920
|
* Re-exported so callers can build a deterministic test fixture pointing
|
|
51723
51921
|
* at the package's bundled manifests without touching `import.meta.url`.
|
|
@@ -55370,10 +55568,9 @@ function collectExternalTokenSources(configResult) {
|
|
|
55370
55568
|
try {
|
|
55371
55569
|
for(var _iterator = ((_ref = tokensCluster === null || tokensCluster === void 0 ? void 0 : tokensCluster.sources) !== null && _ref !== void 0 ? _ref : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
55372
55570
|
var source = _step.value;
|
|
55373
|
-
var absolute = isAbsolute(source) ? source : resolve(baseDir, source);
|
|
55374
55571
|
externalSources.push({
|
|
55375
55572
|
origin: 'external',
|
|
55376
|
-
path:
|
|
55573
|
+
path: toAbsolutePath(baseDir, source)
|
|
55377
55574
|
});
|
|
55378
55575
|
}
|
|
55379
55576
|
} catch (err) {
|
|
@@ -55396,10 +55593,9 @@ function collectExternalTokenSources(configResult) {
|
|
|
55396
55593
|
var scan = _step1.value;
|
|
55397
55594
|
var out = scan.out;
|
|
55398
55595
|
if (typeof out === 'string' && out.length > 0) {
|
|
55399
|
-
var absolute1 = isAbsolute(out) ? out : resolve(baseDir, out);
|
|
55400
55596
|
externalSources.push({
|
|
55401
55597
|
origin: 'external',
|
|
55402
|
-
path:
|
|
55598
|
+
path: toAbsolutePath(baseDir, out)
|
|
55403
55599
|
});
|
|
55404
55600
|
}
|
|
55405
55601
|
}
|
|
@@ -55420,6 +55616,16 @@ function collectExternalTokenSources(configResult) {
|
|
|
55420
55616
|
}
|
|
55421
55617
|
return externalSources;
|
|
55422
55618
|
}
|
|
55619
|
+
/**
|
|
55620
|
+
* Resolves `value` against `baseDir` when it is relative, leaving an
|
|
55621
|
+
* already-absolute path untouched (so its original spelling is preserved).
|
|
55622
|
+
*
|
|
55623
|
+
* @param baseDir - Directory a relative `value` is resolved against.
|
|
55624
|
+
* @param value - An absolute or relative path.
|
|
55625
|
+
* @returns The absolute path.
|
|
55626
|
+
*/ function toAbsolutePath(baseDir, value) {
|
|
55627
|
+
return isAbsolute(value) ? value : resolve(baseDir, value);
|
|
55628
|
+
}
|
|
55423
55629
|
/**
|
|
55424
55630
|
* Re-exported so callers can build a deterministic test fixture pointing at
|
|
55425
55631
|
* the package's bundled manifests without touching `import.meta.url`.
|