astro-eslint-parser 0.0.18 → 0.1.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 (38) hide show
  1. package/README.md +1 -3
  2. package/lib/ast/index.d.ts +6 -0
  3. package/lib/ast/jsx.d.ts +16 -16
  4. package/lib/astro/index.js +2 -4
  5. package/lib/astro-tools/index.d.ts +21 -0
  6. package/lib/astro-tools/index.js +26 -0
  7. package/lib/context/index.d.ts +13 -8
  8. package/lib/context/index.js +51 -100
  9. package/lib/context/parser-options.d.ts +8 -0
  10. package/lib/context/parser-options.js +71 -0
  11. package/lib/{parser → context/resolve-parser}/espree.d.ts +1 -1
  12. package/lib/{parser → context/resolve-parser}/espree.js +1 -1
  13. package/lib/context/resolve-parser/index.d.ts +5 -0
  14. package/lib/{parser/resolve-parser.js → context/resolve-parser/index.js} +0 -0
  15. package/lib/context/script.d.ts +1 -1
  16. package/lib/context/script.js +2 -3
  17. package/lib/index.d.ts +2 -1
  18. package/lib/index.js +3 -1
  19. package/lib/parser/astro-parser/astrojs-compiler-service.d.ts +2 -4
  20. package/lib/parser/astro-parser/astrojs-compiler-service.js +3 -12
  21. package/lib/parser/astro-parser/astrojs-compiler-worker.d.ts +1 -0
  22. package/lib/parser/astro-parser/astrojs-compiler-worker.js +11 -0
  23. package/lib/parser/astro-parser/parse.js +7 -51
  24. package/lib/parser/index.d.ts +0 -17
  25. package/lib/parser/index.js +6 -31
  26. package/lib/parser/lru-cache.d.ts +7 -0
  27. package/lib/parser/lru-cache.js +32 -0
  28. package/lib/parser/process-template.js +24 -5
  29. package/lib/parser/script.d.ts +3 -2
  30. package/lib/parser/script.js +12 -11
  31. package/lib/parser/template.d.ts +10 -0
  32. package/lib/parser/template.js +102 -0
  33. package/lib/types.d.ts +21 -0
  34. package/lib/types.js +2 -0
  35. package/package.json +5 -3
  36. package/lib/parser/astro-parser/wasm_exec.d.ts +0 -35
  37. package/lib/parser/astro-parser/wasm_exec.js +0 -470
  38. package/lib/parser/resolve-parser.d.ts +0 -16
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const synckit_1 = require("synckit");
4
+ const dynamicImport = new Function("m", "return import(m)");
5
+ (0, synckit_1.runAsWorker)(async (source) => {
6
+ const { parse } = await dynamicImport("@astrojs/compiler");
7
+ // console.time("parse")
8
+ const result = parse(source);
9
+ // console.timeEnd("parse")
10
+ return result;
11
+ });
@@ -31,7 +31,7 @@ const errors_1 = require("../../errors");
31
31
  * Parse code by `@astrojs/compiler`
32
32
  */
