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