@chikx/compiler 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +40 -2
- package/dist/emitter/index.d.ts +96 -0
- package/dist/emitter/index.d.ts.map +1 -0
- package/dist/emitter/index.js +415 -0
- package/dist/emitter/index.js.map +1 -0
- package/dist/formatter/index.d.ts +53 -0
- package/dist/formatter/index.d.ts.map +1 -0
- package/dist/formatter/index.js +464 -0
- package/dist/formatter/index.js.map +1 -0
- package/dist/host/node.d.ts +34 -0
- package/dist/host/node.d.ts.map +1 -0
- package/dist/host/node.js +80 -0
- package/dist/host/node.js.map +1 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +792 -0
- package/dist/index.js.map +1 -0
- package/dist/ir/factories.d.ts +35 -0
- package/dist/ir/factories.d.ts.map +1 -0
- package/dist/ir/factories.js +47 -0
- package/dist/ir/factories.js.map +1 -0
- package/dist/ir/index.d.ts +13 -0
- package/dist/ir/index.d.ts.map +1 -0
- package/dist/ir/index.js +2 -0
- package/dist/ir/index.js.map +1 -0
- package/dist/ir/types.d.ts +139 -0
- package/dist/ir/types.d.ts.map +1 -0
- package/dist/ir/types.js +2 -0
- package/dist/ir/types.js.map +1 -0
- package/dist/lexer/at-keywords.d.ts +27 -0
- package/dist/lexer/at-keywords.d.ts.map +1 -0
- package/dist/lexer/at-keywords.js +35 -0
- package/dist/lexer/at-keywords.js.map +1 -0
- package/dist/lexer/characters.d.ts +38 -0
- package/dist/lexer/characters.d.ts.map +1 -0
- package/dist/lexer/characters.js +74 -0
- package/dist/lexer/characters.js.map +1 -0
- package/dist/lexer/comments.d.ts +22 -0
- package/dist/lexer/comments.d.ts.map +1 -0
- package/dist/lexer/comments.js +20 -0
- package/dist/lexer/comments.js.map +1 -0
- package/dist/lexer/diagnostics.d.ts +24 -0
- package/dist/lexer/diagnostics.d.ts.map +1 -0
- package/dist/lexer/diagnostics.js +29 -0
- package/dist/lexer/diagnostics.js.map +1 -0
- package/dist/lexer/dollar-refs.d.ts +13 -0
- package/dist/lexer/dollar-refs.d.ts.map +1 -0
- package/dist/lexer/dollar-refs.js +22 -0
- package/dist/lexer/dollar-refs.js.map +1 -0
- package/dist/lexer/index.d.ts +32 -0
- package/dist/lexer/index.d.ts.map +1 -0
- package/dist/lexer/index.js +26 -0
- package/dist/lexer/index.js.map +1 -0
- package/dist/lexer/names.d.ts +23 -0
- package/dist/lexer/names.d.ts.map +1 -0
- package/dist/lexer/names.js +48 -0
- package/dist/lexer/names.js.map +1 -0
- package/dist/lexer/numbers.d.ts +22 -0
- package/dist/lexer/numbers.d.ts.map +1 -0
- package/dist/lexer/numbers.js +60 -0
- package/dist/lexer/numbers.js.map +1 -0
- package/dist/lexer/scanner.d.ts +30 -0
- package/dist/lexer/scanner.d.ts.map +1 -0
- package/dist/lexer/scanner.js +158 -0
- package/dist/lexer/scanner.js.map +1 -0
- package/dist/lexer/strings.d.ts +25 -0
- package/dist/lexer/strings.d.ts.map +1 -0
- package/dist/lexer/strings.js +41 -0
- package/dist/lexer/strings.js.map +1 -0
- package/dist/lexer/urls.d.ts +28 -0
- package/dist/lexer/urls.d.ts.map +1 -0
- package/dist/lexer/urls.js +54 -0
- package/dist/lexer/urls.js.map +1 -0
- package/dist/lowering/expand-groups.d.ts +61 -0
- package/dist/lowering/expand-groups.d.ts.map +1 -0
- package/dist/lowering/expand-groups.js +117 -0
- package/dist/lowering/expand-groups.js.map +1 -0
- package/dist/lowering/group.d.ts +30 -0
- package/dist/lowering/group.d.ts.map +1 -0
- package/dist/lowering/group.js +109 -0
- package/dist/lowering/group.js.map +1 -0
- package/dist/lowering/index.d.ts +26 -0
- package/dist/lowering/index.d.ts.map +1 -0
- package/dist/lowering/index.js +23 -0
- package/dist/lowering/index.js.map +1 -0
- package/dist/lowering/lower.d.ts +21 -0
- package/dist/lowering/lower.d.ts.map +1 -0
- package/dist/lowering/lower.js +296 -0
- package/dist/lowering/lower.js.map +1 -0
- package/dist/lowering/media.d.ts +63 -0
- package/dist/lowering/media.d.ts.map +1 -0
- package/dist/lowering/media.js +237 -0
- package/dist/lowering/media.js.map +1 -0
- package/dist/lowering/merge.d.ts +35 -0
- package/dist/lowering/merge.d.ts.map +1 -0
- package/dist/lowering/merge.js +146 -0
- package/dist/lowering/merge.js.map +1 -0
- package/dist/lowering/property-families.d.ts +50 -0
- package/dist/lowering/property-families.d.ts.map +1 -0
- package/dist/lowering/property-families.js +175 -0
- package/dist/lowering/property-families.js.map +1 -0
- package/dist/lowering/spans.d.ts +36 -0
- package/dist/lowering/spans.d.ts.map +1 -0
- package/dist/lowering/spans.js +100 -0
- package/dist/lowering/spans.js.map +1 -0
- package/dist/naming/index.d.ts +37 -0
- package/dist/naming/index.d.ts.map +1 -0
- package/dist/naming/index.js +34 -0
- package/dist/naming/index.js.map +1 -0
- package/dist/naming/mapgen.d.ts +70 -0
- package/dist/naming/mapgen.d.ts.map +1 -0
- package/dist/naming/mapgen.js +153 -0
- package/dist/naming/mapgen.js.map +1 -0
- package/dist/naming/merge.d.ts +62 -0
- package/dist/naming/merge.d.ts.map +1 -0
- package/dist/naming/merge.js +77 -0
- package/dist/naming/merge.js.map +1 -0
- package/dist/naming/rewrite.d.ts +14 -0
- package/dist/naming/rewrite.d.ts.map +1 -0
- package/dist/naming/rewrite.js +191 -0
- package/dist/naming/rewrite.js.map +1 -0
- package/dist/naming/scan.d.ts +80 -0
- package/dist/naming/scan.d.ts.map +1 -0
- package/dist/naming/scan.js +193 -0
- package/dist/naming/scan.js.map +1 -0
- package/dist/naming/table.d.ts +68 -0
- package/dist/naming/table.d.ts.map +1 -0
- package/dist/naming/table.js +132 -0
- package/dist/naming/table.js.map +1 -0
- package/dist/naming/types.d.ts +94 -0
- package/dist/naming/types.d.ts.map +1 -0
- package/dist/naming/types.js +2 -0
- package/dist/naming/types.js.map +1 -0
- package/dist/output/import-path.d.ts +24 -0
- package/dist/output/import-path.d.ts.map +1 -0
- package/dist/output/import-path.js +30 -0
- package/dist/output/import-path.js.map +1 -0
- package/dist/output/index.d.ts +40 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +138 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/manifest.d.ts +17 -0
- package/dist/output/manifest.d.ts.map +1 -0
- package/dist/output/manifest.js +22 -0
- package/dist/output/manifest.js.map +1 -0
- package/dist/output/paths.d.ts +54 -0
- package/dist/output/paths.d.ts.map +1 -0
- package/dist/output/paths.js +183 -0
- package/dist/output/paths.js.map +1 -0
- package/dist/output/resolve.d.ts +100 -0
- package/dist/output/resolve.d.ts.map +1 -0
- package/dist/output/resolve.js +313 -0
- package/dist/output/resolve.js.map +1 -0
- package/dist/output/validate.d.ts +82 -0
- package/dist/output/validate.d.ts.map +1 -0
- package/dist/output/validate.js +128 -0
- package/dist/output/validate.js.map +1 -0
- package/dist/parser/cursor.d.ts +55 -0
- package/dist/parser/cursor.d.ts.map +1 -0
- package/dist/parser/cursor.js +120 -0
- package/dist/parser/cursor.js.map +1 -0
- package/dist/parser/declaration.d.ts +21 -0
- package/dist/parser/declaration.d.ts.map +1 -0
- package/dist/parser/declaration.js +201 -0
- package/dist/parser/declaration.js.map +1 -0
- package/dist/parser/diagnostics.d.ts +52 -0
- package/dist/parser/diagnostics.d.ts.map +1 -0
- package/dist/parser/diagnostics.js +55 -0
- package/dist/parser/diagnostics.js.map +1 -0
- package/dist/parser/group.d.ts +26 -0
- package/dist/parser/group.d.ts.map +1 -0
- package/dist/parser/group.js +219 -0
- package/dist/parser/group.js.map +1 -0
- package/dist/parser/index.d.ts +30 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +48 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/modifier.d.ts +25 -0
- package/dist/parser/modifier.d.ts.map +1 -0
- package/dist/parser/modifier.js +41 -0
- package/dist/parser/modifier.js.map +1 -0
- package/dist/parser/recovery.d.ts +23 -0
- package/dist/parser/recovery.d.ts.map +1 -0
- package/dist/parser/recovery.js +80 -0
- package/dist/parser/recovery.js.map +1 -0
- package/dist/parser/rule.d.ts +39 -0
- package/dist/parser/rule.d.ts.map +1 -0
- package/dist/parser/rule.js +337 -0
- package/dist/parser/rule.js.map +1 -0
- package/dist/parser/statement.d.ts +21 -0
- package/dist/parser/statement.d.ts.map +1 -0
- package/dist/parser/statement.js +48 -0
- package/dist/parser/statement.js.map +1 -0
- package/dist/parser/statements.d.ts +33 -0
- package/dist/parser/statements.d.ts.map +1 -0
- package/dist/parser/statements.js +605 -0
- package/dist/parser/statements.js.map +1 -0
- package/dist/parser/value.d.ts +57 -0
- package/dist/parser/value.d.ts.map +1 -0
- package/dist/parser/value.js +226 -0
- package/dist/parser/value.js.map +1 -0
- package/dist/resolver/graph.d.ts +20 -0
- package/dist/resolver/graph.d.ts.map +1 -0
- package/dist/resolver/graph.js +382 -0
- package/dist/resolver/graph.js.map +1 -0
- package/dist/resolver/groups.d.ts +70 -0
- package/dist/resolver/groups.d.ts.map +1 -0
- package/dist/resolver/groups.js +143 -0
- package/dist/resolver/groups.js.map +1 -0
- package/dist/resolver/index.d.ts +46 -0
- package/dist/resolver/index.d.ts.map +1 -0
- package/dist/resolver/index.js +46 -0
- package/dist/resolver/index.js.map +1 -0
- package/dist/resolver/keyframes.d.ts +56 -0
- package/dist/resolver/keyframes.d.ts.map +1 -0
- package/dist/resolver/keyframes.js +102 -0
- package/dist/resolver/keyframes.js.map +1 -0
- package/dist/resolver/paths.d.ts +37 -0
- package/dist/resolver/paths.d.ts.map +1 -0
- package/dist/resolver/paths.js +135 -0
- package/dist/resolver/paths.js.map +1 -0
- package/dist/resolver/rules.d.ts +34 -0
- package/dist/resolver/rules.d.ts.map +1 -0
- package/dist/resolver/rules.js +52 -0
- package/dist/resolver/rules.js.map +1 -0
- package/dist/resolver/scopes.d.ts +44 -0
- package/dist/resolver/scopes.d.ts.map +1 -0
- package/dist/resolver/scopes.js +213 -0
- package/dist/resolver/scopes.js.map +1 -0
- package/dist/resolver/types.d.ts +238 -0
- package/dist/resolver/types.d.ts.map +1 -0
- package/dist/resolver/types.js +11 -0
- package/dist/resolver/types.js.map +1 -0
- package/dist/selectors/flatten.d.ts +95 -0
- package/dist/selectors/flatten.d.ts.map +1 -0
- package/dist/selectors/flatten.js +384 -0
- package/dist/selectors/flatten.js.map +1 -0
- package/dist/selectors/index.d.ts +15 -0
- package/dist/selectors/index.d.ts.map +1 -0
- package/dist/selectors/index.js +14 -0
- package/dist/selectors/index.js.map +1 -0
- package/dist/selectors/scan.d.ts +54 -0
- package/dist/selectors/scan.d.ts.map +1 -0
- package/dist/selectors/scan.js +191 -0
- package/dist/selectors/scan.js.map +1 -0
- package/dist/selectors/specificity.d.ts +28 -0
- package/dist/selectors/specificity.d.ts.map +1 -0
- package/dist/selectors/specificity.js +297 -0
- package/dist/selectors/specificity.js.map +1 -0
- package/dist/setup-list.d.ts +41 -0
- package/dist/setup-list.d.ts.map +1 -0
- package/dist/setup-list.js +122 -0
- package/dist/setup-list.js.map +1 -0
- package/dist/sourcemaps/index.d.ts +14 -0
- package/dist/sourcemaps/index.d.ts.map +1 -0
- package/dist/sourcemaps/index.js +13 -0
- package/dist/sourcemaps/index.js.map +1 -0
- package/dist/sourcemaps/mappings.d.ts +77 -0
- package/dist/sourcemaps/mappings.d.ts.map +1 -0
- package/dist/sourcemaps/mappings.js +124 -0
- package/dist/sourcemaps/mappings.js.map +1 -0
- package/dist/sourcemaps/vlq.d.ts +12 -0
- package/dist/sourcemaps/vlq.d.ts.map +1 -0
- package/dist/sourcemaps/vlq.js +29 -0
- package/dist/sourcemaps/vlq.js.map +1 -0
- package/dist/types/ast.d.ts +291 -0
- package/dist/types/ast.d.ts.map +1 -0
- package/dist/types/ast.js +2 -0
- package/dist/types/ast.js.map +1 -0
- package/dist/types/diagnostics.d.ts +55 -0
- package/dist/types/diagnostics.d.ts.map +1 -0
- package/dist/types/diagnostics.js +61 -0
- package/dist/types/diagnostics.js.map +1 -0
- package/dist/types/options.d.ts +274 -0
- package/dist/types/options.d.ts.map +1 -0
- package/dist/types/options.js +11 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/result.d.ts +112 -0
- package/dist/types/result.d.ts.map +1 -0
- package/dist/types/result.js +2 -0
- package/dist/types/result.js.map +1 -0
- package/dist/types/span.d.ts +19 -0
- package/dist/types/span.d.ts.map +1 -0
- package/dist/types/span.js +2 -0
- package/dist/types/span.js.map +1 -0
- package/dist/types/token.d.ts +68 -0
- package/dist/types/token.d.ts.map +1 -0
- package/dist/types/token.js +2 -0
- package/dist/types/token.js.map +1 -0
- package/dist/variables/ast.d.ts +56 -0
- package/dist/variables/ast.d.ts.map +1 -0
- package/dist/variables/ast.js +167 -0
- package/dist/variables/ast.js.map +1 -0
- package/dist/variables/expand.d.ts +109 -0
- package/dist/variables/expand.d.ts.map +1 -0
- package/dist/variables/expand.js +213 -0
- package/dist/variables/expand.js.map +1 -0
- package/dist/variables/index.d.ts +36 -0
- package/dist/variables/index.d.ts.map +1 -0
- package/dist/variables/index.js +33 -0
- package/dist/variables/index.js.map +1 -0
- package/dist/variables/naming.d.ts +39 -0
- package/dist/variables/naming.d.ts.map +1 -0
- package/dist/variables/naming.js +14 -0
- package/dist/variables/naming.js.map +1 -0
- package/dist/variables/runtime.d.ts +81 -0
- package/dist/variables/runtime.d.ts.map +1 -0
- package/dist/variables/runtime.js +228 -0
- package/dist/variables/runtime.js.map +1 -0
- package/dist/variables/substitute.d.ts +65 -0
- package/dist/variables/substitute.d.ts.map +1 -0
- package/dist/variables/substitute.js +73 -0
- package/dist/variables/substitute.js.map +1 -0
- package/dist/variables/walk.d.ts +37 -0
- package/dist/variables/walk.d.ts.map +1 -0
- package/dist/variables/walk.js +113 -0
- package/dist/variables/walk.js.map +1 -0
- package/package.json +35 -4
- package/src/emitter/index.ts +658 -0
- package/src/formatter/index.ts +544 -0
- package/src/host/node.ts +85 -0
- package/src/index.ts +1021 -0
- package/src/ir/factories.ts +85 -0
- package/src/ir/index.ts +28 -0
- package/src/ir/types.ts +145 -0
- package/src/lexer/at-keywords.ts +35 -0
- package/src/lexer/characters.ts +82 -0
- package/src/lexer/comments.ts +27 -0
- package/src/lexer/diagnostics.ts +42 -0
- package/src/lexer/dollar-refs.ts +23 -0
- package/src/lexer/index.ts +37 -0
- package/src/lexer/names.ts +49 -0
- package/src/lexer/numbers.ts +59 -0
- package/src/lexer/scanner.ts +199 -0
- package/src/lexer/strings.ts +52 -0
- package/src/lexer/urls.ts +63 -0
- package/src/lowering/expand-groups.ts +206 -0
- package/src/lowering/group.ts +119 -0
- package/src/lowering/index.ts +43 -0
- package/src/lowering/lower.ts +441 -0
- package/src/lowering/media.ts +314 -0
- package/src/lowering/merge.ts +163 -0
- package/src/lowering/property-families.ts +194 -0
- package/src/lowering/spans.ts +118 -0
- package/src/naming/index.ts +44 -0
- package/src/naming/mapgen.ts +252 -0
- package/src/naming/merge.ts +114 -0
- package/src/naming/rewrite.ts +333 -0
- package/src/naming/scan.ts +267 -0
- package/src/naming/table.ts +153 -0
- package/src/naming/types.ts +100 -0
- package/src/output/import-path.ts +30 -0
- package/src/output/index.ts +213 -0
- package/src/output/manifest.ts +28 -0
- package/src/output/paths.ts +200 -0
- package/src/output/resolve.ts +401 -0
- package/src/output/validate.ts +251 -0
- package/src/parser/cursor.ts +138 -0
- package/src/parser/declaration.ts +247 -0
- package/src/parser/diagnostics.ts +75 -0
- package/src/parser/group.ts +303 -0
- package/src/parser/index.ts +50 -0
- package/src/parser/modifier.ts +60 -0
- package/src/parser/recovery.ts +88 -0
- package/src/parser/rule.ts +370 -0
- package/src/parser/statement.ts +47 -0
- package/src/parser/statements.ts +667 -0
- package/src/parser/value.ts +265 -0
- package/src/resolver/graph.ts +467 -0
- package/src/resolver/groups.ts +177 -0
- package/src/resolver/index.ts +68 -0
- package/src/resolver/keyframes.ts +131 -0
- package/src/resolver/paths.ts +142 -0
- package/src/resolver/rules.ts +54 -0
- package/src/resolver/scopes.ts +342 -0
- package/src/resolver/types.ts +259 -0
- package/src/selectors/flatten.ts +448 -0
- package/src/selectors/index.ts +14 -0
- package/src/selectors/scan.ts +227 -0
- package/src/selectors/specificity.ts +319 -0
- package/src/setup-list.ts +172 -0
- package/src/sourcemaps/index.ts +25 -0
- package/src/sourcemaps/mappings.ts +190 -0
- package/src/sourcemaps/vlq.ts +29 -0
- package/src/types/ast.ts +318 -0
- package/src/types/diagnostics.ts +124 -0
- package/src/types/options.ts +286 -0
- package/src/types/result.ts +121 -0
- package/src/types/span.ts +18 -0
- package/src/types/token.ts +77 -0
- package/src/variables/ast.ts +182 -0
- package/src/variables/expand.ts +319 -0
- package/src/variables/index.ts +38 -0
- package/src/variables/naming.ts +46 -0
- package/src/variables/runtime.ts +336 -0
- package/src/variables/substitute.ts +148 -0
- package/src/variables/walk.ts +147 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import specifier for the opt-in CSS side-effect import in the class map
|
|
3
|
+
* (ADR-0021).
|
|
4
|
+
*
|
|
5
|
+
* The specifier is computed from the two planned artifacts, never from authored
|
|
6
|
+
* settings, so it always names the stylesheet that is actually written:
|
|
7
|
+
*
|
|
8
|
+
* - relative to the directory of the emitted `map.js`;
|
|
9
|
+
* - POSIX separators only;
|
|
10
|
+
* - always `./`-prefixed when the stylesheet is in or below the map directory,
|
|
11
|
+
* and left as authored `..` segments when it is above it.
|
|
12
|
+
*
|
|
13
|
+
* The planner guarantees both artifacts stay inside the workspace; a
|
|
14
|
+
* non-relative result would therefore mean the plan was rejected, and callers
|
|
15
|
+
* omit the import instead of emitting a dangling specifier.
|
|
16
|
+
*/
|
|
17
|
+
import { dirnamePath, isAbsolutePath, relativePath } from "./paths.js";
|
|
18
|
+
/**
|
|
19
|
+
* Return the ESM specifier a generated map uses to import its stylesheet.
|
|
20
|
+
*
|
|
21
|
+
* @param mapFile Absolute POSIX path of the generated JS map.
|
|
22
|
+
* @param stylesheetFile Absolute POSIX path of the emitted stylesheet.
|
|
23
|
+
*/
|
|
24
|
+
export function stylesheetImportSpecifier(mapFile, stylesheetFile) {
|
|
25
|
+
const relative = relativePath(dirnamePath(mapFile), stylesheetFile);
|
|
26
|
+
if (relative === "." || relative.startsWith("../") || isAbsolutePath(relative))
|
|
27
|
+
return relative;
|
|
28
|
+
return `./${relative}`;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=import-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-path.js","sourceRoot":"","sources":["../../src/output/import-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAe,EAAE,cAAsB;IAC/E,MAAM,QAAQ,GAAG,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IACpE,IAAI,QAAQ,KAAK,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChG,OAAO,KAAK,QAAQ,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure output planner for Chikx (SPECIFICATION.md §9).
|
|
3
|
+
*
|
|
4
|
+
* `planOutputs` resolves every CSS, JS map, declaration and CSS source-map
|
|
5
|
+
* destination from the frozen `ResolvedSetup`/`ProjectConfig`/CLI inputs,
|
|
6
|
+
* validates the complete plan, and returns it with a matching manifest. It is
|
|
7
|
+
* synchronous, deterministic and never writes. Expected planning failures are
|
|
8
|
+
* returned as CHIKX5001 diagnostics instead of exceptions.
|
|
9
|
+
*
|
|
10
|
+
* The frozen `PlanOutputsInput` does not carry a host or trusted-output policy.
|
|
11
|
+
* This module therefore exposes an optional second context argument:
|
|
12
|
+
* `host` supplies `canonicalize` for symlink containment, and
|
|
13
|
+
* `occupiedTargets` lets a project build pass targets already planned by other
|
|
14
|
+
* entries so cross-source collisions are rejected. Without them the planner
|
|
15
|
+
* uses lexical identity canonicalization and validates one entry at a time.
|
|
16
|
+
* External output is always rejected; no trusted policy escape exists in the
|
|
17
|
+
* frozen contracts.
|
|
18
|
+
*/
|
|
19
|
+
import type { PlanOutputsInput, PlanOutputsResult } from "../types/result.js";
|
|
20
|
+
import type { OutputPlannerHost } from "./validate.js";
|
|
21
|
+
export type { OutputPlannerHost } from "./validate.js";
|
|
22
|
+
/** Optional planning context that the frozen input shape has no room for. */
|
|
23
|
+
export interface OutputPlannerContext {
|
|
24
|
+
/** Canonicalization host used to detect symlink escapes. */
|
|
25
|
+
readonly host?: OutputPlannerHost;
|
|
26
|
+
/** Absolute or workspace-relative targets already planned by other entries. */
|
|
27
|
+
readonly occupiedTargets?: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validate and return the complete output plan for one entry before anything is
|
|
31
|
+
* written.
|
|
32
|
+
*
|
|
33
|
+
* @param input Frozen planner input: source, effective setup, optional project
|
|
34
|
+
* configuration and CLI overrides, and the absolute workspace root.
|
|
35
|
+
* @param context Optional host and cross-entry occupied targets.
|
|
36
|
+
* @returns The valid plan plus diagnostics. Any error leaves an empty plan so a
|
|
37
|
+
* caller cannot accidentally write a partial or unsafe artifact set.
|
|
38
|
+
*/
|
|
39
|
+
export declare function planOutputs(input: PlanOutputsInput, context?: OutputPlannerContext): PlanOutputsResult;
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/output/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAGV,gBAAgB,EAChB,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,eAAe,CAAC;AASxE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,6EAA6E;AAC7E,MAAM,WAAW,oBAAoB;IACnC,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAClC,+EAA+E;IAC/E,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,gBAAgB,EACvB,OAAO,GAAE,oBAAyB,GACjC,iBAAiB,CAsHnB"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure output planner for Chikx (SPECIFICATION.md §9).
|
|
3
|
+
*
|
|
4
|
+
* `planOutputs` resolves every CSS, JS map, declaration and CSS source-map
|
|
5
|
+
* destination from the frozen `ResolvedSetup`/`ProjectConfig`/CLI inputs,
|
|
6
|
+
* validates the complete plan, and returns it with a matching manifest. It is
|
|
7
|
+
* synchronous, deterministic and never writes. Expected planning failures are
|
|
8
|
+
* returned as CHIKX5001 diagnostics instead of exceptions.
|
|
9
|
+
*
|
|
10
|
+
* The frozen `PlanOutputsInput` does not carry a host or trusted-output policy.
|
|
11
|
+
* This module therefore exposes an optional second context argument:
|
|
12
|
+
* `host` supplies `canonicalize` for symlink containment, and
|
|
13
|
+
* `occupiedTargets` lets a project build pass targets already planned by other
|
|
14
|
+
* entries so cross-source collisions are rejected. Without them the planner
|
|
15
|
+
* uses lexical identity canonicalization and validates one entry at a time.
|
|
16
|
+
* External output is always rejected; no trusted policy escape exists in the
|
|
17
|
+
* frozen contracts.
|
|
18
|
+
*/
|
|
19
|
+
import { error } from "../types/diagnostics.js";
|
|
20
|
+
import { buildManifest } from "./manifest.js";
|
|
21
|
+
import { isAbsolutePath, joinPath, normalizePath, relativePath } from "./paths.js";
|
|
22
|
+
import { declarationNameFor, resolveOutputSettings, resolveSource, sourceMapNameFor, } from "./resolve.js";
|
|
23
|
+
import { findDuplicateTargets, suppressedTypesWarning, validateCandidate, validateName, workspacePathFor, } from "./validate.js";
|
|
24
|
+
/**
|
|
25
|
+
* Validate and return the complete output plan for one entry before anything is
|
|
26
|
+
* written.
|
|
27
|
+
*
|
|
28
|
+
* @param input Frozen planner input: source, effective setup, optional project
|
|
29
|
+
* configuration and CLI overrides, and the absolute workspace root.
|
|
30
|
+
* @param context Optional host and cross-entry occupied targets.
|
|
31
|
+
* @returns The valid plan plus diagnostics. Any error leaves an empty plan so a
|
|
32
|
+
* caller cannot accidentally write a partial or unsafe artifact set.
|
|
33
|
+
*/
|
|
34
|
+
export function planOutputs(input, context = {}) {
|
|
35
|
+
const workspaceRoot = normalizePath(input.workspaceRoot);
|
|
36
|
+
const resolvedSource = resolveSource(input);
|
|
37
|
+
const sourceRelative = relativePath(workspaceRoot, resolvedSource.absolute);
|
|
38
|
+
const source = Object.freeze({ ...resolvedSource, relative: sourceRelative });
|
|
39
|
+
const span = Object.freeze({ start: 0, end: 0, file: sourceRelative });
|
|
40
|
+
const emptyPlan = Object.freeze({
|
|
41
|
+
outputs: Object.freeze([]),
|
|
42
|
+
manifest: Object.freeze([]),
|
|
43
|
+
});
|
|
44
|
+
const diagnostics = [];
|
|
45
|
+
if (!isAbsolutePath(workspaceRoot)) {
|
|
46
|
+
diagnostics.push(error("CHIKX5001", `Workspace root "${input.workspaceRoot}" must be an absolute POSIX or drive-letter path.`, span));
|
|
47
|
+
return freezeResult(emptyPlan, diagnostics);
|
|
48
|
+
}
|
|
49
|
+
if (isAbsolutePath(sourceRelative) ||
|
|
50
|
+
sourceRelative === ".." ||
|
|
51
|
+
sourceRelative.startsWith("../")) {
|
|
52
|
+
diagnostics.push(error("CHIKX5001", `Source "${sourceRelative}" is outside the workspace root "${workspaceRoot}".`, span));
|
|
53
|
+
return freezeResult(emptyPlan, diagnostics);
|
|
54
|
+
}
|
|
55
|
+
const settings = resolveOutputSettings(input, source, workspaceRoot);
|
|
56
|
+
let emitTypes = settings.emitTypes;
|
|
57
|
+
if (!settings.emitMap && settings.emitTypes) {
|
|
58
|
+
diagnostics.push(suppressedTypesWarning(span));
|
|
59
|
+
emitTypes = false;
|
|
60
|
+
}
|
|
61
|
+
const cssNameDiagnostic = settings.emitCss
|
|
62
|
+
? validateName(settings.cssName, "css", span)
|
|
63
|
+
: undefined;
|
|
64
|
+
if (cssNameDiagnostic !== undefined)
|
|
65
|
+
diagnostics.push(cssNameDiagnostic);
|
|
66
|
+
const mapNameDiagnostic = settings.emitMap
|
|
67
|
+
? validateName(settings.mapName, "js", span)
|
|
68
|
+
: undefined;
|
|
69
|
+
if (mapNameDiagnostic !== undefined)
|
|
70
|
+
diagnostics.push(mapNameDiagnostic);
|
|
71
|
+
if (hasError(diagnostics)) {
|
|
72
|
+
return freezeResult(emptyPlan, diagnostics);
|
|
73
|
+
}
|
|
74
|
+
const candidates = [];
|
|
75
|
+
const mapAbsolute = joinPath(settings.mapDir, settings.mapName);
|
|
76
|
+
if (settings.emitCss) {
|
|
77
|
+
for (const directory of settings.cssDirs) {
|
|
78
|
+
const cssAbsolute = joinPath(directory, settings.cssName);
|
|
79
|
+
candidates.push(toCandidate("css", cssAbsolute, source.relative, workspaceRoot));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (settings.emitMap) {
|
|
83
|
+
candidates.push(toCandidate("js", mapAbsolute, source.relative, workspaceRoot));
|
|
84
|
+
if (emitTypes) {
|
|
85
|
+
const declarationsAbsolute = joinPath(settings.mapDir, declarationNameFor(settings.mapName));
|
|
86
|
+
candidates.push(toCandidate("types", declarationsAbsolute, source.relative, workspaceRoot));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (settings.emitCss && settings.sourceMap) {
|
|
90
|
+
for (const directory of settings.cssDirs) {
|
|
91
|
+
const mapFileAbsolute = joinPath(directory, sourceMapNameFor(settings.cssName));
|
|
92
|
+
candidates.push(toCandidate("cssSourceMap", mapFileAbsolute, source.relative, workspaceRoot));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
for (const candidate of candidates) {
|
|
96
|
+
diagnostics.push(...validateCandidate(candidate, {
|
|
97
|
+
workspaceRoot,
|
|
98
|
+
source: { relative: source.relative, absolute: source.absolute },
|
|
99
|
+
span,
|
|
100
|
+
...(context.host === undefined ? {} : { host: context.host }),
|
|
101
|
+
...(context.occupiedTargets === undefined
|
|
102
|
+
? {}
|
|
103
|
+
: { occupiedTargets: context.occupiedTargets }),
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
diagnostics.push(...findDuplicateTargets(candidates, span));
|
|
107
|
+
if (hasError(diagnostics)) {
|
|
108
|
+
return freezeResult(emptyPlan, diagnostics);
|
|
109
|
+
}
|
|
110
|
+
const outputs = Object.freeze(candidates.map((candidate) => Object.freeze({
|
|
111
|
+
kind: candidate.kind,
|
|
112
|
+
absolutePath: candidate.absolutePath,
|
|
113
|
+
workspacePath: candidate.workspacePath,
|
|
114
|
+
sourceFile: candidate.sourceFile,
|
|
115
|
+
})));
|
|
116
|
+
return freezeResult(Object.freeze({
|
|
117
|
+
outputs,
|
|
118
|
+
manifest: buildManifest(outputs),
|
|
119
|
+
}), diagnostics);
|
|
120
|
+
}
|
|
121
|
+
function toCandidate(kind, absolutePath, sourceFile, workspaceRoot) {
|
|
122
|
+
return Object.freeze({
|
|
123
|
+
kind,
|
|
124
|
+
absolutePath: normalizePath(absolutePath),
|
|
125
|
+
workspacePath: workspacePathFor(workspaceRoot, absolutePath),
|
|
126
|
+
sourceFile,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function hasError(diagnostics) {
|
|
130
|
+
return diagnostics.some((diagnostic) => diagnostic.severity === "error");
|
|
131
|
+
}
|
|
132
|
+
function freezeResult(plan, diagnostics) {
|
|
133
|
+
return Object.freeze({
|
|
134
|
+
plan,
|
|
135
|
+
diagnostics: Object.freeze([...diagnostics]),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CAAC,IAAI;QACpB,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,aAAa,EAAE,SAAS,CAAC,aAAa;QACtC,UAAU,EAAE,SAAS,CAAC,UAAU;KACjC,CAAC,CACH,CACF,CAAC;IACF,OAAO,YAAY,CACjB,MAAM,CAAC,MAAM,CAAC;QACZ,OAAO;QACP,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC;KACjC,CAAC,EACF,WAAW,CACZ,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAClB,IAAgB,EAChB,YAAoB,EACpB,UAAkB,EAClB,aAAqB;IAErB,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI;QACJ,YAAY,EAAE,aAAa,CAAC,YAAY,CAAC;QACzC,aAAa,EAAE,gBAAgB,CAAC,aAAa,EAAE,YAAY,CAAC;QAC5D,UAAU;KACX,CAAC,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAC,WAAkC;IAClD,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,YAAY,CAAC,IAAgB,EAAE,WAAyB;IAC/D,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI;QACJ,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC;KAC7C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest construction for planned artifacts.
|
|
3
|
+
*
|
|
4
|
+
* A manifest records every compiler-owned artifact so `chikx clean` and watch
|
|
5
|
+
* invalidation can remove or refresh only files the compiler created. Entries
|
|
6
|
+
* never carry timestamps and follow the same order as the plan. Content hashes
|
|
7
|
+
* are added only after a successful write, so the planner omits them.
|
|
8
|
+
*/
|
|
9
|
+
import type { ManifestEntry, PlannedOutput } from "../types/result.js";
|
|
10
|
+
/**
|
|
11
|
+
* Build one manifest entry per planned artifact, in plan order.
|
|
12
|
+
*
|
|
13
|
+
* @param outputs Deterministically ordered planned artifacts.
|
|
14
|
+
* @returns Frozen manifest entries with kind, workspace path and source file.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildManifest(outputs: readonly PlannedOutput[]): readonly ManifestEntry[];
|
|
17
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/output/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEvE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,SAAS,aAAa,EAAE,CAUzF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest construction for planned artifacts.
|
|
3
|
+
*
|
|
4
|
+
* A manifest records every compiler-owned artifact so `chikx clean` and watch
|
|
5
|
+
* invalidation can remove or refresh only files the compiler created. Entries
|
|
6
|
+
* never carry timestamps and follow the same order as the plan. Content hashes
|
|
7
|
+
* are added only after a successful write, so the planner omits them.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Build one manifest entry per planned artifact, in plan order.
|
|
11
|
+
*
|
|
12
|
+
* @param outputs Deterministically ordered planned artifacts.
|
|
13
|
+
* @returns Frozen manifest entries with kind, workspace path and source file.
|
|
14
|
+
*/
|
|
15
|
+
export function buildManifest(outputs) {
|
|
16
|
+
return Object.freeze(outputs.map((output) => Object.freeze({
|
|
17
|
+
kind: output.kind,
|
|
18
|
+
workspacePath: output.workspacePath,
|
|
19
|
+
sourceFile: output.sourceFile,
|
|
20
|
+
})));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/output/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,OAAiC;IAC7D,OAAO,MAAM,CAAC,MAAM,CAClB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACrB,MAAM,CAAC,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC,CACH,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure POSIX path utilities for output planning.
|
|
3
|
+
*
|
|
4
|
+
* The output planner never touches the filesystem and never imports `node:path`.
|
|
5
|
+
* All paths are normalized to forward slashes, `.`/`..` segments are collapsed
|
|
6
|
+
* lexically, and Windows drive prefixes such as `C:\project` are preserved as
|
|
7
|
+
* `C:/project`. Hosts still own symlink and case policy; these helpers only
|
|
8
|
+
* provide deterministic, platform-independent string handling.
|
|
9
|
+
*/
|
|
10
|
+
/** Convert every backslash to a forward slash. */
|
|
11
|
+
export declare function toPosix(path: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether a path is absolute in the planner's POSIX-plus-drive model.
|
|
14
|
+
*
|
|
15
|
+
* A leading slash, a UNC-style double slash and a drive prefix (`C:/`, `C:`)
|
|
16
|
+
* are absolute. Bare relative paths are not.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isAbsolutePath(path: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Normalize a path to forward slashes and collapse `.`/`..` segments lexically.
|
|
21
|
+
*
|
|
22
|
+
* Absolute paths keep their root (`/`, `//` or a drive such as `C:/`) and never
|
|
23
|
+
* climb above it. Relative paths keep leading `..` segments. An empty result
|
|
24
|
+
* becomes `.`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizePath(path: string): string;
|
|
27
|
+
/** Join path parts with `/`, resetting to an absolute part when one appears. */
|
|
28
|
+
export declare function joinPath(base: string, ...parts: readonly string[]): string;
|
|
29
|
+
/** Return the parent directory of a normalized path. */
|
|
30
|
+
export declare function dirnamePath(path: string): string;
|
|
31
|
+
/** Return the final path segment, or an empty string for a root. */
|
|
32
|
+
export declare function basenamePath(path: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Compute a relative path from one path to another.
|
|
35
|
+
*
|
|
36
|
+
* Both paths must share the same absolute root; otherwise the normalized target
|
|
37
|
+
* is returned unchanged. Relative inputs are compared lexically. The result is
|
|
38
|
+
* `.` when the paths are identical.
|
|
39
|
+
*/
|
|
40
|
+
export declare function relativePath(from: string, to: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Whether `target` lies inside `root`, including the root itself.
|
|
43
|
+
*
|
|
44
|
+
* Comparison is lexical. Drive-letter roots and their segments are compared
|
|
45
|
+
* case-insensitively to match Windows expectations; POSIX paths stay
|
|
46
|
+
* case-sensitive. Symlink and full case policy belong to the injected host.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isWithinPath(root: string, target: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether a path is a safe, non-empty relative path that does not climb out of
|
|
51
|
+
* its base (`..`, `../x` and absolute paths are not safe).
|
|
52
|
+
*/
|
|
53
|
+
export declare function isSafeRelativePath(path: string): boolean;
|
|
54
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/output/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,kDAAkD;AAClD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD;AAqBD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAqBlD;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAW1E;AAED,wDAAwD;AACxD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYhD;AAED,oEAAoE;AACpE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOjD;AAcD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CA+B7D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAgBlE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIxD"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure POSIX path utilities for output planning.
|
|
3
|
+
*
|
|
4
|
+
* The output planner never touches the filesystem and never imports `node:path`.
|
|
5
|
+
* All paths are normalized to forward slashes, `.`/`..` segments are collapsed
|
|
6
|
+
* lexically, and Windows drive prefixes such as `C:\project` are preserved as
|
|
7
|
+
* `C:/project`. Hosts still own symlink and case policy; these helpers only
|
|
8
|
+
* provide deterministic, platform-independent string handling.
|
|
9
|
+
*/
|
|
10
|
+
/** Convert every backslash to a forward slash. */
|
|
11
|
+
export function toPosix(path) {
|
|
12
|
+
return path.replace(/\\/g, "/");
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Whether a path is absolute in the planner's POSIX-plus-drive model.
|
|
16
|
+
*
|
|
17
|
+
* A leading slash, a UNC-style double slash and a drive prefix (`C:/`, `C:`)
|
|
18
|
+
* are absolute. Bare relative paths are not.
|
|
19
|
+
*/
|
|
20
|
+
export function isAbsolutePath(path) {
|
|
21
|
+
const slashed = toPosix(path);
|
|
22
|
+
return slashed.startsWith("/") || /^[A-Za-z]:(\/|$)/.test(slashed);
|
|
23
|
+
}
|
|
24
|
+
function splitRoot(path) {
|
|
25
|
+
const match = /^([A-Za-z]):(?=\/|$)/.exec(path);
|
|
26
|
+
if (match?.[1] !== undefined) {
|
|
27
|
+
let rest = path.slice(2);
|
|
28
|
+
if (rest.startsWith("/"))
|
|
29
|
+
rest = rest.slice(1);
|
|
30
|
+
return { root: `${match[1]}:/`, rest };
|
|
31
|
+
}
|
|
32
|
+
if (path.startsWith("//"))
|
|
33
|
+
return { root: "//", rest: path.slice(2) };
|
|
34
|
+
if (path.startsWith("/"))
|
|
35
|
+
return { root: "/", rest: path.slice(1) };
|
|
36
|
+
return { root: "", rest: path };
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Normalize a path to forward slashes and collapse `.`/`..` segments lexically.
|
|
40
|
+
*
|
|
41
|
+
* Absolute paths keep their root (`/`, `//` or a drive such as `C:/`) and never
|
|
42
|
+
* climb above it. Relative paths keep leading `..` segments. An empty result
|
|
43
|
+
* becomes `.`.
|
|
44
|
+
*/
|
|
45
|
+
export function normalizePath(path) {
|
|
46
|
+
const slashed = toPosix(path);
|
|
47
|
+
const { root, rest } = splitRoot(slashed);
|
|
48
|
+
const segments = [];
|
|
49
|
+
for (const segment of rest.split("/")) {
|
|
50
|
+
if (segment === "" || segment === ".")
|
|
51
|
+
continue;
|
|
52
|
+
if (segment === "..") {
|
|
53
|
+
const last = segments[segments.length - 1];
|
|
54
|
+
if (last !== undefined && last !== "..")
|
|
55
|
+
segments.pop();
|
|
56
|
+
else if (root === "")
|
|
57
|
+
segments.push("..");
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
segments.push(segment);
|
|
61
|
+
}
|
|
62
|
+
const body = segments.join("/");
|
|
63
|
+
if (root === "")
|
|
64
|
+
return body === "" ? "." : body;
|
|
65
|
+
if (root === "/")
|
|
66
|
+
return body === "" ? "/" : `/${body}`;
|
|
67
|
+
if (root === "//")
|
|
68
|
+
return body === "" ? "//" : `//${body}`;
|
|
69
|
+
return body === "" ? root : `${root}${body}`;
|
|
70
|
+
}
|
|
71
|
+
/** Join path parts with `/`, resetting to an absolute part when one appears. */
|
|
72
|
+
export function joinPath(base, ...parts) {
|
|
73
|
+
let result = normalizePath(base);
|
|
74
|
+
for (const part of parts) {
|
|
75
|
+
if (part === undefined || part === "")
|
|
76
|
+
continue;
|
|
77
|
+
if (isAbsolutePath(part)) {
|
|
78
|
+
result = normalizePath(part);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
result = normalizePath(result === "." ? part : `${result}/${part}`);
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
/** Return the parent directory of a normalized path. */
|
|
86
|
+
export function dirnamePath(path) {
|
|
87
|
+
const normalized = normalizePath(path);
|
|
88
|
+
if (normalized === "/" || normalized === "//" || /^[A-Za-z]:\/$/.test(normalized)) {
|
|
89
|
+
return normalized;
|
|
90
|
+
}
|
|
91
|
+
const index = normalized.lastIndexOf("/");
|
|
92
|
+
if (index < 0)
|
|
93
|
+
return ".";
|
|
94
|
+
const parent = normalized.slice(0, index);
|
|
95
|
+
if (parent === "")
|
|
96
|
+
return "/";
|
|
97
|
+
if (parent === "/")
|
|
98
|
+
return "/";
|
|
99
|
+
if (/^[A-Za-z]:$/.test(parent))
|
|
100
|
+
return `${parent}/`;
|
|
101
|
+
return parent;
|
|
102
|
+
}
|
|
103
|
+
/** Return the final path segment, or an empty string for a root. */
|
|
104
|
+
export function basenamePath(path) {
|
|
105
|
+
const normalized = normalizePath(path);
|
|
106
|
+
if (normalized === "/" || normalized === "//" || /^[A-Za-z]:\/$/.test(normalized)) {
|
|
107
|
+
return "";
|
|
108
|
+
}
|
|
109
|
+
const index = normalized.lastIndexOf("/");
|
|
110
|
+
return index < 0 ? normalized : normalized.slice(index + 1);
|
|
111
|
+
}
|
|
112
|
+
function isDriveRoot(root) {
|
|
113
|
+
return /^[A-Za-z]:\/$/.test(root);
|
|
114
|
+
}
|
|
115
|
+
function rootsMatch(left, right) {
|
|
116
|
+
return left.toLowerCase() === right.toLowerCase();
|
|
117
|
+
}
|
|
118
|
+
function segmentsEqual(left, right, caseInsensitive) {
|
|
119
|
+
return caseInsensitive ? left.toLowerCase() === right.toLowerCase() : left === right;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Compute a relative path from one path to another.
|
|
123
|
+
*
|
|
124
|
+
* Both paths must share the same absolute root; otherwise the normalized target
|
|
125
|
+
* is returned unchanged. Relative inputs are compared lexically. The result is
|
|
126
|
+
* `.` when the paths are identical.
|
|
127
|
+
*/
|
|
128
|
+
export function relativePath(from, to) {
|
|
129
|
+
const source = normalizePath(from);
|
|
130
|
+
const target = normalizePath(to);
|
|
131
|
+
const sourceRoot = splitRoot(source);
|
|
132
|
+
const targetRoot = splitRoot(target);
|
|
133
|
+
if (!rootsMatch(sourceRoot.root, targetRoot.root)) {
|
|
134
|
+
return target;
|
|
135
|
+
}
|
|
136
|
+
const caseInsensitive = isDriveRoot(sourceRoot.root) && isDriveRoot(targetRoot.root);
|
|
137
|
+
const sourceSegments = sourceRoot.rest.split("/").filter((segment) => segment !== "");
|
|
138
|
+
const targetSegments = targetRoot.rest.split("/").filter((segment) => segment !== "");
|
|
139
|
+
let common = 0;
|
|
140
|
+
while (common < sourceSegments.length &&
|
|
141
|
+
common < targetSegments.length &&
|
|
142
|
+
segmentsEqual(sourceSegments[common] ?? "", targetSegments[common] ?? "", caseInsensitive)) {
|
|
143
|
+
common += 1;
|
|
144
|
+
}
|
|
145
|
+
if (sourceRoot.root === "" && common === 0)
|
|
146
|
+
return target;
|
|
147
|
+
const parts = [];
|
|
148
|
+
for (let index = common; index < sourceSegments.length; index += 1)
|
|
149
|
+
parts.push("..");
|
|
150
|
+
for (let index = common; index < targetSegments.length; index += 1) {
|
|
151
|
+
parts.push(targetSegments[index] ?? "");
|
|
152
|
+
}
|
|
153
|
+
return parts.length === 0 ? "." : parts.join("/");
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Whether `target` lies inside `root`, including the root itself.
|
|
157
|
+
*
|
|
158
|
+
* Comparison is lexical. Drive-letter roots and their segments are compared
|
|
159
|
+
* case-insensitively to match Windows expectations; POSIX paths stay
|
|
160
|
+
* case-sensitive. Symlink and full case policy belong to the injected host.
|
|
161
|
+
*/
|
|
162
|
+
export function isWithinPath(root, target) {
|
|
163
|
+
const base = normalizePath(root);
|
|
164
|
+
const candidate = normalizePath(target);
|
|
165
|
+
const baseRoot = splitRoot(base);
|
|
166
|
+
const candidateRoot = splitRoot(candidate);
|
|
167
|
+
if (!rootsMatch(baseRoot.root, candidateRoot.root))
|
|
168
|
+
return false;
|
|
169
|
+
const caseInsensitive = isDriveRoot(baseRoot.root) && isDriveRoot(candidateRoot.root);
|
|
170
|
+
const baseSegments = baseRoot.rest.split("/").filter((segment) => segment !== "");
|
|
171
|
+
const candidateSegments = candidateRoot.rest.split("/").filter((segment) => segment !== "");
|
|
172
|
+
if (baseSegments.length > candidateSegments.length)
|
|
173
|
+
return false;
|
|
174
|
+
return baseSegments.every((segment, index) => segmentsEqual(segment, candidateSegments[index] ?? "", caseInsensitive));
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Whether a path is a safe, non-empty relative path that does not climb out of
|
|
178
|
+
* its base (`..`, `../x` and absolute paths are not safe).
|
|
179
|
+
*/
|
|
180
|
+
export function isSafeRelativePath(path) {
|
|
181
|
+
return (path !== "" && path !== "." && path !== ".." && !isAbsolutePath(path) && !path.startsWith("../"));
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/output/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,kDAAkD;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AO,CACL,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CACjG,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Destination resolution for the pure output planner.
|
|
3
|
+
*
|
|
4
|
+
* Precedence is built-in defaults, project configuration, file `@setup` and
|
|
5
|
+
* explicit CLI overrides (SPECIFICATION.md §9.1). File-level directories are
|
|
6
|
+
* exact and resolve against the source directory; project-level directories
|
|
7
|
+
* resolve against the workspace root and preserve the source-relative
|
|
8
|
+
* subdirectory; CLI directories resolve against the workspace root and are
|
|
9
|
+
* exact because path overrides are single-entry only.
|
|
10
|
+
*
|
|
11
|
+
* `ResolvedSetup` is required and therefore cannot record whether a value was
|
|
12
|
+
* authored or copied from a default. The planner treats a file-layer value that
|
|
13
|
+
* equals the built-in default as unset so project configuration can still take
|
|
14
|
+
* effect, and uses authored-value equality with `projectConfig.output` to infer
|
|
15
|
+
* project-level directory provenance. This limitation is documented in
|
|
16
|
+
* `.ai/reports/CSSX-A10.md`.
|
|
17
|
+
*/
|
|
18
|
+
import type { ResolvedSetup } from "../types/options.js";
|
|
19
|
+
import type { PlanOutputsInput } from "../types/result.js";
|
|
20
|
+
/** Built-in output defaults from SPECIFICATION.md §9. */
|
|
21
|
+
export declare const OUTPUT_DEFAULTS: Readonly<{
|
|
22
|
+
readonly emitCss: boolean;
|
|
23
|
+
readonly emitMap: boolean;
|
|
24
|
+
readonly emitTypes: boolean;
|
|
25
|
+
readonly sourceMap: boolean;
|
|
26
|
+
readonly minify: boolean;
|
|
27
|
+
readonly mapInherit: boolean;
|
|
28
|
+
readonly importCss: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
/** Where a directory or filename came from, used to apply the correct base. */
|
|
31
|
+
export type SettingOrigin = "default" | "project" | "file" | "cli";
|
|
32
|
+
/** Effective names, directories and flags after precedence resolution. */
|
|
33
|
+
export interface ResolvedOutputSettings {
|
|
34
|
+
/** Absolute POSIX CSS output directory. */
|
|
35
|
+
readonly cssDir: string;
|
|
36
|
+
/**
|
|
37
|
+
* Absolute POSIX CSS destinations in authored order. A scalar input yields one
|
|
38
|
+
* entry identical to {@link cssDir}; a file `css-dir` list yields one per item
|
|
39
|
+
* (ADR-0019).
|
|
40
|
+
*/
|
|
41
|
+
readonly cssDirs: readonly string[];
|
|
42
|
+
/** Absolute POSIX JS map output directory. */
|
|
43
|
+
readonly mapDir: string;
|
|
44
|
+
/** Validated CSS basename. */
|
|
45
|
+
readonly cssName: string;
|
|
46
|
+
/** Validated JS map basename. */
|
|
47
|
+
readonly mapName: string;
|
|
48
|
+
/** Write the stylesheet. */
|
|
49
|
+
readonly emitCss: boolean;
|
|
50
|
+
/** Write the JS class map. */
|
|
51
|
+
readonly emitMap: boolean;
|
|
52
|
+
/** Write declarations beside the JS map. */
|
|
53
|
+
readonly emitTypes: boolean;
|
|
54
|
+
/** Write the CSS source map. */
|
|
55
|
+
readonly sourceMap: boolean;
|
|
56
|
+
/** Compact generated CSS whitespace. */
|
|
57
|
+
readonly minify: boolean;
|
|
58
|
+
}
|
|
59
|
+
/** Normalized source path used for all destination calculations. */
|
|
60
|
+
export interface ResolvedSource {
|
|
61
|
+
/** Workspace-relative POSIX source path. */
|
|
62
|
+
readonly relative: string;
|
|
63
|
+
/** Absolute POSIX source path. */
|
|
64
|
+
readonly absolute: string;
|
|
65
|
+
/** Absolute POSIX source directory. */
|
|
66
|
+
readonly directory: string;
|
|
67
|
+
/** Source basename without its final extension. */
|
|
68
|
+
readonly stem: string;
|
|
69
|
+
}
|
|
70
|
+
/** Resolve the workspace-relative and absolute forms of the entry source. */
|
|
71
|
+
export declare function resolveSource(input: PlanOutputsInput): ResolvedSource;
|
|
72
|
+
/** Default CSS and JS basenames for a source stem. */
|
|
73
|
+
export declare function defaultNames(stem: string): {
|
|
74
|
+
readonly cssName: string;
|
|
75
|
+
readonly mapName: string;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Apply defaults, project configuration, file setup and CLI overrides, then
|
|
79
|
+
* resolve all directories to absolute POSIX paths.
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveOutputSettings(input: PlanOutputsInput, source: ResolvedSource, workspaceRoot: string): ResolvedOutputSettings;
|
|
82
|
+
/**
|
|
83
|
+
* Derive a project source root from static prefixes in `include` patterns.
|
|
84
|
+
*
|
|
85
|
+
* `src/**\/*.cssx` yields `<workspace>/src`, so project output directories can
|
|
86
|
+
* mirror `pages/dashboard` instead of flattening or repeating `src`. When the
|
|
87
|
+
* include list has no common static prefix, the workspace root is used.
|
|
88
|
+
*/
|
|
89
|
+
export declare function sourceRootFor(workspaceRoot: string, include: readonly string[] | undefined, sourceAbsolute: string): string;
|
|
90
|
+
/** Derive the declaration basename from a map basename (`classes.js` → `classes.d.ts`). */
|
|
91
|
+
export declare function declarationNameFor(mapName: string): string;
|
|
92
|
+
/** Derive the CSS source-map basename (`theme.css` → `theme.css.map`). */
|
|
93
|
+
export declare function sourceMapNameFor(cssName: string): string;
|
|
94
|
+
/**
|
|
95
|
+
* Baseline settings shape used by callers and tests when a source has no file
|
|
96
|
+
* `@setup`. Directories point at the source directory so the planner sees the
|
|
97
|
+
* documented default rather than an accidental override.
|
|
98
|
+
*/
|
|
99
|
+
export declare function defaultSetupFor(file: string): ResolvedSetup;
|
|
100
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/output/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAa3D,yDAAyD;AACzD,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