@marko/compiler 5.31.1 → 5.32.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/config.d.ts CHANGED
@@ -10,7 +10,10 @@ declare const Config: {
10
10
  ignoreUnrecognizedTags?: boolean;
11
11
  sourceMaps?: boolean | "inline" | "both";
12
12
  translator?: any;
13
- fileSystem?: typeof import("fs");
13
+ fileSystem?: Pick<
14
+ typeof import("fs"),
15
+ "statSync" | "readFileSync" | "readdirSync"
16
+ >;
14
17
  modules?: "esm" | "cjs";
15
18
  resolveVirtualDependency?:
16
19
  | ((
@@ -391,7 +391,9 @@ function parseMarko(file) {
391
391
  const classShorthandValue =
392
392
  currentShorthandClassNames.length === 1 ?
393
393
  currentShorthandClassNames[0] :
394
- currentShorthandClassNames.every((expr) => t.isStringLiteral(expr)) ?
394
+ currentShorthandClassNames.every((expr) =>
395
+ t.isStringLiteral(expr)) ?
396
+
395
397
  withLoc(
396
398
  t.stringLiteral(
397
399
  currentShorthandClassNames.map((node) => node.value).join(" ")),
package/dist/types.d.ts CHANGED
@@ -42,7 +42,7 @@ interface BaseNode {
42
42
  extra?: Record<string, unknown>;
43
43
  }
44
44
 
45
- export type Node = Accessor | AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | Binary | BinaryExpression | BindExpression | Block | BlockParent | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | Class | ClassAccessorProperty | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | CompletionStatement | Conditional | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | Declaration | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBody | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | Expression | ExpressionStatement | ExpressionWrapper | File | Flow | FlowBaseAnnotation | FlowDeclaration | FlowPredicate | FlowType | For | ForInStatement | ForOfStatement | ForStatement | ForXStatement | Function | FunctionDeclaration | FunctionExpression | FunctionParent | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Immutable | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSX | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LVal | LabeledStatement | Literal | LogicalExpression | Loop | Marko | MarkoAttribute | MarkoCDATA | MarkoClass | MarkoComment | MarkoDeclaration | MarkoDocumentType | MarkoParseError | MarkoPlaceholder | MarkoScriptlet | MarkoSpreadAttribute | MarkoTag | MarkoTagBody | MarkoText | MemberExpression | MetaProperty | Method | Miscellaneous | MixedTypeAnnotation | ModuleDeclaration | ModuleExpression | ModuleSpecifier | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteral | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMember | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | Pattern | PatternLike | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | Private | PrivateName | Program | Property | Pureish | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RegexLiteral | RestElement | RestProperty | ReturnStatement | Scopable | Scope | SequenceExpression | SpreadElement | SpreadProperty | Standardized | Statement | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBaseType | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEntityName | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInstantiationExpression | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSSatisfiesExpression | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeElement | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | Terminatorless | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeScript | TypeofTypeAnnotation | UnaryExpression | UnaryLike | UnionTypeAnnotation | UpdateExpression | UserWhitespacable | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidTypeAnnotation | While | WhileStatement | WithStatement | YieldExpression;
45
+ export type Node = Accessor | AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | Binary | BinaryExpression | BindExpression | Block | BlockParent | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | Class | ClassAccessorProperty | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | CompletionStatement | Conditional | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | Declaration | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBody | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | Expression | ExpressionStatement | ExpressionWrapper | File | Flow | FlowBaseAnnotation | FlowDeclaration | FlowPredicate | FlowType | For | ForInStatement | ForOfStatement | ForStatement | ForXStatement | Function | FunctionDeclaration | FunctionExpression | FunctionParent | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Immutable | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportOrExportDeclaration | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSX | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LVal | LabeledStatement | Literal | LogicalExpression | Loop | Marko | MarkoAttribute | MarkoCDATA | MarkoClass | MarkoComment | MarkoDeclaration | MarkoDocumentType | MarkoParseError | MarkoPlaceholder | MarkoScriptlet | MarkoSpreadAttribute | MarkoTag | MarkoTagBody | MarkoText | MemberExpression | MetaProperty | Method | Miscellaneous | MixedTypeAnnotation | ModuleDeclaration | ModuleExpression | ModuleSpecifier | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteral | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMember | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | Pattern | PatternLike | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | Private | PrivateName | Program | Property | Pureish | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RegexLiteral | RestElement | RestProperty | ReturnStatement | Scopable | Scope | SequenceExpression | SpreadElement | SpreadProperty | Standardized | Statement | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBaseType | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEntityName | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInstantiationExpression | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSSatisfiesExpression | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeElement | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | Terminatorless | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeScript | TypeofTypeAnnotation | UnaryExpression | UnaryLike | UnionTypeAnnotation | UpdateExpression | UserWhitespacable | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidTypeAnnotation | While | WhileStatement | WithStatement | YieldExpression;
46
46
 
47
47
  export interface ArrayExpression extends BaseNode {
48
48
  type: "ArrayExpression";
@@ -356,7 +356,7 @@ export interface UpdateExpression extends BaseNode {
356
356
 
357
357
  export interface VariableDeclaration extends BaseNode {
358
358
  type: "VariableDeclaration";
359
- kind: "var" | "let" | "const" | "using";
359
+ kind: "var" | "let" | "const" | "using" | "await using";
360
360
  declarations: Array<VariableDeclarator>;
361
361
  declare: boolean | null;
362
362
  }
@@ -385,6 +385,7 @@ export interface AssignmentPattern extends BaseNode {
385
385
  left: Identifier | ObjectPattern | ArrayPattern | MemberExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression;
386
386
  right: Expression;
387
387
  decorators: Array<Decorator> | null;
388
+ optional: boolean | null;
388
389
  typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null;
389
390
  }
390
391
 
@@ -443,6 +444,7 @@ export interface ExportAllDeclaration extends BaseNode {
443
444
  type: "ExportAllDeclaration";
444
445
  source: StringLiteral;
445
446
  assertions: Array<ImportAttribute> | null;
447
+ attributes: Array<ImportAttribute> | null;
446
448
  exportKind: "type" | "value" | null;
447
449
  }
448
450
 
@@ -458,6 +460,7 @@ export interface ExportNamedDeclaration extends BaseNode {
458
460
  specifiers: Array<ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier>;
459
461
  source: StringLiteral | null;
460
462
  assertions: Array<ImportAttribute> | null;
463
+ attributes: Array<ImportAttribute> | null;
461
464
  exportKind: "type" | "value" | null;
462
465
  }
463
466
 
@@ -481,6 +484,7 @@ export interface ImportDeclaration extends BaseNode {
481
484
  specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
482
485
  source: StringLiteral;
483
486
  assertions: Array<ImportAttribute> | null;
487
+ attributes: Array<ImportAttribute> | null;
484
488
  importKind: "type" | "typeof" | "value" | null;
485
489
  module: boolean | null;
486
490
  }
@@ -532,6 +536,7 @@ export interface ObjectPattern extends BaseNode {
532
536
  type: "ObjectPattern";
533
537
  properties: Array<RestElement | ObjectProperty>;
534
538
  decorators: Array<Decorator> | null;
539
+ optional: boolean | null;
535
540
  typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null;
536
541
  }
537
542
 
@@ -733,8 +738,6 @@ export interface DeclareInterface extends BaseNode {
733
738
  typeParameters: TypeParameterDeclaration | null;
734
739
  extends: Array<InterfaceExtends> | null;
735
740
  body: ObjectTypeAnnotation;
736
- implements: Array<ClassImplements> | null;
737
- mixins: Array<InterfaceExtends> | null;
738
741
  }
739
742
 
740
743
  export interface DeclareModule extends BaseNode {
@@ -830,8 +833,6 @@ export interface InterfaceDeclaration extends BaseNode {
830
833
  typeParameters: TypeParameterDeclaration | null;
831
834
  extends: Array<InterfaceExtends> | null;
832
835
  body: ObjectTypeAnnotation;
833
- implements: Array<ClassImplements> | null;
834
- mixins: Array<InterfaceExtends> | null;
835
836
  }
836
837
 
837
838
  export interface InterfaceTypeAnnotation extends BaseNode {
@@ -1646,6 +1647,7 @@ export interface TSTypeParameter extends BaseNode {
1646
1647
  constraint: TSType | null;
1647
1648
  default: TSType | null;
1648
1649
  name: string;
1650
+ const: boolean | null;
1649
1651
  in: boolean | null;
1650
1652
  out: boolean | null;
1651
1653
  }
@@ -1781,7 +1783,7 @@ export type Property = ObjectProperty | ClassProperty | ClassAccessorProperty |
1781
1783
  export type UnaryLike = UnaryExpression | SpreadElement;
1782
1784
  export type Pattern = AssignmentPattern | ArrayPattern | ObjectPattern;
1783
1785
  export type Class = ClassExpression | ClassDeclaration;
1784
- export type ModuleDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration;
1786
+ export type ImportOrExportDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration;
1785
1787
  export type ExportDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration;
1786
1788
  export type ModuleSpecifier = ExportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | ExportNamespaceSpecifier | ExportDefaultSpecifier;
1787
1789
  export type Accessor = ClassAccessorProperty;
@@ -1799,6 +1801,7 @@ export type TypeScript = TSParameterProperty | TSDeclareFunction | TSDeclareMeth
1799
1801
  export type TSTypeElement = TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSPropertySignature | TSMethodSignature | TSIndexSignature;
1800
1802
  export type TSType = TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSFunctionType | TSConstructorType | TSTypeReference | TSTypePredicate | TSTypeQuery | TSTypeLiteral | TSArrayType | TSTupleType | TSOptionalType | TSRestType | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSParenthesizedType | TSTypeOperator | TSIndexedAccessType | TSMappedType | TSLiteralType | TSExpressionWithTypeArguments | TSImportType;
1801
1803
  export type TSBaseType = TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSLiteralType;
1804
+ export type ModuleDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration;
1802
1805
  export type Marko = MarkoParseError | MarkoDocumentType | MarkoDeclaration | MarkoCDATA | MarkoComment | MarkoText | MarkoPlaceholder | MarkoScriptlet | MarkoClass | MarkoAttribute | MarkoSpreadAttribute | MarkoTagBody | MarkoTag;
1803
1806
  export type Scope = MarkoTagBody;
1804
1807
 
@@ -1834,7 +1837,7 @@ export interface Aliases {
1834
1837
  UnaryLike: UnaryLike;
1835
1838
  Pattern: Pattern;
1836
1839
  Class: Class;
1837
- ModuleDeclaration: ModuleDeclaration;
1840
+ ImportOrExportDeclaration: ImportOrExportDeclaration;
1838
1841
  ExportDeclaration: ExportDeclaration;
1839
1842
  ModuleSpecifier: ModuleSpecifier;
1840
1843
  Accessor: Accessor;
@@ -1852,6 +1855,7 @@ export interface Aliases {
1852
1855
  TSTypeElement: TSTypeElement;
1853
1856
  TSType: TSType;
1854
1857
  TSBaseType: TSBaseType;
1858
+ ModuleDeclaration: ModuleDeclaration;
1855
1859
  Marko: Marko;
1856
1860
  Scope: Scope;
1857
1861
  }
@@ -1903,7 +1907,7 @@ export function throwStatement(argument: Expression): ThrowStatement;
1903
1907
  export function tryStatement(block: BlockStatement, handler?: CatchClause | null, finalizer?: BlockStatement | null): TryStatement;
1904
1908
  export function unaryExpression(operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof", argument: Expression, prefix?: boolean): UnaryExpression;
1905
1909
  export function updateExpression(operator: "++" | "--", argument: Expression, prefix?: boolean): UpdateExpression;
1906
- export function variableDeclaration(kind: "var" | "let" | "const" | "using", declarations: Array<VariableDeclarator>): VariableDeclaration;
1910
+ export function variableDeclaration(kind: "var" | "let" | "const" | "using" | "await using", declarations: Array<VariableDeclarator>): VariableDeclaration;
1907
1911
  export function variableDeclarator(id: LVal, init?: Expression | null): VariableDeclarator;
1908
1912
  export function whileStatement(test: Expression, body: Statement): WhileStatement;
1909
1913
  export function withStatement(object: Expression, body: Statement): WithStatement;
@@ -2332,6 +2336,8 @@ export function isImportDefaultSpecifier(node: object | null | undefined, opts?:
2332
2336
  export function assertImportDefaultSpecifier(node: object | null | undefined, opts?: object | null): void;
2333
2337
  export function isImportNamespaceSpecifier(node: object | null | undefined, opts?: object | null): node is ImportNamespaceSpecifier;
2334
2338
  export function assertImportNamespaceSpecifier(node: object | null | undefined, opts?: object | null): void;
2339
+ export function isImportOrExportDeclaration(node: object | null | undefined, opts?: object | null): node is ImportOrExportDeclaration;
2340
+ export function assertImportOrExportDeclaration(node: object | null | undefined, opts?: object | null): void;
2335
2341
  export function isImportSpecifier(node: object | null | undefined, opts?: object | null): node is ImportSpecifier;
2336
2342
  export function assertImportSpecifier(node: object | null | undefined, opts?: object | null): void;
2337
2343
  export function isIndexedAccessType(node: object | null | undefined, opts?: object | null): node is IndexedAccessType;
package/index.d.ts CHANGED
@@ -1,36 +1,40 @@
1
1
  import { SourceMap } from "magic-string";
2
- import { TaglibLookup, Diagnostic } from "@marko/babel-utils";
2
+ import { Diagnostic, TaglibLookup } from "@marko/babel-utils";
3
3
  import * as types from "./babel-types";
4
4
  export { types };
5
5
 
6
- export type Config = typeof import("./config");
6
+ type _Config = typeof import("./config");
7
+ export interface Config extends _Config {}
8
+ interface Dep {
9
+ type: string;
10
+ path: string;
11
+ [x: string]: unknown;
12
+ }
7
13
 
8
- type Dep = {
14
+ interface VirtualDep {
9
15
  type: string;
10
16
  code: string;
11
- path: string;
17
+ virtualPath: string;
12
18
  startPos?: number;
13
19
  endPos?: number;
14
- require?: boolean;
15
- virtualPath?: string;
16
20
  [x: string]: unknown;
17
- };
21
+ }
18
22
 
19
- export type MarkoMeta = {
23
+ export interface MarkoMeta {
20
24
  id: string;
21
25
  component?: string;
22
26
  watchFiles: string[];
23
27
  tags?: string[];
24
- deps: Array<string | Dep>;
28
+ deps: Array<string | Dep | VirtualDep>;
25
29
  diagnostics: Diagnostic[];
26
- };
30
+ }
27
31
 
28
- export type CompileResult = {
32
+ export interface CompileResult {
29
33
  ast: types.File;
30
34
  code: string;
31
35
  map: SourceMap;
32
36
  meta: MarkoMeta;
33
- };
37
+ }
34
38
 
35
39
  export function configure(config: Config): void;
36
40
 
package/package.json CHANGED
@@ -1,9 +1,39 @@
1
1
  {
2
2
  "name": "@marko/compiler",
3
+ "version": "5.32.0",
3
4
  "description": "Marko template to JS compiler.",
4
- "version": "5.31.1",
5
- "author": "Dylan Piercey <dpiercey@ebay.com>",
5
+ "keywords": [
6
+ "babel",
7
+ "htmljs",
8
+ "marko",
9
+ "parse",
10
+ "parser",
11
+ "plugin"
12
+ ],
13
+ "homepage": "https://github.com/marko-js/marko/blob/main/packages/marko/docs/compiler.md",
6
14
  "bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/marko-js/marko/tree/master/packages/compiler"
18
+ },
19
+ "license": "MIT",
20
+ "author": "Dylan Piercey <dpiercey@ebay.com>",
21
+ "main": "dist/index.js",
22
+ "types": "index.d.ts",
23
+ "files": [
24
+ "dist",
25
+ "config.js",
26
+ "config.d.ts",
27
+ "modules.js",
28
+ "index.d.ts",
29
+ "babel-types.d.ts",
30
+ "register.js",
31
+ "register.d.ts"
32
+ ],
33
+ "scripts": {
34
+ "build": "babel ./src --out-dir ./dist --delete-dir-on-start --copy-files --config-file ../../babel.config.js --env-name=production",
35
+ "build:types": "node scripts/types-babel-types.mjs > ./dist/types.d.ts && node scripts/types-babel-traverse.js > ./dist/traverse.d.ts"
36
+ },
7
37
  "dependencies": {
8
38
  "@babel/code-frame": "^7.16.0",
9
39
  "@babel/core": "^7.16.0",
@@ -15,7 +45,7 @@
15
45
  "@babel/runtime": "^7.16.0",
16
46
  "@babel/traverse": "^7.16.0",
17
47
  "@babel/types": "^7.16.0",
18
- "@marko/babel-utils": "^6.2.0",
48
+ "@marko/babel-utils": "^6.3.0",
19
49
  "complain": "^1.6.0",
20
50
  "he": "^1.2.0",
21
51
  "htmljs-parser": "^5.4.3",
@@ -31,37 +61,11 @@
31
61
  "strip-json-comments": "^3.1.1"
32
62
  },
33
63
  "devDependencies": {
34
- "@marko/translator-default": "^5.29.1"
64
+ "@marko/translator-default": "^5.30.0"
35
65
  },
36
- "files": [
37
- "dist",
38
- "config.js",
39
- "config.d.ts",
40
- "modules.js",
41
- "index.d.ts",
42
- "babel-types.d.ts",
43
- "register.js",
44
- "register.d.ts"
45
- ],
46
- "homepage": "https://github.com/marko-js/marko/blob/main/packages/marko/docs/compiler.md",
47
- "keywords": [
48
- "babel",
49
- "htmljs",
50
- "marko",
51
- "parse",
52
- "parser",
53
- "plugin"
54
- ],
55
- "license": "MIT",
56
- "main": "dist/index.js",
57
- "main:dev": "src/index.js",
58
- "main:npm": "dist/index.js",
59
66
  "publishConfig": {
60
67
  "access": "public"
61
68
  },
62
- "repository": {
63
- "type": "git",
64
- "url": "https://github.com/marko-js/marko/tree/master/packages/compiler"
65
- },
66
- "types": "index.d.ts"
69
+ "main:dev": "src/index.js",
70
+ "main:npm": "dist/index.js"
67
71
  }