33
33
  function parse(code, ctx) {
34
- const ast = parseByService(code, ctx).ast;
34
+ const ast = service.parse(code, { position: true }).ast;
35
35
  if (!ast.children) {
36
36
  // If the source code is empty, the children property may not be available.
37
37
  ast.children = [];
@@ -44,45 +44,17 @@ function parse(code, ctx) {
44
44
  return { ast };
45
45
  }
46
46
  exports.parse = parse;
47
- /**
48
- * Parse code by `@astrojs/compiler`
49
- */
50
- function parseByService(code, ctx) {
51
- const jsonAst = service.parse(code, { position: true }).ast;
52
- ctx.originalAST = jsonAst;
53
- try {
54
- const ast = JSON.parse(jsonAst);
55
- ctx.originalAST = ast;
56
- return { ast };
57
- }
58
- catch (_a) {
59
- // FIXME: Workaround for escape bugs
60
- // Adjust because may get the wrong escape as JSON.
61
- const ast = JSON.parse(jsonAst.replace(/\\./gu, (m) => {
62
- try {
63
- JSON.parse(`"${m}"`);
64
- return m;
65
- }
66
- catch (_a) {
67
- return `\\${m}`;
68
- }
69
- }));
70
- ctx.originalAST = ast;
71
- return { ast };
72
- }
73
- }
74
47
  /**
75
48
  * Adjust <html> element node
76
49
  */
77
50
  function adjustHTML(ast, htmlElement, ctx) {
78
- var _a;
79
51
  const htmlEnd = ctx.code.indexOf("</html");
80
52
  if (htmlEnd == null) {
81
53
  return;
82
54
  }
83
55
  const children = [...htmlElement.children];
84
56
  for (const child of children) {
85
- const offset = (_a = child.position) === null || _a === void 0 ? void 0 : _a.start.offset;
57
+ const offset = child.position?.start.offset;
86
58
  if (offset != null) {
87
59
  if (htmlEnd <= offset) {
88
60
  htmlElement.children.splice(htmlElement.children.indexOf(child), 1);
@@ -98,14 +70,13 @@ function adjustHTML(ast, htmlElement, ctx) {
98
70
  * Adjust <body> element node
99
71
  */
100
72
  function adjustHTMLBody(ast, htmlElement, htmlEnd, bodyElement, ctx) {
101
- var _a;
102
73
  const bodyEnd = ctx.code.indexOf("</body");
103
74
  if (bodyEnd == null) {
104
75
  return;
105
76
  }
106
77
  const children = [...bodyElement.children];
107
78
  for (const child of children) {
108
- const offset = (_a = child.position) === null || _a === void 0 ? void 0 : _a.start.offset;
79
+ const offset = child.position?.start.offset;
109
80
  if (offset != null) {
110
81
  if (bodyEnd <= offset) {
111
82
  bodyElement.children.splice(bodyElement.children.indexOf(child), 1);
@@ -169,8 +140,6 @@ function fixLocations(node, ctx) {
169
140
  if (start < 0) {
170
141
  start = ctx.code.length;
171
142
  }
172
- // FIXME: Workaround for escape bugs
173
- node.value = ctx.code.slice(node.position.start.offset, start);
174
143
  }
175
144
  else {
176
145
  const index = tokenIndexSafe(ctx.code, node.value, start);
@@ -179,25 +148,12 @@ function fixLocations(node, ctx) {
179
148
  start += node.value.length;
180
149
  }
181
150
  else {
182
- // FIXME: Workaround for escape bugs
151
+ // FIXME: Some white space may be removed.
183
152
  node.position.start.offset = start;
184
153
  const value = node.value.replace(/\s+/gu, "");
185
- for (let charIndex = 0; charIndex < value.length; charIndex++) {
186
- const char = value[charIndex];
187
- const index = tokenIndexSafe(ctx.code, char, start);
188
- if (index != null) {
189
- start = index + 1;
190
- continue;
191
- }
192
- start = (0, astro_1.skipSpaces)(ctx.code, start);
193
- if (ctx.code.startsWith("\\", start)) {
194
- const codeChar = JSON.parse(`"\\${ctx.code[start + 1]}"`);
195
- start += 2;
196
- if (codeChar === char) {
197
- continue;
198
- }
199
- }
200
- start = tokenIndex(ctx, char, start) + 1;
154
+ for (const char of value) {
155
+ const index = tokenIndex(ctx, char, start);
156
+ start = index + 1;
201
157
  }
202
158
  start = (0, astro_1.skipSpaces)(ctx.code, start);
203
159
  node.value = ctx.code.slice(node.position.start.offset, start);
@@ -1,19 +1,6 @@
1
- import { Context } from "../context";
2
1
  import type { AstroProgram } from "../ast";
3
- import type { TSESTree } from "@typescript-eslint/types";
4
2
  import type { ScopeManager } from "eslint-scope";
5
3
  import type { ParseResult } from "@astrojs/compiler";
6
- /**
7
- * The parsing result of ESLint custom parsers.
8
- */
9
- export interface ESLintExtendedProgram {
10
- ast: TSESTree.Program;
11
- services?: Record<string, any>;
12
- visitorKeys?: {
13
- [type: string]: string[];
14
- };
15
- scopeManager?: ScopeManager;
16
- }
17
4
  /**
18
5
  * Parse source code
19
6
  */
@@ -28,7 +15,3 @@ export declare function parseForESLint(code: string, options?: any): {
28
15
  };
29
16
  scopeManager: ScopeManager;
30
17
  };
31
- /**
32
- * Parse for template
33
- */
34
- export declare function parseTemplate(code: string, ctx: Context): ParseResult;
@@ -1,28 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseTemplate = exports.parseForESLint = void 0;
3
+ exports.parseForESLint = void 0;
4
4
  const visitor_keys_1 = require("../visitor-keys");
5
- const context_1 = require("../context");
6
5
  const types_1 = require("@typescript-eslint/types");
7
6
  const script_1 = require("./script");
8
7
  const sort_1 = require("./sort");
9
- const errors_1 = require("../errors");
10
- const parse_1 = require("./astro-parser/parse");
11
8
  const process_template_1 = require("./process-template");
9
+ const template_1 = require("./template");
10
+ const parser_options_1 = require("../context/parser-options");
12
11
  /**
13
12
  * Parse source code
14
13
  */
15
14
  function parseForESLint(code, options) {
16
- const parserOptions = Object.assign({ ecmaVersion: 2020, sourceType: "module", loc: true, range: true, raw: true, tokens: true, comment: true, eslintVisitorKeys: true, eslintScopeManager: true }, (options || {}));
17
- parserOptions.ecmaFeatures = Object.assign(Object.assign({}, (parserOptions.ecmaFeatures || {})), { jsx: true });
18
- parserOptions.sourceType = "module";
19
- if (parserOptions.ecmaVersion <= 5 || parserOptions.ecmaVersion == null) {
20
- parserOptions.ecmaVersion = 2015;
21
- }
22
- const ctx = new context_1.Context(code, parserOptions);
23
- const resultTemplate = parseTemplate(ctx.code, ctx);
15
+ const { result: resultTemplate, context: ctx } = (0, template_1.parseTemplate)(code);
24
16
  const scriptContext = (0, process_template_1.processTemplate)(ctx, resultTemplate);
25
- const resultScript = (0, script_1.parseScript)(scriptContext.script, ctx);
17
+ const parserOptions = new parser_options_1.ParserOptionsContext(options);
18
+ const resultScript = (0, script_1.parseScript)(scriptContext.script, ctx, parserOptions);
26
19
  scriptContext.restore(resultScript);
27
20
  (0, sort_1.sort)(resultScript.ast.comments);
28
21
  (0, sort_1.sort)(resultScript.ast.tokens);
@@ -34,7 +27,6 @@ function parseForESLint(code, options) {
34
27
  },
35
28
  });
36
29
  resultScript.visitorKeys = Object.assign({}, visitor_keys_1.KEYS, resultScript.visitorKeys);
37
- ctx.remapCR(resultScript);
38
30
  return resultScript;
39
31
  }
40
32
  exports.parseForESLint = parseForESLint;
@@ -77,20 +69,3 @@ function extractTokens(ast, ctx) {
77
69
  return /^[^\w$]$/iu.test(c);
78
70
  }
79
71
  }
80
- /**
81
- * Parse for template
82
- */
83
- function parseTemplate(code, ctx) {
84
- try {
85
- return (0, parse_1.parse)(code, ctx);
86
- }
87
- catch (e) {
88
- if (typeof e.pos === "number") {
89
- const err = new errors_1.ParseError(e.message, e.pos, ctx);
90
- err.astroCompilerError = e;
91
- throw err;
92
- }
93
- throw e;
94
- }
95
- }
96
- exports.parseTemplate = parseTemplate;
@@ -0,0 +1,7 @@
1
+ export declare class LruCache<K, V> extends Map<K, V> {
2
+ private readonly capacity;
3
+ constructor(capacity: number);
4
+ get(key: K): V | undefined;
5
+ set(key: K, value: V): this;
6
+ private deleteOldestEntry;
7
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LruCache = void 0;
4
+ class LruCache extends Map {
5
+ constructor(capacity) {
6
+ super();
7
+ this.capacity = capacity;
8
+ }
9
+ get(key) {
10
+ if (!this.has(key)) {
11
+ return undefined;
12
+ }
13
+ const value = super.get(key);
14
+ this.set(key, value);
15
+ return value;
16
+ }
17
+ set(key, value) {
18
+ this.delete(key);
19
+ super.set(key, value);
20
+ if (this.size > this.capacity) {
21
+ this.deleteOldestEntry();
22
+ }
23
+ return this;
24
+ }
25
+ deleteOldestEntry() {
26
+ for (const entry of this) {
27
+ this.delete(entry[0]);
28
+ return;
29
+ }
30
+ }
31
+ }
32
+ exports.LruCache = LruCache;
@@ -134,10 +134,23 @@ function processTemplate(ctx, resultTemplate) {
134
134
  types_1.AST_NODE_TYPES.JSXAttribute &&
135
135
  scriptNode.range[0] === start) {
136
136
  const baseNameNode = scriptNode.name;
137
- const nsn = Object.assign(Object.assign({}, baseNameNode), { type: types_1.AST_NODE_TYPES.JSXNamespacedName, namespace: Object.assign({ type: types_1.AST_NODE_TYPES.JSXIdentifier, name: attr.name.slice(0, colonIndex) }, ctx.getLocations(baseNameNode.range[0], baseNameNode.range[0] +
138
- colonIndex)), name: Object.assign({ type: types_1.AST_NODE_TYPES.JSXIdentifier, name: attr.name.slice(colonIndex + 1) }, ctx.getLocations(baseNameNode.range[0] +
139
- colonIndex +
140
- 1, baseNameNode.range[1])) });
137
+ const nsn = {
138
+ ...baseNameNode,
139
+ type: types_1.AST_NODE_TYPES.JSXNamespacedName,
140
+ namespace: {
141
+ type: types_1.AST_NODE_TYPES.JSXIdentifier,
142
+ name: attr.name.slice(0, colonIndex),
143
+ ...ctx.getLocations(baseNameNode.range[0], baseNameNode.range[0] +
144
+ colonIndex),
145
+ },
146
+ name: {
147
+ type: types_1.AST_NODE_TYPES.JSXIdentifier,
148
+ name: attr.name.slice(colonIndex + 1),
149
+ ...ctx.getLocations(baseNameNode.range[0] +
150
+ colonIndex +
151
+ 1, baseNameNode.range[1]),
152
+ },
153
+ };
141
154
  scriptNode.name = nsn;
142
155
  nsn.namespace.parent = nsn;
143
156
  nsn.name.parent = nsn;
@@ -212,7 +225,13 @@ function processTemplate(ctx, resultTemplate) {
212
225
  script.addRestoreNodeProcess((scriptNode) => {
213
226
  if (scriptNode.type === types_1.AST_NODE_TYPES.JSXElement &&
214
227
  scriptNode.range[0] === styleNodeStart) {
215
- const textNode = Object.assign({ type: "AstroRawText", value: text.value, raw: text.value, parent: scriptNode }, ctx.getLocations(start, start + text.value.length));
228
+ const textNode = {
229
+ type: "AstroRawText",
230
+ value: text.value,
231
+ raw: text.value,
232
+ parent: scriptNode,
233
+ ...ctx.getLocations(start, start + text.value.length),
234
+ };
216
235
  scriptNode.children = [
217
236
  textNode,
218
237
  ];
@@ -1,6 +1,7 @@
1
- import type { ESLintExtendedProgram } from ".";
2
1
  import type { Context } from "../context";
2
+ import type { ParserOptionsContext } from "../context/parser-options";
3
+ import type { ESLintExtendedProgram } from "../types";
3
4
  /**
4
5
  * Parse for script
5
6
  */
6
- export declare function parseScript(code: string, ctx: Context): ESLintExtendedProgram;
7
+ export declare function parseScript(code: string, _ctx: Context, parserOptions: ParserOptionsContext): ESLintExtendedProgram;
@@ -4,26 +4,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.parseScript = void 0;
7
- const resolve_parser_1 = require("./resolve-parser");
8
7
  const fs_1 = __importDefault(require("fs"));
9
8
  const debug_1 = require("../debug");
10
9
  /**
11
10
  * Parse for script
12
11
  */
13
- function parseScript(code, ctx) {
14
- var _a, _b, _c;
15
- const parser = (0, resolve_parser_1.getParser)({}, ctx.parserOptions.parser);
12
+ function parseScript(code, _ctx, parserOptions) {
13
+ const parser = parserOptions.getParser();
16
14
  let removeFile = null;
17
15
  try {
18
- const scriptOption = Object.assign({}, ctx.parserOptions);
19
- if (ctx.isTypeScript() && scriptOption.filePath) {
20
- scriptOption.filePath += ".tsx";
21
- if (!fs_1.default.existsSync(scriptOption.filePath)) {
22
- fs_1.default.writeFileSync(scriptOption.filePath, "/* temp for astro-eslint-parser */");
23
- removeFile = scriptOption.filePath;
16
+ const scriptParserOptions = { ...parserOptions.parserOptions };
17
+ if (parserOptions.isTypeScript() &&
18
+ scriptParserOptions.filePath &&
19
+ scriptParserOptions.project) {
20
+ scriptParserOptions.filePath += ".tsx";
21
+ if (!fs_1.default.existsSync(scriptParserOptions.filePath)) {
22
+ fs_1.default.writeFileSync(scriptParserOptions.filePath, "/* temp for astro-eslint-parser */");
23
+ removeFile = scriptParserOptions.filePath;
24
24
  }
25
25
  }
26
- const result = (_b = (_a = parser.parseForESLint) === null || _a === void 0 ? void 0 : _a.call(parser, code, scriptOption)) !== null && _b !== void 0 ? _b : (_c = parser.parse) === null || _c === void 0 ? void 0 : _c.call(parser, code, scriptOption);
26
+ const result = parser.parseForESLint?.(code, scriptParserOptions) ??
27
+ parser.parse?.(code, scriptParserOptions);
27
28
  if ("ast" in result && result.ast != null) {
28
29
  return result;
29
30
  }
@@ -0,0 +1,10 @@
1
+ import type { ParseResult } from "@astrojs/compiler";
2
+ import { Context } from "../context";
3
+ export declare type TemplateResult = {
4
+ result: ParseResult;
5
+ context: Context;
6
+ };
7
+ /**
8
+ * Parse the astro component template.
9
+ */
10
+ export declare function parseTemplate(code: string): TemplateResult;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseTemplate = void 0;
4
+ const astro_1 = require("../astro");
5
+ const context_1 = require("../context");
6
+ const errors_1 = require("../errors");
7
+ const parse_1 = require("./astro-parser/parse");
8
+ const lru_cache_1 = require("./lru-cache");
9
+ const lruCache = new lru_cache_1.LruCache(5);
10
+ /**
11
+ * Parse the astro component template.
12
+ */
13
+ function parseTemplate(code) {
14
+ const cache = lruCache.get(code);
15
+ if (cache) {
16
+ return cache;
17
+ }
18
+ const ctx = new context_1.Context(code);
19
+ const normalized = ctx.locs.getNormalizedLineFeed();
20
+ const ctxForAstro = normalized.needRemap
21
+ ? new context_1.Context(normalized.code)
22
+ : ctx;
23
+ try {
24
+ const result = (0, parse_1.parse)(normalized?.code ?? code, ctxForAstro);
25
+ if (normalized.needRemap) {
26
+ remap(result, normalized, code, ctxForAstro);
27
+ ctx.originalAST = ctxForAstro.originalAST;
28
+ }
29
+ const templateResult = {
30
+ result,
31
+ context: ctx,
32
+ };
33
+ lruCache.set(code, templateResult);
34
+ return templateResult;
35
+ }
36
+ catch (e) {
37
+ if (typeof e.pos === "number") {
38
+ const err = new errors_1.ParseError(e.message, normalized?.remapIndex(e.pos), ctx);
39
+ err.astroCompilerError = e;
40
+ throw err;
41
+ }
42
+ throw e;
43
+ }
44
+ }
45
+ exports.parseTemplate = parseTemplate;
46
+ /** Remap */
47
+ function remap(result, normalized, originalCode, ctxForAstro) {
48
+ const remapDataMap = new Map();
49
+ (0, astro_1.walk)(result.ast, normalized.code, (node) => {
50
+ const start = normalized.remapIndex(node.position.start.offset);
51
+ let end, value;
52
+ if (node.position.end) {
53
+ end = normalized.remapIndex(node.position.end.offset);
54
+ if (node.position.start.offset === start &&
55
+ node.position.end.offset === end) {
56
+ return;
57
+ }
58
+ }
59
+ if (node.type === "text") {
60
+ value = originalCode.slice(start, normalized.remapIndex((0, astro_1.getEndOffset)(node, ctxForAstro)));
61
+ }
62
+ else if (node.type === "comment") {
63
+ value = originalCode.slice(start + 4, normalized.remapIndex((0, astro_1.getEndOffset)(node, ctxForAstro)) - 3);
64
+ }
65
+ else if (node.type === "attribute") {
66
+ if (node.kind !== "empty" &&
67
+ node.kind !== "shorthand" &&
68
+ node.kind !== "spread") {
69
+ let valueStart = normalized.remapIndex((0, astro_1.calcAttributeValueStartOffset)(node, ctxForAstro));
70
+ let valueEnd = normalized.remapIndex((0, astro_1.calcAttributeEndOffset)(node, ctxForAstro));
71
+ if (node.kind !== "quoted" ||
72
+ originalCode[valueStart] === '"' ||
73
+ originalCode[valueStart] === "'") {
74
+ valueStart++;
75
+ valueEnd--;
76
+ }
77
+ value = originalCode.slice(valueStart, valueEnd);
78
+ }
79
+ }
80
+ remapDataMap.set(node, {
81
+ start,
82
+ end,
83
+ value,
84
+ });
85
+ }, (_node) => {
86
+ /* noop */
87
+ });
88
+ for (const [node, remapData] of remapDataMap) {
89
+ node.position.start.offset = remapData.start;
90
+ if (node.position.end) {
91
+ node.position.end.offset = remapData.end;
92
+ }
93
+ if (node.type === "text" ||
94
+ node.type === "comment" ||
95
+ (node.type === "attribute" &&
96
+ node.kind !== "empty" &&
97
+ node.kind !== "shorthand" &&
98
+ node.kind !== "spread")) {
99
+ node.value = remapData.value;
100
+ }
101
+ }
102
+ }
package/lib/types.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import type { TSESTree } from "@typescript-eslint/types";
2
+ import type { ScopeManager } from "eslint-scope";
3
+ /**
4
+ * The parsing result of ESLint custom parsers.
5
+ */
6
+ export interface ESLintExtendedProgram {
7
+ ast: TSESTree.Program;
8
+ services?: Record<string, any>;
9
+ visitorKeys?: {
10
+ [type: string]: string[];
11
+ };
12
+ scopeManager?: ScopeManager;
13
+ }
14
+ /**
15
+ * The interface of a result of ESLint custom parser.
16
+ */
17
+ export declare type ESLintCustomParserResult = ESLintExtendedProgram["ast"] | ESLintExtendedProgram;
18
+ export interface ESLintCustomParser {
19
+ parse(code: string, options: any): ESLintCustomParserResult;
20
+ parseForESLint?(code: string, options: any): ESLintCustomParserResult;
21
+ }
package/lib/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-eslint-parser",
3
- "version": "0.0.18",
3
+ "version": "0.1.0",
4
4
  "description": "Astro component parser for ESLint",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -42,10 +42,12 @@
42
42
  },
43
43
  "homepage": "https://github.com/ota-meshi/astro-eslint-parser#readme",
44
44
  "dependencies": {
45
- "@astrojs/compiler": "^0.14.2",
45
+ "@astrojs/compiler": "^0.14.3",
46
+ "@typescript-eslint/types": "^5.25.0",
46
47
  "debug": "^4.3.4",
47
48
  "eslint-visitor-keys": "^3.0.0",
48
- "espree": "^9.0.0"
49
+ "espree": "^9.0.0",
50
+ "synckit": "^0.7.1"
49
51
  },
50
52
  "devDependencies": {
51
53
  "@ota-meshi/eslint-plugin": "^0.10.0",
@@ -1,35 +0,0 @@
1
- export default class Go {
2
- importObject: {
3
- go: {
4
- 'runtime.wasmExit': (sp: any) => void;
5
- 'runtime.wasmWrite': (sp: any) => void;
6
- 'runtime.resetMemoryDataView': (sp: any) => void;
7
- 'runtime.nanotime1': (sp: any) => void;
8
- 'runtime.walltime': (sp: any) => void;
9
- 'runtime.scheduleTimeoutEvent': (sp: any) => void;
10
- 'runtime.clearTimeoutEvent': (sp: any) => void;
11
- 'runtime.getRandomData': (sp: any) => void;
12
- 'syscall/js.finalizeRef': (sp: any) => void;
13
- 'syscall/js.stringVal': (sp: any) => void;
14
- 'syscall/js.valueGet': (sp: any) => void;
15
- 'syscall/js.valueSet': (sp: any) => void;
16
- 'syscall/js.valueDelete': (sp: any) => void;
17
- 'syscall/js.valueIndex': (sp: any) => void;
18
- 'syscall/js.valueSetIndex': (sp: any) => void;
19
- 'syscall/js.valueCall': (sp: any) => void;
20
- 'syscall/js.valueInvoke': (sp: any) => void;
21
- 'syscall/js.valueNew': (sp: any) => void;
22
- 'syscall/js.valueLength': (sp: any) => void;
23
- 'syscall/js.valuePrepareString': (sp: any) => void;
24
- 'syscall/js.valueLoadString': (sp: any) => void;
25
- 'syscall/js.valueInstanceOf': (sp: any) => void;
26
- 'syscall/js.copyBytesToGo': (sp: any) => void;
27
- 'syscall/js.copyBytesToJS': (sp: any) => void;
28
- debug: (value: any) => void;
29
- };
30
- };
31
- constructor();
32
- run(instance: any): Promise<void>;
33
- private _resume;
34
- private _makeFuncWrapper;
35
- }