@stillwind/config 0.1.0-rc.0 → 0.3.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/README.md +4 -6
- package/dist/browser.d.ts +28 -3
- package/dist/browser.js +54 -9
- package/dist/browser.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +1 -1
- package/dist/node.d.ts +35 -9
- package/dist/node.js +48 -9
- package/dist/node.js.map +1 -1
- package/dist/{resolution-BnR6LLM-.d.ts → resolution-D-_c0Q11.d.ts} +73 -15
- package/dist/{resolution-BK-NUhyh.js → resolution-DCwmb-pa.js} +142 -22
- package/dist/resolution-DCwmb-pa.js.map +1 -0
- package/package.json +8 -6
- package/dist/resolution-BK-NUhyh.js.map +0 -1
|
@@ -316,6 +316,12 @@ declare const lintRules: {
|
|
|
316
316
|
readonly defaults: null;
|
|
317
317
|
readonly options: null;
|
|
318
318
|
};
|
|
319
|
+
readonly "implicit-nesting-selector": {
|
|
320
|
+
readonly category: "hazard";
|
|
321
|
+
readonly nativeName: "implicitNestingSelector";
|
|
322
|
+
readonly defaults: null;
|
|
323
|
+
readonly options: null;
|
|
324
|
+
};
|
|
319
325
|
readonly "no-arbitrary-colors": {
|
|
320
326
|
readonly category: "restriction";
|
|
321
327
|
readonly nativeName: "noArbitraryColors";
|
|
@@ -442,12 +448,6 @@ declare const lintRules: {
|
|
|
442
448
|
readonly defaults: null;
|
|
443
449
|
readonly options: null;
|
|
444
450
|
};
|
|
445
|
-
readonly "prefer-explicit-nesting-selector": {
|
|
446
|
-
readonly category: "style";
|
|
447
|
-
readonly nativeName: "preferExplicitNestingSelector";
|
|
448
|
-
readonly defaults: null;
|
|
449
|
-
readonly options: null;
|
|
450
|
-
};
|
|
451
451
|
readonly "prefer-variant-directive": {
|
|
452
452
|
readonly category: "style";
|
|
453
453
|
readonly nativeName: "preferVariantDirective";
|
|
@@ -1156,8 +1156,14 @@ type ProjectionProvider = {
|
|
|
1156
1156
|
};
|
|
1157
1157
|
/** Configuration file settings evaluated by build integrations and analysis hosts. */
|
|
1158
1158
|
interface StillwindConfig {
|
|
1159
|
-
/**
|
|
1160
|
-
|
|
1159
|
+
/**
|
|
1160
|
+
* Nonempty list of projects and references. Projects keep independent scopes and design systems.
|
|
1161
|
+
* Supplied names must be unique. A string references other configuration files, relative to this
|
|
1162
|
+
* file: a file path, a directory that contains stillwind.config.*, or a glob that selects those
|
|
1163
|
+
* files or directories. A `!` prefix removes paths from glob matches. Referenced files must list
|
|
1164
|
+
* project objects only, and a relative project root in them uses their own directory.
|
|
1165
|
+
*/
|
|
1166
|
+
projects: (AnalysisProjectConfig | string)[];
|
|
1161
1167
|
}
|
|
1162
1168
|
/** Called without arguments during configuration evaluation. Returns settings directly or asynchronously. */
|
|
1163
1169
|
type StillwindConfigFactory = () => StillwindConfig | Promise<StillwindConfig>;
|
|
@@ -1181,17 +1187,22 @@ declare function defineConfig<T extends StillwindConfigExport>(config: T): T;
|
|
|
1181
1187
|
*/
|
|
1182
1188
|
declare function resolveConfig(value: unknown): Promise<StillwindConfig>;
|
|
1183
1189
|
/**
|
|
1184
|
-
* Validates evaluated projects and their compiler settings without running providers
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1190
|
+
* Validates evaluated projects and their compiler settings without running providers, resolving
|
|
1191
|
+
* paths, or reading referenced configuration files.
|
|
1192
|
+
* @param value - Evaluated settings with a nonempty list of projects and references, required CSS
|
|
1193
|
+
* paths and file globs, and unique names when names are supplied.
|
|
1187
1194
|
* @returns The supplied settings with object and callback identities preserved.
|
|
1188
1195
|
* @throws If a field, project name, effective lint policy, or compiler namespace is invalid.
|
|
1189
1196
|
* Validation errors include the authored field path.
|
|
1190
1197
|
*/
|
|
1191
1198
|
declare function validateConfig(value: unknown): StillwindConfig;
|
|
1192
|
-
/**
|
|
1199
|
+
/**
|
|
1200
|
+
* Inline options that can pass through isolated loader workers.
|
|
1201
|
+
*/
|
|
1193
1202
|
type SerializableInlineConfig = Omit<InlineConfig, "naming" | "plugins" | "tailwind">;
|
|
1194
|
-
/**
|
|
1203
|
+
/**
|
|
1204
|
+
* Build overrides and the selection of a configuration file and project.
|
|
1205
|
+
*/
|
|
1195
1206
|
interface InlineConfig extends BuildConfig {
|
|
1196
1207
|
/**
|
|
1197
1208
|
* Configuration file path, absolute or relative to the application root. An explicit path must
|
|
@@ -1204,7 +1215,54 @@ interface InlineConfig extends BuildConfig {
|
|
|
1204
1215
|
*/
|
|
1205
1216
|
project?: string;
|
|
1206
1217
|
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Path operations supplied by the host's filesystem or virtual workspace.
|
|
1220
|
+
*/
|
|
1221
|
+
interface ConfigPaths {
|
|
1222
|
+
/**
|
|
1223
|
+
* Combines path segments and removes relative traversal segments.
|
|
1224
|
+
*
|
|
1225
|
+
* @param paths - Path segments interpreted using the host's path syntax and working directory.
|
|
1226
|
+
* @returns A normalized absolute path. An absolute segment replaces preceding segments.
|
|
1227
|
+
*/
|
|
1228
|
+
resolve(...paths: string[]): string;
|
|
1229
|
+
/**
|
|
1230
|
+
* Gets the parent directory used to walk configuration candidates.
|
|
1231
|
+
*
|
|
1232
|
+
* @param path - Normalized absolute path in the same syntax accepted by resolve.
|
|
1233
|
+
* @returns Its absolute parent directory. A filesystem root must return itself to end traversal.
|
|
1234
|
+
*/
|
|
1235
|
+
dirname(path: string): string;
|
|
1236
|
+
/**
|
|
1237
|
+
* Computes the path used to determine project containment.
|
|
1238
|
+
*
|
|
1239
|
+
* @param from - Absolute project root.
|
|
1240
|
+
* @param to - Absolute application directory.
|
|
1241
|
+
* @returns A relative path, or an absolute path when the host cannot express a relative path.
|
|
1242
|
+
* The same location returns an empty string.
|
|
1243
|
+
*/
|
|
1244
|
+
relative(from: string, to: string): string;
|
|
1245
|
+
/**
|
|
1246
|
+
* Recognizes absolute paths using the same syntax as the other operations.
|
|
1247
|
+
*
|
|
1248
|
+
* @param path - Path returned by a path operation or supplied by configuration.
|
|
1249
|
+
* @returns Whether the path is absolute for this host.
|
|
1250
|
+
*/
|
|
1251
|
+
isAbsolute(path: string): boolean;
|
|
1252
|
+
}
|
|
1207
1253
|
/** Filenames in precedence order within each searched directory. */
|
|
1208
1254
|
declare const configurationFiles: string[];
|
|
1209
|
-
|
|
1210
|
-
|
|
1255
|
+
/**
|
|
1256
|
+
* Finds the nearest configuration of a document in a workspace folder. Evaluating a configuration
|
|
1257
|
+
* runs its code, so this skips files that the user did not place in the workspace.
|
|
1258
|
+
*
|
|
1259
|
+
* @param file - Absolute document path.
|
|
1260
|
+
* @param folders - Absolute workspace folders.
|
|
1261
|
+
* @param exists - Tests whether a file exists.
|
|
1262
|
+
* @param paths - Host path operations.
|
|
1263
|
+
* @returns The nearest configuration path inside the folder that contains the document, or
|
|
1264
|
+
* undefined when the document lies outside the folders or in `node_modules`, or no such file exists.
|
|
1265
|
+
*/
|
|
1266
|
+
declare function documentConfiguration(file: string, folders: readonly string[], exists: (file: string) => boolean, paths: ConfigPaths): string | undefined;
|
|
1267
|
+
export { lintRules as $, definePlugin as A, LintScope as B, UtilitySortOptions as C, PluginDirectoryEntry as D, PluginContext as E, ImportantOptions as F, RestrictedDeclarationsOptions as G, LogicalPropertiesOptions as H, LengthUnitsOptions as I, VariantDirectiveOptions as J, RestrictedThemeTokensOptions as K, LintConfig as L, CanonicalUtilitiesOptions as M, ConflictingUtilitiesOptions as N, PluginWatchKind as O, DefinitionScope as P, LintRule as Q, LintPreset as R, TailwindConfig as S, validateCompilerConfig as T, MarkerUseOptions as U, LintSeverity as V, ResolvedLintRules as W, resolveLintConfig as X, mergeLintConfig as Y, LintCategory as Z, validateConfig as _, AnalysisProjectConfig as a, BuildOptions as b, ProjectionProvider as c, StillwindConfig as d, StillwindConfigExport as f, resolveConfig as g, defineConfig as h, documentConfiguration as i, ArbitrarySpacingOptions as j, StillwindPlugin as k, SourceProvider as l, captureProjectConfig as m, SerializableInlineConfig as n, CapturedProjectConfig as o, StillwindConfigFactory as p, RestrictedUtilitiesOptions as q, configurationFiles as r, PreviewOptions as s, InlineConfig as t, SourceProviderContext as u, BaseConfig as v, normalizeCompilerConfig as w, NormalizedCompilerConfig as x, BuildConfig as y, LintRules as z };
|
|
1268
|
+
//# sourceMappingURL=resolution-D-_c0Q11.d.ts.map
|
|
@@ -39,10 +39,10 @@ const recommended = {
|
|
|
39
39
|
"interfering-imported-style-base": "warn",
|
|
40
40
|
"incompatible-property-value": "deny",
|
|
41
41
|
"invalid-utility": "deny",
|
|
42
|
-
"unknown-utility": "
|
|
42
|
+
"unknown-utility": "deny",
|
|
43
43
|
"invalid-marker-use": "warn",
|
|
44
44
|
"invalid-variant": "deny",
|
|
45
|
-
"unknown-variant": "
|
|
45
|
+
"unknown-variant": "deny",
|
|
46
46
|
"missing-document-target": "deny",
|
|
47
47
|
"prefer-canonical-utilities": "warn",
|
|
48
48
|
"redundant-variant": "warn",
|
|
@@ -57,7 +57,7 @@ const recommended = {
|
|
|
57
57
|
"ignored-definition-condition": "deny",
|
|
58
58
|
"incompatible-theme-value": "deny",
|
|
59
59
|
"ignored-tailwind-feature": "warn",
|
|
60
|
-
"
|
|
60
|
+
"implicit-nesting-selector": "warn"
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
@@ -124,7 +124,7 @@ const lintPresets = {
|
|
|
124
124
|
"ignored-definition-condition": "deny",
|
|
125
125
|
"incompatible-theme-value": "deny",
|
|
126
126
|
"ignored-tailwind-feature": "deny",
|
|
127
|
-
"
|
|
127
|
+
"implicit-nesting-selector": "deny",
|
|
128
128
|
"unused-lint-suppression": "deny"
|
|
129
129
|
}
|
|
130
130
|
},
|
|
@@ -455,6 +455,12 @@ const lintRules = {
|
|
|
455
455
|
defaults: null,
|
|
456
456
|
options: null
|
|
457
457
|
},
|
|
458
|
+
"implicit-nesting-selector": {
|
|
459
|
+
category: "hazard",
|
|
460
|
+
nativeName: "implicitNestingSelector",
|
|
461
|
+
defaults: null,
|
|
462
|
+
options: null
|
|
463
|
+
},
|
|
458
464
|
"no-arbitrary-colors": {
|
|
459
465
|
category: "restriction",
|
|
460
466
|
nativeName: "noArbitraryColors",
|
|
@@ -599,12 +605,6 @@ const lintRules = {
|
|
|
599
605
|
defaults: null,
|
|
600
606
|
options: null
|
|
601
607
|
},
|
|
602
|
-
"prefer-explicit-nesting-selector": {
|
|
603
|
-
category: "style",
|
|
604
|
-
nativeName: "preferExplicitNestingSelector",
|
|
605
|
-
defaults: null,
|
|
606
|
-
options: null
|
|
607
|
-
},
|
|
608
608
|
"prefer-variant-directive": {
|
|
609
609
|
category: "style",
|
|
610
610
|
nativeName: "preferVariantDirective",
|
|
@@ -1147,11 +1147,11 @@ const projectSchema = strictObject({
|
|
|
1147
1147
|
prepare: v.function()
|
|
1148
1148
|
})])))
|
|
1149
1149
|
});
|
|
1150
|
-
const configurationSchema = v.pipe(strictObject({ projects: v.pipe(v.array(projectSchema), v.minLength(1, "must be a nonempty projects array")) }), v.rawCheck(({ dataset, addIssue }) => {
|
|
1150
|
+
const configurationSchema = v.pipe(strictObject({ projects: v.pipe(v.array(v.lazy((entry) => typeof entry === "string" ? nonemptyText : projectSchema)), v.minLength(1, "must be a nonempty projects array")) }), v.rawCheck(({ dataset, addIssue }) => {
|
|
1151
1151
|
if (!dataset.typed) return;
|
|
1152
1152
|
const names = /* @__PURE__ */ new Set();
|
|
1153
1153
|
for (const [index, project] of dataset.value.projects.entries()) {
|
|
1154
|
-
if (project.name === void 0) continue;
|
|
1154
|
+
if (typeof project === "string" || project.name === void 0) continue;
|
|
1155
1155
|
if (names.has(project.name)) addIssue({
|
|
1156
1156
|
message: `Duplicate Stillwind project name: ${project.name}`,
|
|
1157
1157
|
path: [
|
|
@@ -1182,9 +1182,10 @@ const configurationSchema = v.pipe(strictObject({ projects: v.pipe(v.array(proje
|
|
|
1182
1182
|
}
|
|
1183
1183
|
}));
|
|
1184
1184
|
/**
|
|
1185
|
-
* Validates evaluated projects and their compiler settings without running providers
|
|
1186
|
-
*
|
|
1187
|
-
*
|
|
1185
|
+
* Validates evaluated projects and their compiler settings without running providers, resolving
|
|
1186
|
+
* paths, or reading referenced configuration files.
|
|
1187
|
+
* @param value - Evaluated settings with a nonempty list of projects and references, required CSS
|
|
1188
|
+
* paths and file globs, and unique names when names are supplied.
|
|
1188
1189
|
* @returns The supplied settings with object and callback identities preserved.
|
|
1189
1190
|
* @throws If a field, project name, effective lint policy, or compiler namespace is invalid.
|
|
1190
1191
|
* Validation errors include the authored field path.
|
|
@@ -1192,6 +1193,7 @@ const configurationSchema = v.pipe(strictObject({ projects: v.pipe(v.array(proje
|
|
|
1192
1193
|
function validateConfig(value) {
|
|
1193
1194
|
validate(configurationSchema, value, "config");
|
|
1194
1195
|
for (const [index, project] of value.projects.entries()) {
|
|
1196
|
+
if (typeof project === "string") continue;
|
|
1195
1197
|
const { automatic: _automatic, name: _name, files: _files, exclude: _exclude, sources: _sources, projection: _projection, typeFacts: _typeFacts, ...compiler } = project;
|
|
1196
1198
|
validateCompilerConfig(compiler, `projects[${index}]`);
|
|
1197
1199
|
}
|
|
@@ -1224,7 +1226,9 @@ function mergeValue(base, override) {
|
|
|
1224
1226
|
return result;
|
|
1225
1227
|
}
|
|
1226
1228
|
// src/resolution.ts
|
|
1227
|
-
/**
|
|
1229
|
+
/**
|
|
1230
|
+
* Selects projects and resolves compiler settings through host-supplied path operations, without reading files.
|
|
1231
|
+
*/
|
|
1228
1232
|
/** Filenames in precedence order within each searched directory. */
|
|
1229
1233
|
const configurationFiles = [
|
|
1230
1234
|
"ts",
|
|
@@ -1237,6 +1241,7 @@ const configurationFiles = [
|
|
|
1237
1241
|
].map((extension) => `stillwind.config.${extension}`);
|
|
1238
1242
|
/**
|
|
1239
1243
|
* Enumerates configuration candidates from the nearest directory to the host's root.
|
|
1244
|
+
*
|
|
1240
1245
|
* @param directory - Starting directory, normalized with the supplied resolve operation.
|
|
1241
1246
|
* @param paths - Consistent host path operations. dirname must return the root unchanged.
|
|
1242
1247
|
* @returns Absolute candidate paths in directory order, then configurationFiles order within each
|
|
@@ -1253,7 +1258,121 @@ function configurationCandidates(directory, paths) {
|
|
|
1253
1258
|
}
|
|
1254
1259
|
}
|
|
1255
1260
|
/**
|
|
1261
|
+
* Tests whether a directory contains a path.
|
|
1262
|
+
*
|
|
1263
|
+
* @param directory - Absolute directory.
|
|
1264
|
+
* @param target - Absolute path in the same syntax.
|
|
1265
|
+
* @param paths - Host path operations.
|
|
1266
|
+
* @returns True for the directory itself and for its descendants.
|
|
1267
|
+
*/
|
|
1268
|
+
function containsPath(directory, target, paths) {
|
|
1269
|
+
const relative = paths.relative(directory, target).replaceAll("\\", "/");
|
|
1270
|
+
return relative === "" || !paths.isAbsolute(relative) && relative !== ".." && !relative.startsWith("../");
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Finds the nearest configuration of a document in a workspace folder. Evaluating a configuration
|
|
1274
|
+
* runs its code, so this skips files that the user did not place in the workspace.
|
|
1275
|
+
*
|
|
1276
|
+
* @param file - Absolute document path.
|
|
1277
|
+
* @param folders - Absolute workspace folders.
|
|
1278
|
+
* @param exists - Tests whether a file exists.
|
|
1279
|
+
* @param paths - Host path operations.
|
|
1280
|
+
* @returns The nearest configuration path inside the folder that contains the document, or
|
|
1281
|
+
* undefined when the document lies outside the folders or in `node_modules`, or no such file exists.
|
|
1282
|
+
*/
|
|
1283
|
+
function documentConfiguration(file, folders, exists, paths) {
|
|
1284
|
+
const folder = folders.find((candidate) => containsPath(candidate, file, paths));
|
|
1285
|
+
if (!folder || paths.relative(folder, file).replaceAll("\\", "/").split("/").includes("node_modules")) return;
|
|
1286
|
+
const found = configurationCandidates(paths.dirname(file), paths).find(exists);
|
|
1287
|
+
return found && containsPath(folder, found, paths) ? found : void 0;
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Finds the configuration files that a reference string selects.
|
|
1291
|
+
*
|
|
1292
|
+
* @param reference - Path or glob relative to directory, without a `!` prefix. An existing path
|
|
1293
|
+
* takes precedence over its glob meaning, so a directory such as `apps/(web)` stays usable.
|
|
1294
|
+
* @param negated - Paths and globs from `!` entries, relative to directory.
|
|
1295
|
+
* @param directory - Absolute directory of the configuration that declares the reference.
|
|
1296
|
+
* @param host - File access for the configuration's filesystem or virtual workspace.
|
|
1297
|
+
* @param paths - Host path operations.
|
|
1298
|
+
* @returns Absolute configuration paths. A glob returns at most one file per directory, chosen in
|
|
1299
|
+
* configurationFiles order, and skips directories that have no configuration file.
|
|
1300
|
+
* @throws If a reference without glob syntax does not identify a file or a configured directory.
|
|
1301
|
+
*/
|
|
1302
|
+
async function referencedFiles(reference, negated, directory, host, paths) {
|
|
1303
|
+
const target = paths.resolve(directory, reference);
|
|
1304
|
+
const direct = [target, ...configurationFiles.map((file) => paths.resolve(target, file))].find((file) => host.isFile(file));
|
|
1305
|
+
if (direct) return [direct];
|
|
1306
|
+
if (!/[*?[\]{}()]/.test(reference)) throw new Error(`Cannot find Stillwind configuration: ${target}`);
|
|
1307
|
+
const pattern = globPath(reference);
|
|
1308
|
+
const matches = new Set(await host.glob([pattern, ...configurationFiles.map((file) => `${pattern}/${file}`)], [
|
|
1309
|
+
"**/node_modules/**",
|
|
1310
|
+
"**/.git/**",
|
|
1311
|
+
...negated.flatMap((path) => [globPath(path), `${globPath(path)}/**`])
|
|
1312
|
+
], directory));
|
|
1313
|
+
return [...new Set([...matches].map((file) => paths.dirname(file)))].sort().flatMap((match) => {
|
|
1314
|
+
const file = configurationFiles.map((name) => paths.resolve(match, name)).find((candidate) => matches.has(candidate));
|
|
1315
|
+
return file ? [file] : [];
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* Removes path spellings that glob matchers would treat as literal segments.
|
|
1320
|
+
*
|
|
1321
|
+
* @param path - Authored relative path or glob.
|
|
1322
|
+
* @returns The path without leading `./` segments or trailing slashes.
|
|
1323
|
+
*/
|
|
1324
|
+
function globPath(path) {
|
|
1325
|
+
return path.replace(/^(?:\.\/)+/, "").replace(/\/+$/, "");
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Replaces references with the projects of the files that they select.
|
|
1329
|
+
*
|
|
1330
|
+
* @param config - Validated settings of the configuration file.
|
|
1331
|
+
* @param file - Normalized absolute path of the configuration file.
|
|
1332
|
+
* @param host - File access for following references.
|
|
1333
|
+
* @param paths - Host path operations.
|
|
1334
|
+
* @returns Projects in authored order. Project objects of config keep their identity and relative
|
|
1335
|
+
* paths. Referenced projects are copies with an absolute root, so their relative paths stay valid
|
|
1336
|
+
* against any configuration directory. Each file contributes once, even if several references
|
|
1337
|
+
* select it, and a reference to file itself adds nothing.
|
|
1338
|
+
* @throws If a reference selects no file, a referenced file contains references, evaluation fails,
|
|
1339
|
+
* no project remains, or two projects share a name.
|
|
1340
|
+
*/
|
|
1341
|
+
async function expandProjects(config, file, host, paths) {
|
|
1342
|
+
const directory = paths.dirname(file);
|
|
1343
|
+
const negated = config.projects.flatMap((entry) => typeof entry === "string" && entry.startsWith("!") ? [entry.slice(1)] : []);
|
|
1344
|
+
const visited = /* @__PURE__ */ new Set([file]);
|
|
1345
|
+
const projects = [];
|
|
1346
|
+
for (const entry of config.projects) {
|
|
1347
|
+
if (typeof entry !== "string") {
|
|
1348
|
+
projects.push(entry);
|
|
1349
|
+
continue;
|
|
1350
|
+
}
|
|
1351
|
+
if (entry.startsWith("!")) continue;
|
|
1352
|
+
for (const referenced of await referencedFiles(entry, negated, directory, host, paths)) {
|
|
1353
|
+
if (visited.has(referenced)) continue;
|
|
1354
|
+
visited.add(referenced);
|
|
1355
|
+
const base = paths.dirname(referenced);
|
|
1356
|
+
for (const project of (await host.load(referenced)).projects) {
|
|
1357
|
+
if (typeof project === "string") throw new Error(`Stillwind configuration ${referenced} cannot contain references because ${file} references it`);
|
|
1358
|
+
projects.push({
|
|
1359
|
+
...project,
|
|
1360
|
+
root: paths.resolve(base, project.root ?? ".")
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
if (!projects.length) throw new Error(`Stillwind configuration ${file}: projects selects no project`);
|
|
1366
|
+
const names = /* @__PURE__ */ new Set();
|
|
1367
|
+
for (const { name } of projects) {
|
|
1368
|
+
if (name !== void 0 && names.has(name)) throw new Error(`Duplicate Stillwind project name: ${name}`);
|
|
1369
|
+
if (name !== void 0) names.add(name);
|
|
1370
|
+
}
|
|
1371
|
+
return projects;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1256
1374
|
* Resolves project paths from their authored root without changing the supplied settings.
|
|
1375
|
+
*
|
|
1257
1376
|
* @param project - Validated project with a required CSS path and optional root and tsconfig paths.
|
|
1258
1377
|
* @param directory - Absolute configuration directory used for a relative or omitted project root.
|
|
1259
1378
|
* @param paths - Host operations used to resolve each path.
|
|
@@ -1271,6 +1390,7 @@ function resolveProjectPaths(project, directory, paths) {
|
|
|
1271
1390
|
}
|
|
1272
1391
|
/**
|
|
1273
1392
|
* Removes analysis scope and providers while preserving compiler and delivery settings.
|
|
1393
|
+
*
|
|
1274
1394
|
* @param project - Evaluated project whose names, file scopes, and providers are no longer needed.
|
|
1275
1395
|
* @returns A shallow copy containing compiler fields and automatic CSS delivery settings. Paths
|
|
1276
1396
|
* and retained nested objects are unchanged.
|
|
@@ -1287,6 +1407,7 @@ const inlineSchema = strictObject({
|
|
|
1287
1407
|
});
|
|
1288
1408
|
/**
|
|
1289
1409
|
* Validates inline selectors and compiler overrides before selection or path resolution.
|
|
1410
|
+
*
|
|
1290
1411
|
* @param inline - File and project selectors with compiler and delivery overrides.
|
|
1291
1412
|
* @throws If a field is unknown or invalid, or a lint preset has a cycle. Namespace collisions
|
|
1292
1413
|
* and required effective lint options can remain deferred until settings are merged.
|
|
@@ -1298,6 +1419,7 @@ function validateInlineConfig(inline) {
|
|
|
1298
1419
|
}
|
|
1299
1420
|
/**
|
|
1300
1421
|
* Selects a named project, the sole project, or the unique deepest containing project root.
|
|
1422
|
+
*
|
|
1301
1423
|
* @param projects - Evaluated projects with normalized absolute roots. Entries are not modified.
|
|
1302
1424
|
* @param applicationRoot - Absolute application directory used for containment when no name is supplied.
|
|
1303
1425
|
* @param inline - Project name and optional root override. The override changes the directory tested for containment.
|
|
@@ -1311,10 +1433,7 @@ function selectProject(projects, applicationRoot, inline, paths) {
|
|
|
1311
1433
|
else if (projects.length === 1) selected = projects;
|
|
1312
1434
|
else {
|
|
1313
1435
|
const target = paths.resolve(applicationRoot, inline.root ?? ".");
|
|
1314
|
-
const matches = projects.filter((project) =>
|
|
1315
|
-
const relative = paths.relative(project.root, target).replaceAll("\\", "/");
|
|
1316
|
-
return relative === "" || !paths.isAbsolute(relative) && relative !== ".." && !relative.startsWith("../");
|
|
1317
|
-
});
|
|
1436
|
+
const matches = projects.filter((project) => containsPath(project.root, target, paths));
|
|
1318
1437
|
const depth = Math.max(...matches.map((project) => project.root.length));
|
|
1319
1438
|
selected = matches.filter((project) => project.root.length === depth);
|
|
1320
1439
|
}
|
|
@@ -1323,6 +1442,7 @@ function selectProject(projects, applicationRoot, inline, paths) {
|
|
|
1323
1442
|
}
|
|
1324
1443
|
/**
|
|
1325
1444
|
* Applies overrides and defaults, then resolves inline paths from the resulting project root.
|
|
1445
|
+
*
|
|
1326
1446
|
* @param base - Project settings with file-authored root, CSS, and tsconfig paths already resolved.
|
|
1327
1447
|
* @param inline - Validated selectors and compiler overrides. Selectors are discarded before merging.
|
|
1328
1448
|
* @param applicationRoot - Absolute base directory for an inline root override or omitted project root.
|
|
@@ -1346,6 +1466,6 @@ function resolveCompilerSettings(base, inline, applicationRoot, paths) {
|
|
|
1346
1466
|
...typeof config.tsconfig === "string" ? { tsconfig: paths.resolve(root, config.tsconfig) } : {}
|
|
1347
1467
|
};
|
|
1348
1468
|
}
|
|
1349
|
-
export {
|
|
1469
|
+
export { mergeLintConfig as _, expandProjects as a, lintPresets as b, selectProject as c, captureProjectConfig as d, defineConfig as f, validateCompilerConfig as g, normalizeCompilerConfig as h, documentConfiguration as i, validateInlineConfig as l, validateConfig as m, configurationCandidates as n, resolveCompilerSettings as o, resolveConfig as p, configurationFiles as r, resolveProjectPaths as s, compilerConfig as t, mergeConfig as u, resolveLintConfig as v, lintRules as y };
|
|
1350
1470
|
|
|
1351
|
-
//# sourceMappingURL=resolution-
|
|
1471
|
+
//# sourceMappingURL=resolution-DCwmb-pa.js.map
|