@codedrifters/configulator 0.0.455 → 0.0.456

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/lib/index.mjs CHANGED
@@ -21026,6 +21026,86 @@ var MINIMUM_RELEASE_AGE = {
21026
21026
  SIX_DAYS: 8640,
21027
21027
  ONE_WEEK: 10080
21028
21028
  };
21029
+ var CURATED_SETTING_KEYS = [
21030
+ // Dependency graph
21031
+ "overrides",
21032
+ "packageExtensions",
21033
+ "patchedDependencies",
21034
+ "patchesDir",
21035
+ "allowUnusedPatches",
21036
+ "allowedDeprecatedVersions",
21037
+ "ignoredOptionalDependencies",
21038
+ "supportedArchitectures",
21039
+ "configDependencies",
21040
+ "resolutionMode",
21041
+ "savePrefix",
21042
+ "saveExact",
21043
+ // Supply-chain posture
21044
+ "trustPolicy",
21045
+ "trustPolicyExclude",
21046
+ "trustPolicyIgnoreAfter",
21047
+ "blockExoticSubdeps",
21048
+ "minimumReleaseAgeExcludePrune",
21049
+ // Peer dependencies
21050
+ "autoInstallPeers",
21051
+ "strictPeerDependencies",
21052
+ "dedupePeerDependents",
21053
+ "resolvePeersFromWorkspaceRoot",
21054
+ "peerDependencyRules",
21055
+ // Workspace semantics
21056
+ "linkWorkspacePackages",
21057
+ "preferWorkspacePackages",
21058
+ "injectWorkspacePackages",
21059
+ "dedupeInjectedDeps",
21060
+ "syncInjectedDepsAfterScripts",
21061
+ "saveWorkspaceProtocol",
21062
+ "includeWorkspaceRoot",
21063
+ "sharedWorkspaceLockfile",
21064
+ "disallowWorkspaceCycles",
21065
+ "hoistWorkspacePackages",
21066
+ "requiredScripts",
21067
+ // Layout and lockfile
21068
+ "nodeLinker",
21069
+ "hoistPattern",
21070
+ "publicHoistPattern",
21071
+ "shamefullyHoist",
21072
+ "preferFrozenLockfile",
21073
+ "peersSuffixMaxLength",
21074
+ // Scripts, engines, publish
21075
+ "enablePrePostScripts",
21076
+ "nodeOptions",
21077
+ "engineStrict",
21078
+ "gitChecks",
21079
+ "publishBranch",
21080
+ "provenance",
21081
+ "embedReadme"
21082
+ ];
21083
+ var RESERVED_YAML_KEYS = {
21084
+ // Structural keys whose option name differs from the emitted YAML key.
21085
+ packages: "subprojects",
21086
+ catalog: "defaultCatalog",
21087
+ catalogs: "namedCatalogs",
21088
+ // Settings emitted by the pre-existing typed surface.
21089
+ minimumReleaseAge: "minimumReleaseAge",
21090
+ minimumReleaseAgeExclude: "minimumReleaseAgeExclude",
21091
+ onlyBuiltDependencies: "onlyBuiltDependencies",
21092
+ ignoredBuiltDependencies: "ignoredBuiltDependencies",
21093
+ allowBuilds: "allowBuilds",
21094
+ confirmModulesPurge: "confirmModulesPurge",
21095
+ strictDepBuilds: "strictDepBuilds",
21096
+ verifyDepsBeforeRun: "verifyDepsBeforeRun",
21097
+ catalogMode: "catalogMode",
21098
+ cleanupUnusedCatalogs: "cleanupUnusedCatalogs",
21099
+ minimumReleaseAgeStrict: "minimumReleaseAgeStrict",
21100
+ minimumReleaseAgeIgnoreMissingTime: "minimumReleaseAgeIgnoreMissingTime",
21101
+ // Settings with bespoke emission.
21102
+ neverBuiltDependencies: "neverBuiltDependencies",
21103
+ catalogPrune: "catalogPrune",
21104
+ update: "update",
21105
+ updateConfig: "updateConfig",
21106
+ // Every curated passthrough setting is an identity mapping.
21107
+ ...Object.fromEntries(CURATED_SETTING_KEYS.map((key) => [key, key]))
21108
+ };
21029
21109
  var PnpmWorkspace = class _PnpmWorkspace extends Component3 {
21030
21110
  /**
21031
21111
  * Get the pnpm workspace component of a project. If it does not exist,
@@ -21057,6 +21137,28 @@ var PnpmWorkspace = class _PnpmWorkspace extends Component3 {
21057
21137
  this.cleanupUnusedCatalogs = options.cleanupUnusedCatalogs;
21058
21138
  this.minimumReleaseAgeStrict = options.minimumReleaseAgeStrict ?? false;
21059
21139
  this.minimumReleaseAgeIgnoreMissingTime = options.minimumReleaseAgeIgnoreMissingTime;
21140
+ this.curatedSettings = {};
21141
+ for (const key of [
21142
+ ...CURATED_SETTING_KEYS,
21143
+ "neverBuiltDependencies",
21144
+ "catalogPrune",
21145
+ "update",
21146
+ "updateConfig"
21147
+ ]) {
21148
+ const value = options[key];
21149
+ if (value !== void 0) {
21150
+ this.curatedSettings[key] = value;
21151
+ }
21152
+ }
21153
+ this.additionalSettings = { ...options.additionalSettings };
21154
+ for (const settingName of Object.keys(this.additionalSettings)) {
21155
+ const typedOption = RESERVED_YAML_KEYS[settingName];
21156
+ if (typedOption !== void 0) {
21157
+ throw new Error(
21158
+ `additionalSettings["${settingName}"] collides with a key that ${this.constructor.name} already emits. Use the \`${typedOption}\` option instead of passing "${settingName}" through additionalSettings.`
21159
+ );
21160
+ }
21161
+ }
21060
21162
  project.addPackageIgnore(this.fileName);
21061
21163
  project.tryRemoveFile(this.fileName);
21062
21164
  new YamlFile(this.project, this.fileName, {
@@ -21078,6 +21180,7 @@ var PnpmWorkspace = class _PnpmWorkspace extends Component3 {
21078
21180
  if (this.minimumReleaseAgeExclude.length > 0) {
21079
21181
  pnpmConfig.minimumReleaseAgeExclude = this.minimumReleaseAgeExclude;
21080
21182
  }
21183
+ const neverBuiltDependencies = this.curatedSettings.neverBuiltDependencies ?? [];
21081
21184
  const mergedAllowBuilds = {};
21082
21185
  for (const pkg of this.onlyBuiltDependencies) {
21083
21186
  mergedAllowBuilds[pkg] = true;
@@ -21085,6 +21188,9 @@ var PnpmWorkspace = class _PnpmWorkspace extends Component3 {
21085
21188
  for (const pkg of this.ignoredBuiltDependencies) {
21086
21189
  mergedAllowBuilds[pkg] = false;
21087
21190
  }
21191
+ for (const pkg of neverBuiltDependencies) {
21192
+ mergedAllowBuilds[pkg] = false;
21193
+ }
21088
21194
  for (const [pkg, allowed] of Object.entries(this.allowBuilds)) {
21089
21195
  mergedAllowBuilds[pkg] = allowed;
21090
21196
  }
@@ -21105,6 +21211,9 @@ var PnpmWorkspace = class _PnpmWorkspace extends Component3 {
21105
21211
  if (denyList.length > 0) {
21106
21212
  pnpmConfig.ignoredBuiltDependencies = denyList;
21107
21213
  }
21214
+ if (neverBuiltDependencies.length > 0) {
21215
+ pnpmConfig.neverBuiltDependencies = neverBuiltDependencies;
21216
+ }
21108
21217
  if (Object.keys(mergedAllowBuilds).length > 0) {
21109
21218
  pnpmConfig.allowBuilds = mergedAllowBuilds;
21110
21219
  }
@@ -21126,7 +21235,10 @@ var PnpmWorkspace = class _PnpmWorkspace extends Component3 {
21126
21235
  if (this.catalogMode !== void 0) {
21127
21236
  pnpmConfig.catalogMode = this.catalogMode;
21128
21237
  }
21129
- if (this.cleanupUnusedCatalogs !== void 0) {
21238
+ const catalogPrune = this.curatedSettings.catalogPrune;
21239
+ if (catalogPrune !== void 0) {
21240
+ pnpmConfig.catalogPrune = catalogPrune;
21241
+ } else if (this.cleanupUnusedCatalogs !== void 0) {
21130
21242
  pnpmConfig.cleanupUnusedCatalogs = this.cleanupUnusedCatalogs;
21131
21243
  }
21132
21244
  if (this.minimumReleaseAgeStrict !== void 0) {
@@ -21135,6 +21247,24 @@ var PnpmWorkspace = class _PnpmWorkspace extends Component3 {
21135
21247
  if (this.minimumReleaseAgeIgnoreMissingTime !== void 0) {
21136
21248
  pnpmConfig.minimumReleaseAgeIgnoreMissingTime = this.minimumReleaseAgeIgnoreMissingTime;
21137
21249
  }
21250
+ for (const settingName of CURATED_SETTING_KEYS) {
21251
+ const value = this.curatedSettings[settingName];
21252
+ if (value !== void 0) {
21253
+ pnpmConfig[settingName] = value;
21254
+ }
21255
+ }
21256
+ const update = this.curatedSettings.update;
21257
+ const updateConfig = this.curatedSettings.updateConfig;
21258
+ if (update !== void 0) {
21259
+ pnpmConfig.update = update;
21260
+ } else if (updateConfig !== void 0) {
21261
+ pnpmConfig.updateConfig = updateConfig;
21262
+ }
21263
+ for (const [settingName, value] of Object.entries(
21264
+ this.additionalSettings
21265
+ )) {
21266
+ pnpmConfig[settingName] = value;
21267
+ }
21138
21268
  return {
21139
21269
  ...packages.length > 0 ? { packages } : {},
21140
21270
  ...pnpmConfig ? { ...pnpmConfig } : {}
@@ -21142,6 +21272,27 @@ var PnpmWorkspace = class _PnpmWorkspace extends Component3 {
21142
21272
  }
21143
21273
  });
21144
21274
  }
21275
+ /**
21276
+ * Read back a configured pnpm setting by name.
21277
+ *
21278
+ * Covers both tiers: curated settings added since the original typed
21279
+ * surface, and verbatim `additionalSettings` passthrough keys. Returns
21280
+ * `undefined` when the setting was not configured, which is the same
21281
+ * signal the emitter uses to omit the key from the generated YAML.
21282
+ *
21283
+ * The fifteen original options (`minimumReleaseAge`, `allowBuilds`,
21284
+ * `defaultCatalog`, and friends) remain available as public fields and are
21285
+ * not served by this accessor.
21286
+ *
21287
+ * @param settingName - The pnpm setting name, e.g. `"overrides"`.
21288
+ * @returns The configured value, or `undefined` when unset.
21289
+ */
21290
+ setting(settingName) {
21291
+ if (settingName in this.curatedSettings) {
21292
+ return this.curatedSettings[settingName];
21293
+ }
21294
+ return this.additionalSettings[settingName];
21295
+ }
21145
21296
  };
21146
21297
  var MIMIMUM_RELEASE_AGE = MINIMUM_RELEASE_AGE;
21147
21298