@marko/compiler 5.34.6 → 5.35.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/babel-types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* eslint-disable import/export */
1
+ /* eslint-disable import/export, import/no-unresolved */
2
2
  import { Scope } from "./dist/traverse";
3
3
  export * from "./dist/types";
4
4
  export * from "./dist/traverse";
package/dist/register.js CHANGED
@@ -4,9 +4,8 @@ const shouldOptimize = require("./util/should-optimize").default;
4
4
  const compiler = require(".");
5
5
  const requiredOptions = { modules: "cjs" };
6
6
  const isDev = !shouldOptimize();
7
- const sourceMaps = new Map();
8
- let installSourceMaps = () => {
9
- installSourceMaps = () => {};
7
+ let setSourceMap = (filename, map) => {
8
+ const sourceMaps = new Map([[filename, map]]);
10
9
  require("source-map-support").install({
11
10
  handleUncaughtExceptions: false,
12
11
  environment: "node",
@@ -18,6 +17,10 @@ let installSourceMaps = () => {
18
17
  return null;
19
18
  }
20
19
  });
20
+
21
+ setSourceMap = (filename, map) => {
22
+ sourceMaps.set(filename, map);
23
+ };
21
24
  };
22
25
 
23
26
  module.exports = register;
@@ -40,8 +43,7 @@ function register({ extensions = require.extensions, ...options } = {}) {
40
43
  );
41
44
 
42
45
  if (compiled.map) {
43
- sourceMaps.set(filename, compiled.map);
44
- installSourceMaps();
46
+ setSourceMap(filename, compiled.map);
45
47
  }
46
48
 
47
49
  return module._compile(compiled.code, filename);
package/dist/types.d.ts CHANGED
@@ -31,6 +31,10 @@ export interface SourceLocation {
31
31
  };
32
32
  }
33
33
 
34
+ export interface NodeExtra {
35
+ [key: string]: unknown;
36
+ }
37
+
34
38
  interface BaseNode {
35
39
  leadingComments: ReadonlyArray<Comment> | null;
36
40
  innerComments: ReadonlyArray<Comment> | null;
@@ -39,7 +43,7 @@ interface BaseNode {
39
43
  end: number | null;
40
44
  loc: SourceLocation | null;
41
45
  type: Node["type"];
42
- extra?: Record<string, unknown>;
46
+ extra?: NodeExtra;
43
47
  }
44
48
 
45
49
  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 | ImportExpression | 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;
@@ -258,7 +262,6 @@ export interface Program extends BaseNode {
258
262
  directives: Array<Directive>;
259
263
  sourceType: "script" | "module";
260
264
  interpreter: InterpreterDirective | null;
261
- sourceFile: string;
262
265
  }
263
266
 
264
267
  export interface ObjectExpression extends BaseNode {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/compiler",
3
- "version": "5.34.6",
3
+ "version": "5.35.0",
4
4
  "description": "Marko template to JS compiler.",
5
5
  "keywords": [
6
6
  "babel",
@@ -14,11 +14,47 @@
14
14
  "bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/marko-js/marko/tree/master/packages/compiler"
17
+ "url": "https://github.com/marko-js/marko/tree/main/packages/compiler"
18
18
  },
19
19
  "license": "MIT",
20
20
  "author": "Dylan Piercey <dpiercey@ebay.com>",
21
21
  "main": "dist/index.js",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./index.d.ts",
25
+ "default": "./src/index.js"
26
+ },
27
+ "./config": {
28
+ "types": "./config.d.ts",
29
+ "default": "./src/config.js"
30
+ },
31
+ "./register": {
32
+ "types": "./register.d.ts",
33
+ "default": "./src/register.js"
34
+ },
35
+ "./modules": "./modules.js",
36
+ "./babel-types": "./babel-types.d.ts",
37
+ "./dist/types": "./dist/types.d.ts",
38
+ "./package.json": "./package.json"
39
+ },
40
+ "exports:override": {
41
+ ".": {
42
+ "types": "./index.d.ts",
43
+ "default": "./dist/index.js"
44
+ },
45
+ "./config": {
46
+ "types": "./config.d.ts",
47
+ "default": "./dist/config.js"
48
+ },
49
+ "./register": {
50
+ "types": "./register.d.ts",
51
+ "default": "./dist/register.js"
52
+ },
53
+ "./modules": "./modules.js",
54
+ "./babel-types": "./babel-types.d.ts",
55
+ "./dist/types": "./dist/types.d.ts",
56
+ "./package.json": "./package.json"
57
+ },
22
58
  "types": "index.d.ts",
23
59
  "files": [
24
60
  "dist",
@@ -31,22 +67,22 @@
31
67
  "register.d.ts"
32
68
  ],
33
69
  "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"
70
+ "build": "babel ./src --out-dir ./dist --copy-files --config-file ../../babel.config.js --env-name=production",
71
+ "prepare": "node -r ~ts scripts/types"
36
72
  },
37
73
  "dependencies": {
38
74
  "@babel/code-frame": "^7.23.5",
39
- "@babel/core": "^7.23.7",
75
+ "@babel/core": "^7.23.9",
40
76
  "@babel/generator": "^7.23.6",
41
- "@babel/parser": "^7.23.6",
77
+ "@babel/parser": "^7.23.9",
42
78
  "@babel/plugin-syntax-typescript": "^7.23.3",
43
79
  "@babel/plugin-transform-modules-commonjs": "^7.23.3",
44
80
  "@babel/plugin-transform-typescript": "^7.23.6",
45
- "@babel/runtime": "^7.23.8",
46
- "@babel/traverse": "^7.23.7",
47
- "@babel/types": "^7.23.6",
48
- "@luxass/strip-json-comments": "^1.1.1",
49
- "@marko/babel-utils": "^6.3.5",
81
+ "@babel/runtime": "^7.23.9",
82
+ "@babel/traverse": "^7.23.9",
83
+ "@babel/types": "^7.23.9",
84
+ "@luxass/strip-json-comments": "^1.2.0",
85
+ "@marko/babel-utils": "^6.4.0",
50
86
  "complain": "^1.6.0",
51
87
  "he": "^1.2.0",
52
88
  "htmljs-parser": "^5.5.2",
@@ -60,11 +96,10 @@
60
96
  "source-map-support": "^0.5.21"
61
97
  },
62
98
  "devDependencies": {
63
- "@marko/translator-default": "^5.31.13"
99
+ "@marko/translator-default": "^5.32.0"
64
100
  },
65
101
  "publishConfig": {
66
102
  "access": "public"
67
103
  },
68
- "main:dev": "src/index.js",
69
- "main:npm": "dist/index.js"
104
+ "main:override": "src/index.js"
70
105
  }