@stillwind/config 0.11.0 → 0.13.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/CHANGELOG.md +20 -0
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/index.d.ts +20 -8
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +1 -1
- package/dist/{resolution-DXJofnPi.js → resolution-BPkEjdAJ.js} +51 -12
- package/dist/resolution-BPkEjdAJ.js.map +1 -0
- package/dist/{resolution-BUezoP4C.d.ts → resolution-C7hbL5Nx.d.ts} +98 -6
- package/package.json +4 -4
- package/dist/resolution-DXJofnPi.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @stillwind/config
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- @stillwind/native@0.13.0
|
|
9
|
+
- @stillwind/projection@0.13.0
|
|
10
|
+
|
|
11
|
+
## 0.12.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- Added project-scoped `hooks` (`defineHook` and `AnalysisHook` from `stillwind/config` and `@stillwind/config`) for in-memory formatting in `stillwind fmt` and `stillwind check`. Hooks support `setup`, `teardown`, and per-file `format` callbacks so formatters such as Oxfmt run after Stillwind utility sorting in one pass, including `--check`. `stillwind info` now also lists configured hook names.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies:
|
|
20
|
+
- @stillwind/native@0.12.0
|
|
21
|
+
- @stillwind/projection@0.12.0
|
|
22
|
+
|
|
3
23
|
## 0.11.0
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AnalysisProjectConfig, i as documentConfiguration, t as InlineConfig } from "./resolution-
|
|
1
|
+
import { a as AnalysisProjectConfig, i as documentConfiguration, t as InlineConfig } from "./resolution-C7hbL5Nx.js";
|
|
2
2
|
/**
|
|
3
3
|
* Reports the configuration file that failed to load, keeping the message of the original failure.
|
|
4
4
|
*/
|
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as expandProjects, c as selectProject, i as documentConfiguration, l as validateInlineConfig, n as configurationCandidates, o as resolveCompilerSettings, p as resolveConfig, s as resolveProjectPaths, t as compilerConfig } from "./resolution-
|
|
1
|
+
import { a as expandProjects, c as selectProject, i as documentConfiguration, l as validateInlineConfig, n as configurationCandidates, o as resolveCompilerSettings, p as resolveConfig, s as resolveProjectPaths, t as compilerConfig } from "./resolution-BPkEjdAJ.js";
|
|
2
2
|
import { minimatch } from "minimatch";
|
|
3
3
|
import * as paths from "pathe";
|
|
4
4
|
import { dirname, relative, resolve } from "pathe";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as RestrictedUtilitiesOptions, A as normalizeCompilerConfig, B as DefinitionScope, C as defineHook, D as NormalizedCompilerConfig, E as BuildOptions, F as StillwindPlugin, G as LintRules, H as LengthUnitsOptions, I as definePlugin, J as LogicalPropertiesOptions, K as LintScope, L as ArbitrarySpacingOptions, M as PluginContext, N as PluginDirectoryEntry, O as TailwindConfig, P as PluginWatchKind, Q as RestrictedThemeTokensOptions, R as CanonicalUtilitiesOptions, S as HookMode, T as BuildConfig, U as LintConfig, V as ImportantOptions, W as LintPreset, X as ResolvedLintRules, Y as MarkerUseOptions, Z as RestrictedDeclarationsOptions, _ as validateConfig, a as AnalysisProjectConfig, at as lintRules, b as HookCommand, c as ProjectionProvider, d as StillwindConfig, et as VariantDirectiveOptions, f as StillwindConfigExport, g as resolveConfig, h as defineConfig, it as LintRule, j as validateCompilerConfig, k as UtilitySortOptions, l as SourceProvider, m as captureProjectConfig, n as SerializableInlineConfig, nt as resolveLintConfig, o as CapturedProjectConfig, p as StillwindConfigFactory, q as LintSeverity, r as configurationFiles, rt as LintCategory, s as PreviewOptions, t as InlineConfig, tt as mergeLintConfig, u as SourceProviderContext, v as AnalysisHook, w as BaseConfig, x as HookContext, y as FormatHookFile, z as ConflictingUtilitiesOptions } from "./resolution-C7hbL5Nx.js";
|
|
2
2
|
/**
|
|
3
3
|
* Built-in lint policies for ordered preset composition. Treat their shared objects as readonly.
|
|
4
4
|
* Recommended supplies the omitted-lint default. Strict denies every recommended rule and adds
|
|
@@ -12,13 +12,14 @@ export declare const lintPresets: {
|
|
|
12
12
|
readonly "invalid-lint-suppression": "warn";
|
|
13
13
|
readonly "duplicate-utility": "warn";
|
|
14
14
|
readonly "conflicting-utilities": "warn";
|
|
15
|
+
readonly "partial-utility-override": "warn";
|
|
15
16
|
readonly "mismatched-framework-import": "warn";
|
|
16
17
|
readonly "mutating-macro-argument": "deny";
|
|
17
18
|
readonly "suspending-macro-argument": "deny";
|
|
18
19
|
readonly "invalid-rule-group-input": "deny";
|
|
19
20
|
readonly "invalid-style-input": "deny";
|
|
20
|
-
readonly "invalid-
|
|
21
|
-
readonly "invalid-
|
|
21
|
+
readonly "invalid-recipe-config": "deny";
|
|
22
|
+
readonly "invalid-recipe-input": "deny";
|
|
22
23
|
readonly "invalid-keyframes-use": "deny";
|
|
23
24
|
readonly "invalid-keyframes-definition": "deny";
|
|
24
25
|
readonly "invalid-keyframes-variant": "deny";
|
|
@@ -38,12 +39,15 @@ export declare const lintPresets: {
|
|
|
38
39
|
readonly "conflicting-provider-properties": "warn";
|
|
39
40
|
readonly "document-scoped-selector": "deny";
|
|
40
41
|
readonly "repeated-nesting-selector": "warn";
|
|
42
|
+
readonly "utility-class-selector": "warn";
|
|
41
43
|
readonly "unmatched-host-selector": "warn";
|
|
42
44
|
readonly "missing-view-transition-name": "warn";
|
|
43
45
|
readonly "duplicate-view-transition-name": "warn";
|
|
44
46
|
readonly "split-view-transition-class": "warn";
|
|
45
47
|
readonly "ambiguous-style-base-order": "warn";
|
|
46
48
|
readonly "interfering-imported-style-base": "warn";
|
|
49
|
+
readonly "cyclic-style-order": "warn";
|
|
50
|
+
readonly "multiple-style-forwards": "warn";
|
|
47
51
|
readonly "incompatible-property-value": "deny";
|
|
48
52
|
readonly "invalid-utility": "deny";
|
|
49
53
|
readonly "unknown-utility": "deny";
|
|
@@ -75,13 +79,14 @@ export declare const lintPresets: {
|
|
|
75
79
|
readonly "invalid-lint-suppression": "warn";
|
|
76
80
|
readonly "duplicate-utility": "warn";
|
|
77
81
|
readonly "conflicting-utilities": "warn";
|
|
82
|
+
readonly "partial-utility-override": "warn";
|
|
78
83
|
readonly "mismatched-framework-import": "warn";
|
|
79
84
|
readonly "mutating-macro-argument": "deny";
|
|
80
85
|
readonly "suspending-macro-argument": "deny";
|
|
81
86
|
readonly "invalid-rule-group-input": "deny";
|
|
82
87
|
readonly "invalid-style-input": "deny";
|
|
83
|
-
readonly "invalid-
|
|
84
|
-
readonly "invalid-
|
|
88
|
+
readonly "invalid-recipe-config": "deny";
|
|
89
|
+
readonly "invalid-recipe-input": "deny";
|
|
85
90
|
readonly "invalid-keyframes-use": "deny";
|
|
86
91
|
readonly "invalid-keyframes-definition": "deny";
|
|
87
92
|
readonly "invalid-keyframes-variant": "deny";
|
|
@@ -101,12 +106,15 @@ export declare const lintPresets: {
|
|
|
101
106
|
readonly "conflicting-provider-properties": "warn";
|
|
102
107
|
readonly "document-scoped-selector": "deny";
|
|
103
108
|
readonly "repeated-nesting-selector": "warn";
|
|
109
|
+
readonly "utility-class-selector": "warn";
|
|
104
110
|
readonly "unmatched-host-selector": "warn";
|
|
105
111
|
readonly "missing-view-transition-name": "warn";
|
|
106
112
|
readonly "duplicate-view-transition-name": "warn";
|
|
107
113
|
readonly "split-view-transition-class": "warn";
|
|
108
114
|
readonly "ambiguous-style-base-order": "warn";
|
|
109
115
|
readonly "interfering-imported-style-base": "warn";
|
|
116
|
+
readonly "cyclic-style-order": "warn";
|
|
117
|
+
readonly "multiple-style-forwards": "warn";
|
|
110
118
|
readonly "incompatible-property-value": "deny";
|
|
111
119
|
readonly "invalid-utility": "deny";
|
|
112
120
|
readonly "unknown-utility": "deny";
|
|
@@ -134,13 +142,14 @@ export declare const lintPresets: {
|
|
|
134
142
|
readonly "invalid-lint-suppression": "deny";
|
|
135
143
|
readonly "duplicate-utility": "deny";
|
|
136
144
|
readonly "conflicting-utilities": "deny";
|
|
145
|
+
readonly "partial-utility-override": "deny";
|
|
137
146
|
readonly "mismatched-framework-import": "deny";
|
|
138
147
|
readonly "mutating-macro-argument": "deny";
|
|
139
148
|
readonly "suspending-macro-argument": "deny";
|
|
140
149
|
readonly "invalid-rule-group-input": "deny";
|
|
141
150
|
readonly "invalid-style-input": "deny";
|
|
142
|
-
readonly "invalid-
|
|
143
|
-
readonly "invalid-
|
|
151
|
+
readonly "invalid-recipe-config": "deny";
|
|
152
|
+
readonly "invalid-recipe-input": "deny";
|
|
144
153
|
readonly "invalid-keyframes-use": "deny";
|
|
145
154
|
readonly "invalid-keyframes-definition": "deny";
|
|
146
155
|
readonly "invalid-keyframes-variant": "deny";
|
|
@@ -160,12 +169,15 @@ export declare const lintPresets: {
|
|
|
160
169
|
readonly "conflicting-provider-properties": "deny";
|
|
161
170
|
readonly "document-scoped-selector": "deny";
|
|
162
171
|
readonly "repeated-nesting-selector": "deny";
|
|
172
|
+
readonly "utility-class-selector": "deny";
|
|
163
173
|
readonly "unmatched-host-selector": "deny";
|
|
164
174
|
readonly "missing-view-transition-name": "deny";
|
|
165
175
|
readonly "duplicate-view-transition-name": "deny";
|
|
166
176
|
readonly "split-view-transition-class": "deny";
|
|
167
177
|
readonly "ambiguous-style-base-order": "deny";
|
|
168
178
|
readonly "interfering-imported-style-base": "deny";
|
|
179
|
+
readonly "cyclic-style-order": "deny";
|
|
180
|
+
readonly "multiple-style-forwards": "deny";
|
|
169
181
|
readonly "incompatible-property-value": "deny";
|
|
170
182
|
readonly "invalid-utility": "deny";
|
|
171
183
|
readonly "unknown-utility": "deny";
|
|
@@ -214,5 +226,5 @@ export declare const lintPresets: {
|
|
|
214
226
|
* @returns Merged settings. Unchanged values and replacement arrays can share input references.
|
|
215
227
|
*/
|
|
216
228
|
export declare function mergeConfig<T extends object>(base: T, overrides: Partial<T>): T;
|
|
217
|
-
export { type AnalysisProjectConfig, type ArbitrarySpacingOptions, type BaseConfig, type BuildConfig, type BuildOptions, type CanonicalUtilitiesOptions, type CapturedProjectConfig, type ConflictingUtilitiesOptions, type DefinitionScope, type ImportantOptions, type InlineConfig, type LengthUnitsOptions, type LintCategory, type LintConfig, type LintPreset, type LintRule, type LintRules, type LintScope, type LintSeverity, type LogicalPropertiesOptions, type MarkerUseOptions, type NormalizedCompilerConfig, type PluginContext, type PluginDirectoryEntry, type PluginWatchKind, type PreviewOptions, type ProjectionProvider, type ResolvedLintRules, type RestrictedDeclarationsOptions, type RestrictedThemeTokensOptions, type RestrictedUtilitiesOptions, type SerializableInlineConfig, type SourceProvider, type SourceProviderContext, type StillwindConfig, type StillwindConfigExport, type StillwindConfigFactory, type StillwindPlugin, type TailwindConfig, type UtilitySortOptions, type VariantDirectiveOptions, captureProjectConfig, configurationFiles, defineConfig, definePlugin, lintRules, mergeLintConfig, normalizeCompilerConfig, resolveConfig, resolveLintConfig, validateCompilerConfig, validateConfig };
|
|
229
|
+
export { type AnalysisHook, type AnalysisProjectConfig, type ArbitrarySpacingOptions, type BaseConfig, type BuildConfig, type BuildOptions, type CanonicalUtilitiesOptions, type CapturedProjectConfig, type ConflictingUtilitiesOptions, type DefinitionScope, type FormatHookFile, type HookCommand, type HookContext, type HookMode, type ImportantOptions, type InlineConfig, type LengthUnitsOptions, type LintCategory, type LintConfig, type LintPreset, type LintRule, type LintRules, type LintScope, type LintSeverity, type LogicalPropertiesOptions, type MarkerUseOptions, type NormalizedCompilerConfig, type PluginContext, type PluginDirectoryEntry, type PluginWatchKind, type PreviewOptions, type ProjectionProvider, type ResolvedLintRules, type RestrictedDeclarationsOptions, type RestrictedThemeTokensOptions, type RestrictedUtilitiesOptions, type SerializableInlineConfig, type SourceProvider, type SourceProviderContext, type StillwindConfig, type StillwindConfigExport, type StillwindConfigFactory, type StillwindPlugin, type TailwindConfig, type UtilitySortOptions, type VariantDirectiveOptions, captureProjectConfig, configurationFiles, defineConfig, defineHook, definePlugin, lintRules, mergeLintConfig, normalizeCompilerConfig, resolveConfig, resolveLintConfig, validateCompilerConfig, validateConfig };
|
|
218
230
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { _ as mergeLintConfig, b as lintPresets, d as captureProjectConfig, f as defineConfig, g as validateCompilerConfig, h as normalizeCompilerConfig, m as validateConfig, p as resolveConfig, r as configurationFiles, u as mergeConfig, v as resolveLintConfig, y as lintRules } from "./resolution-
|
|
1
|
+
import { _ as mergeLintConfig, b as lintPresets, d as captureProjectConfig, f as defineConfig, g as validateCompilerConfig, h as normalizeCompilerConfig, m as validateConfig, p as resolveConfig, r as configurationFiles, u as mergeConfig, v as resolveLintConfig, y as lintRules } from "./resolution-BPkEjdAJ.js";
|
|
2
|
+
// src/hooks.ts
|
|
3
|
+
/**
|
|
4
|
+
* Returns `hook` unchanged with its type checked, for use in a configuration file.
|
|
5
|
+
*
|
|
6
|
+
* @param hook - Analysis hook definition.
|
|
7
|
+
* @returns The same object.
|
|
8
|
+
*/
|
|
9
|
+
function defineHook(hook) {
|
|
10
|
+
return hook;
|
|
11
|
+
}
|
|
2
12
|
// src/plugins.ts
|
|
3
13
|
/**
|
|
4
14
|
* Returns `plugin` unchanged with its type checked, for use in a configuration file.
|
|
@@ -9,6 +19,6 @@ import { _ as mergeLintConfig, b as lintPresets, d as captureProjectConfig, f as
|
|
|
9
19
|
function definePlugin(plugin) {
|
|
10
20
|
return plugin;
|
|
11
21
|
}
|
|
12
|
-
export { captureProjectConfig, configurationFiles, defineConfig, definePlugin, lintPresets, lintRules, mergeConfig, mergeLintConfig, normalizeCompilerConfig, resolveConfig, resolveLintConfig, validateCompilerConfig, validateConfig };
|
|
22
|
+
export { captureProjectConfig, configurationFiles, defineConfig, defineHook, definePlugin, lintPresets, lintRules, mergeConfig, mergeLintConfig, normalizeCompilerConfig, resolveConfig, resolveLintConfig, validateCompilerConfig, validateConfig };
|
|
13
23
|
|
|
14
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/plugins.ts"],"sourcesContent":["/**\n * A Stillwind plugin: JavaScript that generates Stillwind CSS for a design system.\n *\n * A stylesheet loads a plugin with `@plugin \"<name>\";` or `@plugin \"<name>\" { option: value; }`.\n * The CSS that {@link StillwindPlugin.css} returns replaces the statement, so it can contain\n * `@utility`, `@custom-variant`, `@theme`, and the other Stillwind directives.\n *\n * A `@stillwind-banner` block contains one `/*!` comment, such as a license notice, that the\n * output keeps. A block inside `@theme` or `@utility` adds its notice only when the output uses a\n * value of that `@theme` block or CSS of that utility. A block outside\n * definitions adds its notice to every nonempty output.\n *\n * A plugin can also define utilities on demand. Its CSS declares a family with\n * `@stillwind-dynamic <prefix>*;` for named candidates such as `icon-mdi--close`, with\n * `@stillwind-dynamic <prefix>[*];` for bracket candidates such as `icon-[mdi--close]`, or with\n * both. The host then passes the candidates of that family that modules use, and that are not\n * defined yet, to {@link StillwindPlugin.resolve}. The returned CSS joins the plugin's CSS, and\n * the host compiles the modules again.\n */\nexport interface StillwindPlugin {\n /**\n * Name that `@plugin` uses to select this plugin, such as `\"@stillwind/plugin-iconify\"`.\n * A project's `plugins` entry takes precedence over a package of the same name.\n */\n readonly name: string;\n /**\n * Returns the CSS that replaces the `@plugin` statement.\n *\n * @param context - Options of the statement and host operations.\n * @returns Stillwind CSS. It must not contain `@import` or `@plugin`.\n */\n css(context: PluginContext): string | Promise<string>;\n /**\n * Defines candidates of the dynamic families that the plugin's CSS declares.\n *\n * @param candidates - Utility names without variants, modifiers, or `!`, such as\n * `icon-mdi--close`. When the family accepts both forms, a bracket spelling such as\n * `icon-[mdi--close]` arrives in its named form. When the family accepts only the bracket form,\n * the bracket spelling arrives as written, and the plugin defines it under that name, such as\n * `@utility icon-[mdi--close]`.\n * @param context - Options of the statement and host operations.\n * @returns Stillwind CSS that defines some or all of the candidates. A candidate that it leaves\n * undefined is not passed again while the design system is loaded.\n */\n resolve?(candidates: readonly string[], context: PluginContext): string | Promise<string>;\n /**\n * Lists the candidates that editors complete for the plugin's dynamic families.\n *\n * The host calls it once with an empty `input` for the candidates that editors always offer,\n * and again with the text of an editor input. A plugin can therefore list a large family only\n * after the input narrows it.\n *\n * @param context - Options of the statement and host operations.\n * @param input - Utility text before the editor's cursor, without variants, such as\n * `icon-mdi--cl`, or an empty string.\n * @returns Utility names in the form that {@link StillwindPlugin.resolve} accepts. The host\n * keeps only names that start with `input`. A name that ends with `-` is incomplete, such as\n * `icon-mdi--`. Editors insert it and request completion again.\n */\n catalog?(context: PluginContext, input: string): readonly string[] | Promise<readonly string[]>;\n}\n\n/** Inputs of one loaded `@plugin` statement. */\nexport interface PluginContext {\n /**\n * Declarations of the statement's options block, keyed by name. A later declaration of a name\n * replaces an earlier one. Values are the trimmed declaration text without the semicolon. Each\n * run of whitespace and comments between top-level tokens becomes one space, and strings keep\n * their quotes. A statement without a block has no options.\n */\n readonly options: Readonly<Record<string, string>>;\n /** Absolute project directory. */\n readonly root: string;\n /**\n * Registers a file or directory that the plugin reads, so that a change reloads the design\n * system. A file reloads it when its content changes. A directory reloads it when an entry is\n * added, removed, or renamed. A change to an entry's content does not reload it unless the\n * plugin also watches that entry. A host that does not reload the design system ignores both\n * kinds.\n *\n * @param path - Absolute file or directory path.\n * @param kind - Whether `path` names a file or a directory. Defaults to `\"file\"`.\n */\n watch(path: string, kind?: PluginWatchKind): void;\n /**\n * Resolves a module request from the stylesheet that contains the statement, with the host's\n * module resolution. A plugin uses it instead of Node APIs, so that it also runs in browser hosts.\n *\n * @param specifier - Package specifier with an optional subpath, such as\n * `@iconify-json/mdi/icons.json`, or a relative or absolute path.\n * @returns The absolute path of the file, or undefined when the request does not resolve.\n */\n resolve(specifier: string): Promise<string | undefined>;\n /**\n * Reads a text file through the host.\n *\n * @param path - Absolute file path, such as a result of {@link PluginContext.resolve}.\n * @returns The file's text.\n * @throws If the file does not exist or cannot be read.\n */\n read(path: string): Promise<string>;\n /**\n * Lists the entries of a directory through the host. Listing does not watch the directory.\n *\n * @param path - Absolute directory path.\n * @returns The directory's own entries in no particular order, without the entries of its\n * subdirectories.\n * @throws If the directory does not exist or cannot be read, or the host cannot list directories.\n */\n list(path: string): Promise<readonly PluginDirectoryEntry[]>;\n}\n\n/** Kind of path that {@link PluginContext.watch} registers. */\nexport type PluginWatchKind = \"file\" | \"directory\";\n\n/** One entry of a directory that {@link PluginContext.list} returns. */\nexport interface PluginDirectoryEntry {\n /** Entry name without the directory path. */\n name: string;\n /** Whether the entry is a directory or a symbolic link to a directory. */\n directory: boolean;\n}\n\n/**\n * Returns `plugin` unchanged with its type checked, for use in a configuration file.\n *\n * @param plugin - Plugin definition.\n * @returns The same object.\n */\nexport function definePlugin(plugin: StillwindPlugin): StillwindPlugin {\n return plugin;\n}\n"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/hooks.ts","../src/plugins.ts"],"sourcesContent":["/**\n * In-memory formatting hooks for CLI `fmt` and `check` commands.\n */\n\n/** Command that invokes a project hook. */\nexport type HookCommand = \"fmt\" | \"check\";\n\n/** Whether the invoking command writes changed files or only checks them. */\nexport type HookMode = \"write\" | \"check\";\n\n/** Execution context shared across a hook's lifecycle and callbacks. */\nexport interface HookContext {\n /** Normalized absolute project root directory. */\n readonly root: string;\n /** Optional configured project name. */\n readonly project?: string;\n /** CLI command that started this run. */\n readonly command: HookCommand;\n /** `\"write\"` saves modified buffers; `\"check\"` compares buffers without saving. */\n readonly mode: HookMode;\n /** Signal aborted if the caller cancels the run. */\n readonly signal: AbortSignal;\n}\n\n/** One target buffer passed to {@link AnalysisHook.format}. */\nexport interface FormatHookFile {\n /** Absolute path of the target file. */\n readonly path: string;\n /** Current text after Stillwind sorting or fixing and any earlier format hooks. */\n readonly code: string;\n /** Original text read from disk before Stillwind and hooks ran. */\n readonly original: string;\n /** Whether Stillwind or an earlier hook has already changed this buffer from `original`. */\n readonly changed: boolean;\n}\n\n/**\n * Project-scoped hook that transforms rewritten buffers in memory during CLI `fmt` and `check`\n * runs.\n */\nexport interface AnalysisHook {\n /** Nonempty identifier shown in `stillwind info` and failure messages. */\n readonly name: string;\n /**\n * Initializes resources once per project before any `format` callbacks run.\n *\n * @param context - Project identity and command mode for this run.\n */\n setup?(context: HookContext): void | Promise<void>;\n /**\n * Releases resources after `format` callbacks finish. Runs only when `setup` succeeded.\n *\n * @param context - Project identity and command mode for this run.\n */\n teardown?(context: HookContext): void | Promise<void>;\n /**\n * Transforms one target buffer in memory during `fmt` and `check` commands.\n *\n * @param file - Current and original buffer text for one target.\n * @param context - Project identity and command mode for this run.\n * @returns Replacement text, or `undefined` to leave the buffer unchanged.\n */\n format?(file: FormatHookFile, context: HookContext): string | void | Promise<string | void>;\n}\n\n/**\n * Returns `hook` unchanged with its type checked, for use in a configuration file.\n *\n * @param hook - Analysis hook definition.\n * @returns The same object.\n */\nexport function defineHook(hook: AnalysisHook): AnalysisHook {\n return hook;\n}\n","/**\n * A Stillwind plugin: JavaScript that generates Stillwind CSS for a design system.\n *\n * A stylesheet loads a plugin with `@plugin \"<name>\";` or `@plugin \"<name>\" { option: value; }`.\n * The CSS that {@link StillwindPlugin.css} returns replaces the statement, so it can contain\n * `@utility`, `@custom-variant`, `@theme`, and the other Stillwind directives.\n *\n * A `@stillwind-banner` block contains one `/*!` comment, such as a license notice, that the\n * output keeps. A block inside `@theme` or `@utility` adds its notice only when the output uses a\n * value of that `@theme` block or CSS of that utility. A block outside\n * definitions adds its notice to every nonempty output.\n *\n * A plugin can also define utilities on demand. Its CSS declares a family with\n * `@stillwind-dynamic <prefix>*;` for named candidates such as `icon-mdi--close`, with\n * `@stillwind-dynamic <prefix>[*];` for bracket candidates such as `icon-[mdi--close]`, or with\n * both. The host then passes the candidates of that family that modules use, and that are not\n * defined yet, to {@link StillwindPlugin.resolve}. The returned CSS joins the plugin's CSS, and\n * the host compiles the modules again.\n */\nexport interface StillwindPlugin {\n /**\n * Name that `@plugin` uses to select this plugin, such as `\"@stillwind/plugin-iconify\"`.\n * A project's `plugins` entry takes precedence over a package of the same name.\n */\n readonly name: string;\n /**\n * Returns the CSS that replaces the `@plugin` statement.\n *\n * @param context - Options of the statement and host operations.\n * @returns Stillwind CSS. It must not contain `@import` or `@plugin`.\n */\n css(context: PluginContext): string | Promise<string>;\n /**\n * Defines candidates of the dynamic families that the plugin's CSS declares.\n *\n * @param candidates - Utility names without variants, modifiers, or `!`, such as\n * `icon-mdi--close`. When the family accepts both forms, a bracket spelling such as\n * `icon-[mdi--close]` arrives in its named form. When the family accepts only the bracket form,\n * the bracket spelling arrives as written, and the plugin defines it under that name, such as\n * `@utility icon-[mdi--close]`.\n * @param context - Options of the statement and host operations.\n * @returns Stillwind CSS that defines some or all of the candidates. A candidate that it leaves\n * undefined is not passed again while the design system is loaded.\n */\n resolve?(candidates: readonly string[], context: PluginContext): string | Promise<string>;\n /**\n * Lists the candidates that editors complete for the plugin's dynamic families.\n *\n * The host calls it once with an empty `input` for the candidates that editors always offer,\n * and again with the text of an editor input. A plugin can therefore list a large family only\n * after the input narrows it.\n *\n * @param context - Options of the statement and host operations.\n * @param input - Utility text before the editor's cursor, without variants, such as\n * `icon-mdi--cl`, or an empty string.\n * @returns Utility names in the form that {@link StillwindPlugin.resolve} accepts. The host\n * keeps only names that start with `input`. A name that ends with `-` is incomplete, such as\n * `icon-mdi--`. Editors insert it and request completion again.\n */\n catalog?(context: PluginContext, input: string): readonly string[] | Promise<readonly string[]>;\n}\n\n/** Inputs of one loaded `@plugin` statement. */\nexport interface PluginContext {\n /**\n * Declarations of the statement's options block, keyed by name. A later declaration of a name\n * replaces an earlier one. Values are the trimmed declaration text without the semicolon. Each\n * run of whitespace and comments between top-level tokens becomes one space, and strings keep\n * their quotes. A statement without a block has no options.\n */\n readonly options: Readonly<Record<string, string>>;\n /** Absolute project directory. */\n readonly root: string;\n /**\n * Registers a file or directory that the plugin reads, so that a change reloads the design\n * system. A file reloads it when its content changes. A directory reloads it when an entry is\n * added, removed, or renamed. A change to an entry's content does not reload it unless the\n * plugin also watches that entry. A host that does not reload the design system ignores both\n * kinds.\n *\n * @param path - Absolute file or directory path.\n * @param kind - Whether `path` names a file or a directory. Defaults to `\"file\"`.\n */\n watch(path: string, kind?: PluginWatchKind): void;\n /**\n * Resolves a module request from the stylesheet that contains the statement, with the host's\n * module resolution. A plugin uses it instead of Node APIs, so that it also runs in browser hosts.\n *\n * @param specifier - Package specifier with an optional subpath, such as\n * `@iconify-json/mdi/icons.json`, or a relative or absolute path.\n * @returns The absolute path of the file, or undefined when the request does not resolve.\n */\n resolve(specifier: string): Promise<string | undefined>;\n /**\n * Reads a text file through the host.\n *\n * @param path - Absolute file path, such as a result of {@link PluginContext.resolve}.\n * @returns The file's text.\n * @throws If the file does not exist or cannot be read.\n */\n read(path: string): Promise<string>;\n /**\n * Lists the entries of a directory through the host. Listing does not watch the directory.\n *\n * @param path - Absolute directory path.\n * @returns The directory's own entries in no particular order, without the entries of its\n * subdirectories.\n * @throws If the directory does not exist or cannot be read, or the host cannot list directories.\n */\n list(path: string): Promise<readonly PluginDirectoryEntry[]>;\n}\n\n/** Kind of path that {@link PluginContext.watch} registers. */\nexport type PluginWatchKind = \"file\" | \"directory\";\n\n/** One entry of a directory that {@link PluginContext.list} returns. */\nexport interface PluginDirectoryEntry {\n /** Entry name without the directory path. */\n name: string;\n /** Whether the entry is a directory or a symbolic link to a directory. */\n directory: boolean;\n}\n\n/**\n * Returns `plugin` unchanged with its type checked, for use in a configuration file.\n *\n * @param plugin - Plugin definition.\n * @returns The same object.\n */\nexport function definePlugin(plugin: StillwindPlugin): StillwindPlugin {\n return plugin;\n}\n"],"mappings":";;;;;;;;AAuEA,SAAgB,WAAW,MAAkC;CAC3D,OAAO;AACT;;;;;;;;ACwDA,SAAgB,aAAa,QAA0C;CACrE,OAAO;AACT"}
|
package/dist/node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AnalysisProjectConfig, t as InlineConfig,
|
|
1
|
+
import { D as NormalizedCompilerConfig, a as AnalysisProjectConfig, t as InlineConfig, w as BaseConfig } from "./resolution-C7hbL5Nx.js";
|
|
2
2
|
/**
|
|
3
3
|
* Evaluated settings and files that consumers must watch when retaining a compiler session.
|
|
4
4
|
*/
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as expandProjects, c as selectProject, i as documentConfiguration, l as validateInlineConfig, n as configurationCandidates$1, o as resolveCompilerSettings, p as resolveConfig, s as resolveProjectPaths, t as compilerConfig } from "./resolution-
|
|
1
|
+
import { a as expandProjects, c as selectProject, i as documentConfiguration, l as validateInlineConfig, n as configurationCandidates$1, o as resolveCompilerSettings, p as resolveConfig, s as resolveProjectPaths, t as compilerConfig } from "./resolution-BPkEjdAJ.js";
|
|
2
2
|
import { isBuiltin } from "node:module";
|
|
3
3
|
import { existsSync, statSync } from "node:fs";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
@@ -7,13 +7,14 @@ const recommended = {
|
|
|
7
7
|
"invalid-lint-suppression": "warn",
|
|
8
8
|
"duplicate-utility": "warn",
|
|
9
9
|
"conflicting-utilities": "warn",
|
|
10
|
+
"partial-utility-override": "warn",
|
|
10
11
|
"mismatched-framework-import": "warn",
|
|
11
12
|
"mutating-macro-argument": "deny",
|
|
12
13
|
"suspending-macro-argument": "deny",
|
|
13
14
|
"invalid-rule-group-input": "deny",
|
|
14
15
|
"invalid-style-input": "deny",
|
|
15
|
-
"invalid-
|
|
16
|
-
"invalid-
|
|
16
|
+
"invalid-recipe-config": "deny",
|
|
17
|
+
"invalid-recipe-input": "deny",
|
|
17
18
|
"invalid-keyframes-use": "deny",
|
|
18
19
|
"invalid-keyframes-definition": "deny",
|
|
19
20
|
"invalid-keyframes-variant": "deny",
|
|
@@ -33,12 +34,15 @@ const recommended = {
|
|
|
33
34
|
"conflicting-provider-properties": "warn",
|
|
34
35
|
"document-scoped-selector": "deny",
|
|
35
36
|
"repeated-nesting-selector": "warn",
|
|
37
|
+
"utility-class-selector": "warn",
|
|
36
38
|
"unmatched-host-selector": "warn",
|
|
37
39
|
"missing-view-transition-name": "warn",
|
|
38
40
|
"duplicate-view-transition-name": "warn",
|
|
39
41
|
"split-view-transition-class": "warn",
|
|
40
42
|
"ambiguous-style-base-order": "warn",
|
|
41
43
|
"interfering-imported-style-base": "warn",
|
|
44
|
+
"cyclic-style-order": "warn",
|
|
45
|
+
"multiple-style-forwards": "warn",
|
|
42
46
|
"incompatible-property-value": "deny",
|
|
43
47
|
"invalid-utility": "deny",
|
|
44
48
|
"unknown-utility": "deny",
|
|
@@ -77,13 +81,14 @@ const lintPresets = {
|
|
|
77
81
|
"invalid-lint-suppression": "deny",
|
|
78
82
|
"duplicate-utility": "deny",
|
|
79
83
|
"conflicting-utilities": "deny",
|
|
84
|
+
"partial-utility-override": "deny",
|
|
80
85
|
"mismatched-framework-import": "deny",
|
|
81
86
|
"mutating-macro-argument": "deny",
|
|
82
87
|
"suspending-macro-argument": "deny",
|
|
83
88
|
"invalid-rule-group-input": "deny",
|
|
84
89
|
"invalid-style-input": "deny",
|
|
85
|
-
"invalid-
|
|
86
|
-
"invalid-
|
|
90
|
+
"invalid-recipe-config": "deny",
|
|
91
|
+
"invalid-recipe-input": "deny",
|
|
87
92
|
"invalid-keyframes-use": "deny",
|
|
88
93
|
"invalid-keyframes-definition": "deny",
|
|
89
94
|
"invalid-keyframes-variant": "deny",
|
|
@@ -103,12 +108,15 @@ const lintPresets = {
|
|
|
103
108
|
"conflicting-provider-properties": "deny",
|
|
104
109
|
"document-scoped-selector": "deny",
|
|
105
110
|
"repeated-nesting-selector": "deny",
|
|
111
|
+
"utility-class-selector": "deny",
|
|
106
112
|
"unmatched-host-selector": "deny",
|
|
107
113
|
"missing-view-transition-name": "deny",
|
|
108
114
|
"duplicate-view-transition-name": "deny",
|
|
109
115
|
"split-view-transition-class": "deny",
|
|
110
116
|
"ambiguous-style-base-order": "deny",
|
|
111
117
|
"interfering-imported-style-base": "deny",
|
|
118
|
+
"cyclic-style-order": "deny",
|
|
119
|
+
"multiple-style-forwards": "deny",
|
|
112
120
|
"incompatible-property-value": "deny",
|
|
113
121
|
"invalid-utility": "deny",
|
|
114
122
|
"unknown-utility": "deny",
|
|
@@ -171,15 +179,15 @@ const lintRules = {
|
|
|
171
179
|
defaults: null,
|
|
172
180
|
options: null
|
|
173
181
|
},
|
|
174
|
-
"invalid-
|
|
182
|
+
"invalid-recipe-config": {
|
|
175
183
|
category: "input",
|
|
176
|
-
nativeName: "
|
|
184
|
+
nativeName: "invalidRecipeConfig",
|
|
177
185
|
defaults: null,
|
|
178
186
|
options: null
|
|
179
187
|
},
|
|
180
|
-
"invalid-
|
|
188
|
+
"invalid-recipe-input": {
|
|
181
189
|
category: "input",
|
|
182
|
-
nativeName: "
|
|
190
|
+
nativeName: "invalidRecipeInput",
|
|
183
191
|
defaults: null,
|
|
184
192
|
options: null
|
|
185
193
|
},
|
|
@@ -364,6 +372,12 @@ const lintRules = {
|
|
|
364
372
|
"ignoredUtilities"
|
|
365
373
|
]
|
|
366
374
|
},
|
|
375
|
+
"partial-utility-override": {
|
|
376
|
+
category: "hazard",
|
|
377
|
+
nativeName: "partialUtilityOverride",
|
|
378
|
+
defaults: null,
|
|
379
|
+
options: null
|
|
380
|
+
},
|
|
367
381
|
"conflicting-provider-properties": {
|
|
368
382
|
category: "hazard",
|
|
369
383
|
nativeName: "conflictingProviderProperties",
|
|
@@ -388,6 +402,18 @@ const lintRules = {
|
|
|
388
402
|
defaults: null,
|
|
389
403
|
options: null
|
|
390
404
|
},
|
|
405
|
+
"cyclic-style-order": {
|
|
406
|
+
category: "hazard",
|
|
407
|
+
nativeName: "cyclicStyleOrder",
|
|
408
|
+
defaults: null,
|
|
409
|
+
options: null
|
|
410
|
+
},
|
|
411
|
+
"multiple-style-forwards": {
|
|
412
|
+
category: "hazard",
|
|
413
|
+
nativeName: "multipleStyleForwards",
|
|
414
|
+
defaults: null,
|
|
415
|
+
options: null
|
|
416
|
+
},
|
|
391
417
|
"missing-ref-attachment": {
|
|
392
418
|
category: "hazard",
|
|
393
419
|
nativeName: "missingRefAttachment",
|
|
@@ -406,6 +432,12 @@ const lintRules = {
|
|
|
406
432
|
defaults: null,
|
|
407
433
|
options: null
|
|
408
434
|
},
|
|
435
|
+
"utility-class-selector": {
|
|
436
|
+
category: "hazard",
|
|
437
|
+
nativeName: "utilityClassSelector",
|
|
438
|
+
defaults: null,
|
|
439
|
+
options: null
|
|
440
|
+
},
|
|
409
441
|
"unmatched-host-selector": {
|
|
410
442
|
category: "hazard",
|
|
411
443
|
nativeName: "unmatchedHostSelector",
|
|
@@ -1111,7 +1143,7 @@ const capturedProjects = /* @__PURE__ */ new WeakSet();
|
|
|
1111
1143
|
*/
|
|
1112
1144
|
function captureProjectConfig(config) {
|
|
1113
1145
|
if (capturedProjects.has(config)) return config;
|
|
1114
|
-
const { naming, sources, projection, plugins, tailwind, ...settings } = config;
|
|
1146
|
+
const { naming, sources, projection, plugins, hooks, tailwind, ...settings } = config;
|
|
1115
1147
|
const data = structuredClone(settings);
|
|
1116
1148
|
const capturedSources = sources?.kind === "custom" ? {
|
|
1117
1149
|
kind: sources.kind,
|
|
@@ -1126,6 +1158,7 @@ function captureProjectConfig(config) {
|
|
|
1126
1158
|
const captured = {
|
|
1127
1159
|
...data,
|
|
1128
1160
|
...plugins ? { plugins: [...plugins] } : {},
|
|
1161
|
+
...hooks ? { hooks: [...hooks] } : {},
|
|
1129
1162
|
...tailwind ? { tailwind } : {},
|
|
1130
1163
|
...naming ? { naming: {
|
|
1131
1164
|
utilityClass: naming.utilityClass,
|
|
@@ -1179,6 +1212,12 @@ const projectSchema = strictObject({
|
|
|
1179
1212
|
pixelEquivalents: v.optional(v.boolean()),
|
|
1180
1213
|
colorEquivalents: v.optional(v.union([v.picklist(["approximate", "exact"]), v.literal(false)]))
|
|
1181
1214
|
})),
|
|
1215
|
+
hooks: v.optional(v.array(strictObject({
|
|
1216
|
+
name: nonemptyText,
|
|
1217
|
+
setup: v.optional(v.function()),
|
|
1218
|
+
teardown: v.optional(v.function()),
|
|
1219
|
+
format: v.optional(v.function())
|
|
1220
|
+
}))),
|
|
1182
1221
|
sources: v.optional(v.pipe(v.custom(object, "must be an object"), v.variant("kind", [v.strictObject({ kind: v.literal("filesystem") }), v.strictObject({
|
|
1183
1222
|
kind: v.literal("custom"),
|
|
1184
1223
|
supports: v.function(),
|
|
@@ -1238,7 +1277,7 @@ function validateConfig(value) {
|
|
|
1238
1277
|
validate(configurationSchema, value, "config");
|
|
1239
1278
|
for (const [index, project] of value.projects.entries()) {
|
|
1240
1279
|
if (typeof project === "string") continue;
|
|
1241
|
-
const { automatic: _automatic, name: _name, files: _files, exclude: _exclude, sources: _sources, projection: _projection, typeFacts: _typeFacts, ...compiler } = project;
|
|
1280
|
+
const { automatic: _automatic, name: _name, files: _files, exclude: _exclude, sources: _sources, projection: _projection, typeFacts: _typeFacts, hooks: _hooks, ...compiler } = project;
|
|
1242
1281
|
validateCompilerConfig(compiler, `projects[${index}]`);
|
|
1243
1282
|
}
|
|
1244
1283
|
return value;
|
|
@@ -1441,7 +1480,7 @@ function resolveProjectPaths(project, directory, paths) {
|
|
|
1441
1480
|
* and retained nested objects are unchanged.
|
|
1442
1481
|
*/
|
|
1443
1482
|
function compilerConfig(project) {
|
|
1444
|
-
const { name: _name, files: _files, exclude: _exclude, sources: _sources, projection: _projection, typeFacts: _typeFacts, ...config } = project;
|
|
1483
|
+
const { name: _name, files: _files, exclude: _exclude, sources: _sources, projection: _projection, typeFacts: _typeFacts, hooks: _hooks, ...config } = project;
|
|
1445
1484
|
return config;
|
|
1446
1485
|
}
|
|
1447
1486
|
const inlineSchema = strictObject({
|
|
@@ -1513,4 +1552,4 @@ function resolveCompilerSettings(base, inline, applicationRoot, paths) {
|
|
|
1513
1552
|
}
|
|
1514
1553
|
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 };
|
|
1515
1554
|
|
|
1516
|
-
//# sourceMappingURL=resolution-
|
|
1555
|
+
//# sourceMappingURL=resolution-BPkEjdAJ.js.map
|