@terrazzo/parser 0.7.2 → 0.8.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/index.d.ts +707 -12
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +4598 -12
  5. package/dist/index.js.map +1 -1
  6. package/package.json +11 -7
  7. package/rolldown.config.ts +24 -0
  8. package/src/build/index.ts +2 -2
  9. package/src/index.ts +76 -1
  10. package/src/parse/index.ts +72 -13
  11. package/src/parse/json.ts +35 -29
  12. package/src/parse/normalize.ts +4 -14
  13. package/src/parse/validate.ts +81 -68
  14. package/dist/build/index.d.ts +0 -20
  15. package/dist/build/index.d.ts.map +0 -1
  16. package/dist/build/index.js +0 -166
  17. package/dist/build/index.js.map +0 -1
  18. package/dist/config.d.ts +0 -8
  19. package/dist/config.d.ts.map +0 -1
  20. package/dist/config.js +0 -290
  21. package/dist/config.js.map +0 -1
  22. package/dist/lib/code-frame.d.ts +0 -31
  23. package/dist/lib/code-frame.d.ts.map +0 -1
  24. package/dist/lib/code-frame.js +0 -108
  25. package/dist/lib/code-frame.js.map +0 -1
  26. package/dist/lint/index.d.ts +0 -12
  27. package/dist/lint/index.d.ts.map +0 -1
  28. package/dist/lint/index.js +0 -105
  29. package/dist/lint/index.js.map +0 -1
  30. package/dist/lint/plugin-core/index.d.ts +0 -13
  31. package/dist/lint/plugin-core/index.d.ts.map +0 -1
  32. package/dist/lint/plugin-core/index.js +0 -40
  33. package/dist/lint/plugin-core/index.js.map +0 -1
  34. package/dist/lint/plugin-core/lib/docs.d.ts +0 -2
  35. package/dist/lint/plugin-core/lib/docs.d.ts.map +0 -1
  36. package/dist/lint/plugin-core/lib/docs.js +0 -4
  37. package/dist/lint/plugin-core/lib/docs.js.map +0 -1
  38. package/dist/lint/plugin-core/rules/a11y-min-contrast.d.ts +0 -40
  39. package/dist/lint/plugin-core/rules/a11y-min-contrast.d.ts.map +0 -1
  40. package/dist/lint/plugin-core/rules/a11y-min-contrast.js +0 -58
  41. package/dist/lint/plugin-core/rules/a11y-min-contrast.js.map +0 -1
  42. package/dist/lint/plugin-core/rules/a11y-min-font-size.d.ts +0 -14
  43. package/dist/lint/plugin-core/rules/a11y-min-font-size.d.ts.map +0 -1
  44. package/dist/lint/plugin-core/rules/a11y-min-font-size.js +0 -45
  45. package/dist/lint/plugin-core/rules/a11y-min-font-size.js.map +0 -1
  46. package/dist/lint/plugin-core/rules/colorspace.d.ts +0 -15
  47. package/dist/lint/plugin-core/rules/colorspace.d.ts.map +0 -1
  48. package/dist/lint/plugin-core/rules/colorspace.js +0 -85
  49. package/dist/lint/plugin-core/rules/colorspace.js.map +0 -1
  50. package/dist/lint/plugin-core/rules/consistent-naming.d.ts +0 -12
  51. package/dist/lint/plugin-core/rules/consistent-naming.d.ts.map +0 -1
  52. package/dist/lint/plugin-core/rules/consistent-naming.js +0 -49
  53. package/dist/lint/plugin-core/rules/consistent-naming.js.map +0 -1
  54. package/dist/lint/plugin-core/rules/descriptions.d.ts +0 -10
  55. package/dist/lint/plugin-core/rules/descriptions.d.ts.map +0 -1
  56. package/dist/lint/plugin-core/rules/descriptions.js +0 -32
  57. package/dist/lint/plugin-core/rules/descriptions.js.map +0 -1
  58. package/dist/lint/plugin-core/rules/duplicate-values.d.ts +0 -10
  59. package/dist/lint/plugin-core/rules/duplicate-values.d.ts.map +0 -1
  60. package/dist/lint/plugin-core/rules/duplicate-values.js +0 -65
  61. package/dist/lint/plugin-core/rules/duplicate-values.js.map +0 -1
  62. package/dist/lint/plugin-core/rules/max-gamut.d.ts +0 -15
  63. package/dist/lint/plugin-core/rules/max-gamut.d.ts.map +0 -1
  64. package/dist/lint/plugin-core/rules/max-gamut.js +0 -101
  65. package/dist/lint/plugin-core/rules/max-gamut.js.map +0 -1
  66. package/dist/lint/plugin-core/rules/required-children.d.ts +0 -19
  67. package/dist/lint/plugin-core/rules/required-children.d.ts.map +0 -1
  68. package/dist/lint/plugin-core/rules/required-children.js +0 -78
  69. package/dist/lint/plugin-core/rules/required-children.js.map +0 -1
  70. package/dist/lint/plugin-core/rules/required-modes.d.ts +0 -14
  71. package/dist/lint/plugin-core/rules/required-modes.d.ts.map +0 -1
  72. package/dist/lint/plugin-core/rules/required-modes.js +0 -52
  73. package/dist/lint/plugin-core/rules/required-modes.js.map +0 -1
  74. package/dist/lint/plugin-core/rules/required-typography-properties.d.ts +0 -11
  75. package/dist/lint/plugin-core/rules/required-typography-properties.d.ts.map +0 -1
  76. package/dist/lint/plugin-core/rules/required-typography-properties.js +0 -38
  77. package/dist/lint/plugin-core/rules/required-typography-properties.js.map +0 -1
  78. package/dist/logger.d.ts +0 -77
  79. package/dist/logger.d.ts.map +0 -1
  80. package/dist/logger.js +0 -136
  81. package/dist/logger.js.map +0 -1
  82. package/dist/parse/alias.d.ts +0 -34
  83. package/dist/parse/alias.d.ts.map +0 -1
  84. package/dist/parse/alias.js +0 -302
  85. package/dist/parse/alias.js.map +0 -1
  86. package/dist/parse/index.d.ts +0 -36
  87. package/dist/parse/index.d.ts.map +0 -1
  88. package/dist/parse/index.js +0 -226
  89. package/dist/parse/index.js.map +0 -1
  90. package/dist/parse/json.d.ts +0 -52
  91. package/dist/parse/json.d.ts.map +0 -1
  92. package/dist/parse/json.js +0 -161
  93. package/dist/parse/json.js.map +0 -1
  94. package/dist/parse/normalize.d.ts +0 -24
  95. package/dist/parse/normalize.d.ts.map +0 -1
  96. package/dist/parse/normalize.js +0 -185
  97. package/dist/parse/normalize.js.map +0 -1
  98. package/dist/parse/validate.d.ts +0 -63
  99. package/dist/parse/validate.d.ts.map +0 -1
  100. package/dist/parse/validate.js +0 -798
  101. package/dist/parse/validate.js.map +0 -1
  102. package/dist/types.d.ts +0 -265
  103. package/dist/types.d.ts.map +0 -1
  104. package/dist/types.js +0 -2
  105. package/dist/types.js.map +0 -1
