@teambit/dependency-resolver 1.0.957 → 1.0.959
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dependency-resolver.main.runtime.d.ts +6 -4
- package/dist/dependency-resolver.main.runtime.js +51 -5
- package/dist/dependency-resolver.main.runtime.js.map +1 -1
- package/dist/get-all-policy-pkgs.d.ts +1 -1
- package/dist/get-all-policy-pkgs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/manifest/workspace-manifest-factory.d.ts +5 -0
- package/dist/manifest/workspace-manifest-factory.js +39 -1
- package/dist/manifest/workspace-manifest-factory.js.map +1 -1
- package/dist/policy/env-policy/index.d.ts +1 -1
- package/dist/policy/env-policy/index.js +12 -0
- package/dist/policy/env-policy/index.js.map +1 -1
- package/dist/policy/index.d.ts +2 -2
- package/dist/policy/index.js +12 -0
- package/dist/policy/index.js.map +1 -1
- package/dist/policy/variant-policy/index.d.ts +1 -1
- package/dist/policy/variant-policy/index.js +6 -0
- package/dist/policy/variant-policy/index.js.map +1 -1
- package/dist/{preview-1776705141733.js → preview-1776776950183.js} +2 -2
- package/manifest/workspace-manifest-factory.ts +41 -2
- package/package.json +7 -7
- package/policy/env-policy/index.ts +1 -1
- package/policy/index.ts +2 -1
- package/policy/variant-policy/index.ts +1 -0
|
@@ -22,7 +22,7 @@ import { DependencyVersionResolver } from './dependency-version-resolver';
|
|
|
22
22
|
import type { DepLinkerContext, LinkingOptions } from './dependency-linker';
|
|
23
23
|
import { DependencyLinker } from './dependency-linker';
|
|
24
24
|
import type { ComponentRangePrefix, DependencyResolverWorkspaceConfig, NodeLinker } from './dependency-resolver-workspace-config';
|
|
25
|
-
import type { CurrentPkg, OutdatedPkg } from './get-all-policy-pkgs';
|
|
25
|
+
import type { CurrentPkg, OutdatedPkg, CurrentPkgSource } from './get-all-policy-pkgs';
|
|
26
26
|
import type { CreateFromComponentsOptions, WorkspaceManifest, ManifestDependenciesObject } from './manifest';
|
|
27
27
|
import type { WorkspacePolicyConfigObject, VariantPolicyConfigObject, WorkspacePolicyAddEntryOptions, WorkspacePolicyEntry, SerializedVariantPolicy } from './policy';
|
|
28
28
|
import { WorkspacePolicy, VariantPolicy } from './policy';
|
|
@@ -423,14 +423,16 @@ export declare class DependencyResolverMain {
|
|
|
423
423
|
patterns?: string[];
|
|
424
424
|
forceVersionBump?: 'major' | 'minor' | 'patch' | 'compatible';
|
|
425
425
|
}): Promise<MergedOutdatedPkg[] | null>;
|
|
426
|
-
getAllDependencies({ variantPoliciesByPatterns, componentPolicies, components, }: {
|
|
426
|
+
getAllDependencies({ variantPoliciesByPatterns, componentPolicies, components, includeEnvJsoncDeps, }: {
|
|
427
427
|
variantPoliciesByPatterns: Record<string, VariantPolicyConfigObject>;
|
|
428
428
|
componentPolicies: Array<{
|
|
429
429
|
componentId: ComponentID;
|
|
430
430
|
policy: any;
|
|
431
431
|
}>;
|
|
432
432
|
components: Component[];
|
|
433
|
+
includeEnvJsoncDeps?: boolean;
|
|
433
434
|
}): CurrentPkg[];
|
|
435
|
+
getEnvJsoncPolicyPkgs(components: Component[]): CurrentPkg[];
|
|
434
436
|
getAllDedupedDirectDependencies(opts: {
|
|
435
437
|
variantPoliciesByPatterns: Record<string, VariantPolicyConfigObject>;
|
|
436
438
|
componentPolicies: Array<{
|
|
@@ -455,7 +457,7 @@ export declare class DependencyResolverMain {
|
|
|
455
457
|
}, pkgs: Array<{
|
|
456
458
|
name: string;
|
|
457
459
|
currentRange: string;
|
|
458
|
-
source:
|
|
460
|
+
source: CurrentPkgSource;
|
|
459
461
|
} & T>): Promise<Array<{
|
|
460
462
|
name: string;
|
|
461
463
|
currentRange: string;
|
|
@@ -476,7 +478,7 @@ export declare class DependencyResolverMain {
|
|
|
476
478
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
477
479
|
static dependencies: Aspect[];
|
|
478
480
|
static slots: (((registerFn: () => string) => SlotRegistry<WorkspacePolicy>) | ((registerFn: () => string) => SlotRegistry<Partial<Record<keyof import("./policy").PolicyConfigKeys, {
|
|
479
|
-
[dependencyId: string]: import("./policy
|
|
481
|
+
[dependencyId: string]: import("./policy").VariantPolicyConfigEntryValue;
|
|
480
482
|
}>>>) | ((registerFn: () => string) => SlotRegistry<PackageManager>) | ((registerFn: () => string) => SlotRegistry<RegExp>) | ((registerFn: () => string) => SlotRegistry<DependencyFactory>) | ((registerFn: () => string) => SlotRegistry<PreInstallSubscriberList>) | ((registerFn: () => string) => SlotRegistry<DependencyDetector>) | ((registerFn: () => string) => SlotRegistry<AddPackagesToLinkSlot>))[];
|
|
481
483
|
static defaultConfig: DependencyResolverWorkspaceConfig & Required<Pick<DependencyResolverWorkspaceConfig, 'linkCoreAspects'>>;
|
|
482
484
|
static provider([envs, loggerExt, configMain, aspectLoader, componentAspect, graphql, configStore]: [
|
|
@@ -351,7 +351,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
351
351
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
352
352
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
353
353
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
354
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
354
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable max-lines */
|
|
355
355
|
const BIT_CLOUD_REGISTRY = exports.BIT_CLOUD_REGISTRY = `https://node-registry.${(0, _legacy().getCloudDomain)()}/`;
|
|
356
356
|
const NPM_REGISTRY = exports.NPM_REGISTRY = 'https://registry.npmjs.org/';
|
|
357
357
|
const defaultLinkingOptions = {
|
|
@@ -1458,7 +1458,8 @@ as an alternative, you can use "+" to keep the same version installed in the wor
|
|
|
1458
1458
|
let allPkgs = this.getAllDependencies({
|
|
1459
1459
|
variantPoliciesByPatterns,
|
|
1460
1460
|
componentPolicies,
|
|
1461
|
-
components
|
|
1461
|
+
components,
|
|
1462
|
+
includeEnvJsoncDeps: true
|
|
1462
1463
|
});
|
|
1463
1464
|
if (patterns?.length) {
|
|
1464
1465
|
const selectedPkgNames = new Set((0, _multimatch().default)(allPkgs.map(({
|
|
@@ -1480,7 +1481,8 @@ as an alternative, you can use "+" to keep the same version installed in the wor
|
|
|
1480
1481
|
getAllDependencies({
|
|
1481
1482
|
variantPoliciesByPatterns,
|
|
1482
1483
|
componentPolicies,
|
|
1483
|
-
components
|
|
1484
|
+
components,
|
|
1485
|
+
includeEnvJsoncDeps = false
|
|
1484
1486
|
}) {
|
|
1485
1487
|
const localComponentPkgNames = new Set(components.map(component => this.getPackageName(component)));
|
|
1486
1488
|
const componentModelVersions = components.map(component => {
|
|
@@ -1498,12 +1500,56 @@ as an alternative, you can use "+" to keep the same version installed in the wor
|
|
|
1498
1500
|
lifecycleType: dep.lifecycle
|
|
1499
1501
|
}));
|
|
1500
1502
|
}).flat();
|
|
1501
|
-
return (0, _getAllPolicyPkgs().getAllPolicyPkgs)({
|
|
1503
|
+
return [...(0, _getAllPolicyPkgs().getAllPolicyPkgs)({
|
|
1502
1504
|
rootPolicy: this.getWorkspacePolicyFromConfig(),
|
|
1503
1505
|
variantPoliciesByPatterns,
|
|
1504
1506
|
componentPolicies,
|
|
1505
1507
|
componentModelVersions
|
|
1506
|
-
});
|
|
1508
|
+
}), ...(includeEnvJsoncDeps ? this.getEnvJsoncPolicyPkgs(components) : [])];
|
|
1509
|
+
}
|
|
1510
|
+
getEnvJsoncPolicyPkgs(components) {
|
|
1511
|
+
const policies = [{
|
|
1512
|
+
field: 'peers',
|
|
1513
|
+
targetField: 'peerDependencies'
|
|
1514
|
+
}, {
|
|
1515
|
+
field: 'dev',
|
|
1516
|
+
targetField: 'devDependencies'
|
|
1517
|
+
}, {
|
|
1518
|
+
field: 'runtime',
|
|
1519
|
+
targetField: 'dependencies'
|
|
1520
|
+
}];
|
|
1521
|
+
const pkgs = [];
|
|
1522
|
+
for (const component of components) {
|
|
1523
|
+
const isEnv = this.envs.isEnv(component);
|
|
1524
|
+
if (!isEnv) continue;
|
|
1525
|
+
const envJsoncFile = component.filesystem.files.find(file => file.relative === 'env.jsonc');
|
|
1526
|
+
if (!envJsoncFile) continue;
|
|
1527
|
+
let envJsonc;
|
|
1528
|
+
try {
|
|
1529
|
+
envJsonc = (0, _commentJson().parse)(envJsoncFile.contents.toString());
|
|
1530
|
+
} catch (error) {
|
|
1531
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1532
|
+
this.logger.warn(`Failed to parse env.jsonc for component ${component.id.toString()}: ${errorMessage}`);
|
|
1533
|
+
continue;
|
|
1534
|
+
}
|
|
1535
|
+
if (!envJsonc.policy) continue;
|
|
1536
|
+
for (const {
|
|
1537
|
+
field,
|
|
1538
|
+
targetField
|
|
1539
|
+
} of policies) {
|
|
1540
|
+
const deps = envJsonc.policy?.[field] || [];
|
|
1541
|
+
for (const dep of deps) {
|
|
1542
|
+
pkgs.push({
|
|
1543
|
+
name: dep.name,
|
|
1544
|
+
currentRange: dep.version,
|
|
1545
|
+
source: 'env-jsonc',
|
|
1546
|
+
componentId: component.id,
|
|
1547
|
+
targetField
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
return pkgs;
|
|
1507
1553
|
}
|
|
1508
1554
|
getAllDedupedDirectDependencies(opts) {
|
|
1509
1555
|
const allDeps = this.getAllDependencies(opts);
|