@@ -20,6 +20,29 @@ export interface ValidateOptions {
20
20
  logger: Logger;
21
21
  }
22
22
 
23
+ export interface Visitors {
24
+ color?: Visitor;
25
+ dimension?: Visitor;
26
+ fontFamily?: Visitor;
27
+ fontWeight?: Visitor;
28
+ duration?: Visitor;
29
+ cubicBezier?: Visitor;
30
+ number?: Visitor;
31
+ link?: Visitor;
32
+ boolean?: Visitor;
33
+ strokeStyle?: Visitor;
34
+ border?: Visitor;
35
+ transition?: Visitor;
36
+ shadow?: Visitor;
37
+ gradient?: Visitor;
38
+ typography?: Visitor;
39
+ root?: Visitor;
40
+ group?: Visitor;
41
+ [key: string]: Visitor | undefined;
42
+ }
43
+
44
+ export type Visitor = (json: any, path: string, ast: AnyNode) => any | undefined | null;
45
+
23
46
  export const VALID_COLORSPACES = new Set([
24
47
  'adobe-rgb',
25
48
  'display-p3',
@@ -587,10 +610,7 @@ export function validateTokenMemberNode(node: MemberNode, { filename, src, logge
587
610
  if (node.type !== 'Member' && node.type !== 'Object') {
588
611
  logger.error({
589
612
  ...baseMessage,
590
- message: `Expected Object, received ${JSON.stringify(
591
- // @ts-ignore Yes, TypeScript, this SHOULD be unexpected. This is why we’re validating.
592
- node.type,
593
- )}`,
613
+ message: `Expected Object, received ${JSON.stringify(node.type)}`,
594
614
  });
595
615
  }
596
616
 
@@ -748,14 +768,48 @@ export function validateTokenMemberNode(node: MemberNode, { filename, src, logge
748
768
  }
749
769
  }
750
770
 
771
+ /** Return any token node with its inherited $type */
772
+ export function getInheritedType(
773
+ node: MemberNode,
774
+ { subpath, $typeInheritance }: { subpath: string[]; $typeInheritance?: Record<string, MemberNode> },
775
+ ): MemberNode | undefined {
776
+ if (node.value.type !== 'Object') {
777
+ return;
778
+ }
779
+
780
+ // keep track of $types
781
+ const $type = node.value.members.find((m) => m.name.type === 'String' && m.name.value === '$type');
782
+ const $value = node.value.members.find((m) => m.name.type === 'String' && m.name.value === '$value');
783
+ if ($typeInheritance && $type && !$value) {
784
+ $typeInheritance[subpath.join('.') || '.'] = $type;
785
+ }
786
+
787
+ const id = subpath.join('.');
788
+
789
+ // get parent type by taking the closest-scoped $type (length === closer)
790
+ let parent$type: MemberNode | undefined;
791
+ let longestPath = '';
792
+ for (const [k, v] of Object.entries($typeInheritance ?? {})) {
793
+ if (k === '.' || id.startsWith(k)) {
794
+ if (k.length > longestPath.length) {
795
+ parent$type = v;
796
+ longestPath = k;
797
+ }
798
+ }
799
+ }
800
+
801
+ return parent$type;
802
+ }
803
+
751
804
  export interface ValidateTokenNodeOptions {
752
805
  subpath: string[];
753
806
  src: string;
754
807
  filename: URL;
755
808
  config: ConfigInit;
756
809
  logger: Logger;
757
- parent?: AnyNode;
758
- $typeInheritance?: Record<string, Token['$type']>;
810
+ parent: AnyNode | undefined;
811
+ transform?: Visitors;
812
+ inheritedTypeNode?: MemberNode;
759
813
  }
760
814
 
761
815
  /**
@@ -765,10 +819,8 @@ export interface ValidateTokenNodeOptions {
765
819
  */
766
820
  export default function validateTokenNode(
767
821
  node: MemberNode,
768
- { config, filename, logger, parent, src, subpath, $typeInheritance }: ValidateTokenNodeOptions,
822
+ { config, filename, logger, parent, inheritedTypeNode, src, subpath }: ValidateTokenNodeOptions,
769
823
  ): TokenNormalized | undefined {
770
- // const start = performance.now();
771
-
772
824
  // don’t validate $value
773
825
  if (subpath.includes('$value') || node.value.type !== 'Object') {
774
826
  return;
@@ -776,12 +828,6 @@ export default function validateTokenNode(
776
828
 
777
829
  const members = getObjMembers(node.value);
778
830
 
779
- // keep track of $types
780
- if ($typeInheritance && members.$type && members.$type.type === 'String' && !members.$value) {
781
- // @ts-ignore
782
- $typeInheritance[subpath.join('.') || '.'] = node.value.members.find((m) => m.name.value === '$type');
783
- }
784
-
785
831
  // don’t validate $extensions or $defs
786
832
  if (!members.$value || subpath.includes('$extensions') || subpath.includes('$deps')) {
787
833
  return;
@@ -800,29 +846,13 @@ export default function validateTokenNode(
800
846
  });
801
847
  }
802
848
 
803
- const extensions = members.$extensions ? getObjMembers(members.$extensions as ObjectNode) : undefined;
804
- const sourceNode = structuredClone(node);
805
-
806
- // get parent type by taking the closest-scoped $type (length === closer)
807
- let parent$type: Token['$type'] | undefined;
808
- let longestPath = '';
809
- for (const [k, v] of Object.entries($typeInheritance ?? {})) {
810
- if (k === '.' || id.startsWith(k)) {
811
- if (k.length > longestPath.length) {
812
- parent$type = v;
813
- longestPath = k;
814
- }
815
- }
816
- }
817
- if (parent$type && !members.$type) {
818
- injectObjMembers(
819
- // @ts-ignore
820
- sourceNode.value,
821
- [parent$type],
822
- );
849
+ const nodeWithType = structuredClone(node);
850
+ let $type = (members.$type?.type === 'String' && members.$type.value) || undefined;
851
+ if (inheritedTypeNode && !members.$type) {
852
+ injectObjMembers(nodeWithType.value as ObjectNode, [inheritedTypeNode]);
853
+ $type = (inheritedTypeNode.value as StringNode).value;
823
854
  }
824
-
825
- validateTokenMemberNode(sourceNode, { filename, src, logger });
855
+ validateTokenMemberNode(nodeWithType, { filename, src, logger });
826
856
 
827
857
  // All tokens must be valid, so we want to validate it up till this
828
858
  // point. However, if we are ignoring this token (or respecting
@@ -833,47 +863,37 @@ export default function validateTokenNode(
833
863
  }
834
864
 
835
865
  const group: TokenNormalized['group'] = { id: splitID(id).group!, tokens: [] };
836
- if (parent$type) {
837
- group.$type =
838
- // @ts-ignore
839
- parent$type.value.value;
866
+ if (inheritedTypeNode && inheritedTypeNode.value.type === 'String') {
867
+ group.$type = inheritedTypeNode.value.value as Token['$type'];
840
868
  }
841
869
  // note: this will also include sibling tokens, so be selective about only accessing group-specific properties
842
- const groupMembers = getObjMembers(
843
- // @ts-ignore
844
- parent,
845
- );
870
+ const groupMembers = getObjMembers(parent as ObjectNode);
846
871
  if (groupMembers.$description) {
847
872
  group.$description = evaluate(groupMembers.$description) as string;
848
873
  }
849
874
  if (groupMembers.$extensions) {
850
875
  group.$extensions = evaluate(groupMembers.$extensions) as Record<string, unknown>;
851
876
  }
852
- const token: TokenNormalized = {
853
- // @ts-ignore
854
- $type: members.$type?.value ?? parent$type?.value.value,
855
- // @ts-ignore
856
- $value: evaluate(members.$value),
877
+ const $value = evaluate(members.$value!);
878
+ const token = {
879
+ $type,
880
+ $value,
857
881
  id,
858
- // @ts-ignore
859
882
  mode: {},
860
- // @ts-ignore
861
883
  originalValue: evaluate(node.value),
862
884
  group,
863
885
  source: {
864
- loc: filename ? filename.href : undefined,
865
- // @ts-ignore
866
- node: sourceNode.value,
886
+ loc: filename?.href,
887
+ node: nodeWithType.value as ObjectNode,
867
888
  },
868
- };
869
- // @ts-ignore
870
- if (members.$description?.value) {
871
- // @ts-ignore
889
+ } as unknown as TokenNormalized;
890
+ if (members.$description?.type === 'String' && members.$description.value) {
872
891
  token.$description = members.$description.value;
873
892
  }
874
893
 
875
894
  // handle modes
876
895
  // note that circular refs are avoided here, such as not duplicating `modes`
896
+ const extensions = members.$extensions ? getObjMembers(members.$extensions as ObjectNode) : undefined;
877
897
  const modeValues = extensions?.mode ? getObjMembers(extensions.mode as any) : {};
878
898
  for (const mode of ['.', ...Object.keys(modeValues)]) {
879
899
  const modeValue = mode === '.' ? token.$value : (evaluate((modeValues as any)[mode]) as any);
@@ -881,18 +901,11 @@ export default function validateTokenNode(
881
901
  $value: modeValue,
882
902
  originalValue: modeValue,
883
903
  source: {
884
- loc: filename ? filename.href : undefined,
885
- // @ts-ignore
886
- node: modeValues[mode],
904
+ loc: filename?.href,
905
+ node: modeValues[mode] as ObjectNode,
887
906
  },
888
907
  };
889
908
  }
890
909
 
891
- // logger.debug({
892
- // message: `${token.id}: validateTokenNode`,
893
- // group: 'parser', label: 'validate',
894
- // label: 'validate',
895
- // timing: performance.now() - start,
896
- // });
897
910
  return token;
898
911
  }
@@ -1,20 +0,0 @@
1
- import type { DocumentNode } from '@humanwhocodes/momoa';
2
- import { type TokenNormalized } from '@terrazzo/token-tools';
3
- import Logger from '../logger.js';
4
- import type { BuildRunnerResult, ConfigInit } from '../types.js';
5
- export interface BuildRunnerOptions {
6
- sources: {
7
- filename?: URL;
8
- src: string;
9
- document: DocumentNode;
10
- }[];
11
- config: ConfigInit;
12
- logger?: Logger;
13
- }
14
- export declare const SINGLE_VALUE = "SINGLE_VALUE";
15
- export declare const MULTI_VALUE = "MULTI_VALUE";
16
- /**
17
- * Run build stage
18
- */
19
- export default function build(tokens: Record<string, TokenNormalized>, { sources, logger, config }: BuildRunnerOptions): Promise<BuildRunnerResult>;
20
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/build/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,KAAK,eAAe,EAAgB,MAAM,uBAAuB,CAAC;AAE3E,OAAO,MAAyB,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAqC,MAAM,aAAa,CAAC;AAEpG,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE;QAAE,QAAQ,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,EAAE,CAAC;IACnE,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,WAAW,gBAAgB,CAAC;AA+BzC;;GAEG;AACH,wBAA8B,KAAK,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EACvC,EAAE,OAAO,EAAE,MAAqB,EAAE,MAAM,EAAE,EAAE,kBAAkB,8BAsJ/D"}
@@ -1,166 +0,0 @@
1
- import { isTokenMatch } from '@terrazzo/token-tools';
2
- import wcmatch from 'wildcard-match';
3
- import Logger from '../logger.js';
4
- export const SINGLE_VALUE = 'SINGLE_VALUE';
5
- export const MULTI_VALUE = 'MULTI_VALUE';
6
- /** Validate plugin setTransform() calls for immediate feedback */
7
- function validateTransformParams({ params, logger, pluginName, }) {
8
- const baseMessage = { group: 'plugin', label: pluginName, message: '' };
9
- // validate value is valid for SINGLE_VALUE or MULTI_VALUE
10
- if (!params.value ||
11
- (typeof params.value !== 'string' && typeof params.value !== 'object') ||
12
- Array.isArray(params.value)) {
13
- logger.error({
14
- ...baseMessage,
15
- message: `setTransform() value expected string or object of strings, received ${Array.isArray(params.value) ? 'Array' : typeof params.value}`,
16
- });
17
- }
18
- if (typeof params.value === 'object' && Object.values(params.value).some((v) => typeof v !== 'string')) {
19
- logger.error({
20
- ...baseMessage,
21
- message: 'setTransform() value expected object of strings, received some non-string values',
22
- });
23
- }
24
- }
25
- /**
26
- * Run build stage
27
- */
28
- export default async function build(tokens, { sources, logger = new Logger(), config }) {
29
- const formats = {};
30
- const result = { outputFiles: [] };
31
- function getTransforms(params) {
32
- return (formats[params.format] ?? []).filter((token) => {
33
- if (params.$type) {
34
- if (typeof params.$type === 'string' && token.token.$type !== params.$type) {
35
- return false;
36
- }
37
- else if (Array.isArray(params.$type) && !params.$type.some(($type) => token.token.$type === $type)) {
38
- return false;
39
- }
40
- }
41
- if (params.id &&
42
- params.id !== '*' &&
43
- !isTokenMatch(token.token.id, Array.isArray(params.id) ? params.id : [params.id])) {
44
- return false;
45
- }
46
- if (params.mode && !wcmatch(params.mode)(token.mode)) {
47
- return false;
48
- }
49
- return true;
50
- });
51
- }
52
- // transform()
53
- let transformsLocked = false; // prevent plugins from transforming after stage has ended
54
- const startTransform = performance.now();
55
- for (const plugin of config.plugins) {
56
- if (typeof plugin.transform === 'function') {
57
- await plugin.transform({
58
- tokens,
59
- sources,
60
- getTransforms,
61
- setTransform(id, params) {
62
- if (transformsLocked) {
63
- logger.warn({
64
- message: 'Attempted to call setTransform() after transform step has completed.',
65
- group: 'plugin',
66
- label: plugin.name,
67
- });
68
- return;
69
- }
70
- const token = tokens[id];
71
- // allow `undefined` values, but remove them here
72
- const cleanValue = typeof params.value === 'string' ? params.value : { ...params.value };
73
- if (typeof cleanValue === 'object') {
74
- for (const k of Object.keys(cleanValue)) {
75
- if (cleanValue[k] === undefined) {
76
- delete cleanValue[k];
77
- }
78
- }
79
- }
80
- validateTransformParams({
81
- logger,
82
- params: { ...params, value: cleanValue },
83
- pluginName: plugin.name,
84
- });
85
- // upsert
86
- if (!formats[params.format]) {
87
- formats[params.format] = [];
88
- }
89
- const foundTokenI = formats[params.format].findIndex((t) => id === t.id &&
90
- (!params.localID || params.localID === t.localID) &&
91
- (!params.mode || params.mode === t.mode));
92
- if (foundTokenI === -1) {
93
- formats[params.format].push({
94
- ...params,
95
- id,
96
- value: cleanValue,
97
- type: typeof cleanValue === 'string' ? SINGLE_VALUE : MULTI_VALUE,
98
- mode: params.mode || '.',
99
- token: structuredClone(token),
100
- });
101
- }
102
- else {
103
- formats[params.format][foundTokenI].value = cleanValue;
104
- formats[params.format][foundTokenI].type = typeof cleanValue === 'string' ? SINGLE_VALUE : MULTI_VALUE;
105
- }
106
- },
107
- });
108
- }
109
- }
110
- transformsLocked = true;
111
- logger.debug({
112
- group: 'parser',
113
- label: 'transform',
114
- message: 'transform() step',
115
- timing: performance.now() - startTransform,
116
- });
117
- // build()
118
- const startBuild = performance.now();
119
- for (const plugin of config.plugins) {
120
- if (typeof plugin.build === 'function') {
121
- const pluginBuildStart = performance.now();
122
- await plugin.build({
123
- tokens,
124
- sources,
125
- getTransforms,
126
- outputFile(filename, contents) {
127
- const resolved = new URL(filename, config.outDir);
128
- if (result.outputFiles.some((f) => new URL(f.filename, config.outDir).href === resolved.href)) {
129
- logger.error({
130
- group: 'plugin',
131
- message: `Can’t overwrite file "${filename}"`,
132
- label: plugin.name,
133
- });
134
- }
135
- result.outputFiles.push({
136
- filename,
137
- contents,
138
- plugin: plugin.name,
139
- time: performance.now() - pluginBuildStart,
140
- });
141
- },
142
- });
143
- }
144
- }
145
- logger.debug({
146
- group: 'parser',
147
- label: 'build',
148
- message: 'build() step',
149
- timing: performance.now() - startBuild,
150
- });
151
- // buildEnd()
152
- const startBuildEnd = performance.now();
153
- for (const plugin of config.plugins) {
154
- if (typeof plugin.buildEnd === 'function') {
155
- await plugin.buildEnd({ outputFiles: structuredClone(result.outputFiles) });
156
- }
157
- }
158
- logger.debug({
159
- group: 'parser',
160
- label: 'build',
161
- message: 'buildEnd() step',
162
- timing: performance.now() - startBuildEnd,
163
- });
164
- return result;
165
- }
166
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/build/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,MAAyB,MAAM,cAAc,CAAC;AASrD,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAC3C,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AAEzC,kEAAkE;AAClE,SAAS,uBAAuB,CAAC,EAC/B,MAAM,EACN,MAAM,EACN,UAAU,GACuD;IACjE,MAAM,WAAW,GAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAElF,0DAA0D;IAC1D,IACE,CAAC,MAAM,CAAC,KAAK;QACb,CAAC,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAC;QACtE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAC3B,CAAC;QACD,MAAM,CAAC,KAAK,CAAC;YACX,GAAG,WAAW;YACd,OAAO,EAAE,uEACP,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,KACxD,EAAE;SACH,CAAC,CAAC;IACL,CAAC;IACD,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC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ACf,OAAO,EAAE,yBAAyB,QAAQ,GAAG;4BAC7C,KAAK,EAAE,MAAM,CAAC,IAAI;yBACnB,CAAC,CAAC;oBACL,CAAC;oBACD,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;wBACtB,QAAQ;wBACR,QAAQ;wBACR,MAAM,EAAE,MAAM,CAAC,IAAI;wBACnB,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,gBAAgB;qBAC3C,CAAC,CAAC;gBACL,CAAC;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,MAAM,CAAC,KAAK,CAAC;QACX,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,UAAU;KACvC,CAAC,CAAC;IAEH,aAAa;IACb,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IACxC,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;YAC1C,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC9E,CAAC;IACH,CAAC;IACD,MAAM,CAAC,KAAK,CAAC;QACX,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,iBAAiB;QAC1B,MAAM,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,aAAa;KAC1C,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/config.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import type { Config, ConfigInit, ConfigOptions } from './types.js';
2
- /**
3
- * Validate and normalize a config
4
- */
5
- export default function defineConfig(rawConfig: Config, { logger, cwd }?: ConfigOptions): ConfigInit;
6
- /** Merge configs */
7
- export declare function mergeConfigs(a: Config, b: Config): Config;
8
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAoB,MAAM,YAAY,CAAC;AAItF;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,SAAS,EAAE,MAAM,EACjB,EAAE,MAAqB,EAAE,GAAG,EAAE,GAAE,aAAmC,GAClE,UAAU,CA6BZ;AA8PD,oBAAoB;AACpB,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzD"}