@orgajs/orgx 1.0.7 → 2.0.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 (113) hide show
  1. package/LICENSE.org +22 -0
  2. package/dist/index.d.ts +11 -5
  3. package/dist/lib/compile.d.ts +45 -0
  4. package/dist/lib/condition.browser.d.ts +1 -0
  5. package/dist/lib/condition.d.ts +1 -0
  6. package/dist/lib/core.d.ts +57 -0
  7. package/dist/lib/evaluate.d.ts +27 -0
  8. package/dist/lib/plugin/recma-document.d.ts +63 -0
  9. package/dist/lib/plugin/recma-jsx-build.d.ts +14 -0
  10. package/dist/lib/plugin/recma-jsx-rewrite.d.ts +50 -0
  11. package/dist/lib/plugin/recma-stringify.d.ts +13 -0
  12. package/dist/lib/plugin/rehype-recma.d.ts +49 -0
  13. package/dist/lib/run.d.ts +26 -0
  14. package/dist/lib/util/estree-util-create.d.ts +13 -0
  15. package/dist/lib/util/estree-util-declaration-to-expression.d.ts +19 -0
  16. package/dist/lib/util/estree-util-is-declaration.d.ts +15 -0
  17. package/dist/lib/util/estree-util-specifiers-to-declarations.d.ts +14 -0
  18. package/dist/lib/util/estree-util-to-binary-addition.d.ts +8 -0
  19. package/dist/lib/util/estree-util-to-id-or-member-expression.d.ts +11 -0
  20. package/dist/lib/util/render-error.d.ts +2 -0
  21. package/dist/lib/util/resolve-evaluate-options.d.ts +66 -0
  22. package/dist/lib/util/resolve-file-and-options.d.ts +16 -0
  23. package/index.js +14 -0
  24. package/lib/compile.js +54 -0
  25. package/lib/condition.browser.js +1 -0
  26. package/lib/condition.js +3 -0
  27. package/lib/core.js +100 -0
  28. package/lib/evaluate.js +41 -0
  29. package/lib/plugin/recma-document.js +607 -0
  30. package/lib/plugin/recma-jsx-build.js +53 -0
  31. package/lib/plugin/recma-jsx-rewrite.js +616 -0
  32. package/lib/plugin/recma-stringify.js +42 -0
  33. package/lib/plugin/rehype-recma.js +218 -0
  34. package/lib/run.js +31 -0
  35. package/lib/types.d.ts +46 -0
  36. package/lib/util/estree-util-create.js +27 -0
  37. package/lib/util/estree-util-declaration-to-expression.js +32 -0
  38. package/lib/util/estree-util-is-declaration.js +20 -0
  39. package/lib/util/estree-util-specifiers-to-declarations.js +90 -0
  40. package/lib/util/estree-util-to-binary-addition.js +23 -0
  41. package/lib/util/estree-util-to-id-or-member-expression.js +108 -0
  42. package/lib/util/render-error.js +91 -0
  43. package/lib/util/resolve-evaluate-options.js +64 -0
  44. package/lib/util/resolve-file-and-options.js +40 -0
  45. package/package.json +36 -29
  46. package/CHANGELOG.md +0 -71
  47. package/dist/compile.d.ts +0 -6
  48. package/dist/compile.d.ts.map +0 -1
  49. package/dist/compile.js +0 -12
  50. package/dist/compile.js.map +0 -1
  51. package/dist/estree/create.d.ts +0 -2
  52. package/dist/estree/create.d.ts.map +0 -1
  53. package/dist/estree/create.js +0 -14
  54. package/dist/estree/create.js.map +0 -1
  55. package/dist/estree/declaration-to-expression.d.ts +0 -3
  56. package/dist/estree/declaration-to-expression.d.ts.map +0 -1
  57. package/dist/estree/declaration-to-expression.js +0 -12
  58. package/dist/estree/declaration-to-expression.js.map +0 -1
  59. package/dist/estree/error.d.ts +0 -61
  60. package/dist/estree/error.d.ts.map +0 -1
  61. package/dist/estree/error.js +0 -87
  62. package/dist/estree/error.js.map +0 -1
  63. package/dist/estree/is-declaration.d.ts +0 -3
  64. package/dist/estree/is-declaration.d.ts.map +0 -1
  65. package/dist/estree/is-declaration.js +0 -9
  66. package/dist/estree/is-declaration.js.map +0 -1
  67. package/dist/estree/position-from-estree.d.ts +0 -13
  68. package/dist/estree/position-from-estree.d.ts.map +0 -1
  69. package/dist/estree/position-from-estree.js +0 -34
  70. package/dist/estree/position-from-estree.js.map +0 -1
  71. package/dist/estree/specifiers-to-object-pattern.d.ts +0 -5
  72. package/dist/estree/specifiers-to-object-pattern.d.ts.map +0 -1
  73. package/dist/estree/specifiers-to-object-pattern.js +0 -33
  74. package/dist/estree/specifiers-to-object-pattern.js.map +0 -1
  75. package/dist/evaluate.d.ts +0 -22
  76. package/dist/evaluate.d.ts.map +0 -1
  77. package/dist/evaluate.js +0 -27
  78. package/dist/evaluate.js.map +0 -1
  79. package/dist/index.d.ts.map +0 -1
  80. package/dist/index.js +0 -11
  81. package/dist/index.js.map +0 -1
  82. package/dist/plugin/estree-jsx-build.d.ts +0 -6
  83. package/dist/plugin/estree-jsx-build.d.ts.map +0 -1
  84. package/dist/plugin/estree-jsx-build.js +0 -38
  85. package/dist/plugin/estree-jsx-build.js.map +0 -1
  86. package/dist/plugin/estree-jsx-rewrite.d.ts +0 -6
  87. package/dist/plugin/estree-jsx-rewrite.d.ts.map +0 -1
  88. package/dist/plugin/estree-jsx-rewrite.js +0 -214
  89. package/dist/plugin/estree-jsx-rewrite.js.map +0 -1
  90. package/dist/plugin/estree-stringify.d.ts +0 -2
  91. package/dist/plugin/estree-stringify.d.ts.map +0 -1
  92. package/dist/plugin/estree-stringify.js +0 -127
  93. package/dist/plugin/estree-stringify.js.map +0 -1
  94. package/dist/plugin/estree-wrap-in-content.d.ts +0 -18
  95. package/dist/plugin/estree-wrap-in-content.d.ts.map +0 -1
  96. package/dist/plugin/estree-wrap-in-content.js +0 -375
  97. package/dist/plugin/estree-wrap-in-content.js.map +0 -1
  98. package/dist/plugin/rehype-estree.d.ts +0 -12
  99. package/dist/plugin/rehype-estree.d.ts.map +0 -1
  100. package/dist/plugin/rehype-estree.js +0 -122
  101. package/dist/plugin/rehype-estree.js.map +0 -1
  102. package/dist/plugin/rehype-set-layout.d.ts +0 -6
  103. package/dist/plugin/rehype-set-layout.d.ts.map +0 -1
  104. package/dist/plugin/rehype-set-layout.js +0 -30
  105. package/dist/plugin/rehype-set-layout.js.map +0 -1
  106. package/dist/processor.d.ts +0 -14
  107. package/dist/processor.d.ts.map +0 -1
  108. package/dist/processor.js +0 -52
  109. package/dist/processor.js.map +0 -1
  110. package/dist/utils/remove-quotes.d.ts +0 -3
  111. package/dist/utils/remove-quotes.d.ts.map +0 -1
  112. package/dist/utils/remove-quotes.js +0 -6
  113. package/dist/utils/remove-quotes.js.map +0 -1
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @typedef {import('../core.js').ProcessorOptions} ProcessorOptions
3
+ *
4
+ * @typedef RunnerOptions
5
+ * Configuration with JSX runtime.
6
+ * @property {any} Fragment
7
+ * Symbol to use for fragments.
8
+ * @property {any} [jsx]
9
+ * Function to generate an element with static children in production mode.
10
+ * @property {any} [jsxs]
11
+ * Function to generate an element with dynamic children in production mode.
12
+ * @property {any} [jsxDEV]
13
+ * Function to generate an element in development mode.
14
+ * @property {any} [useOrgComponents]
15
+ * Function to get `MDXComponents` from context.
16
+ *
17
+ * @typedef {Omit<ProcessorOptions, 'jsx' | 'jsxImportSource' | 'jsxRuntime' | 'pragma' | 'pragmaFrag' | 'pragmaImportSource' | 'providerImportSource' | 'outputFormat'> } EvaluateProcessorOptions
18
+ * Compile configuration without JSX options for evaluation.
19
+ *
20
+ * @typedef {EvaluateProcessorOptions & RunnerOptions} EvaluateOptions
21
+ * Configuration for evaluation.
22
+ */
23
+
24
+ /**
25
+ * Split compiletime options from runtime options.
26
+ *
27
+ * @param {EvaluateOptions | null | undefined} options
28
+ * @returns {{compiletime: ProcessorOptions, runtime: RunnerOptions}}
29
+ */
30
+ export function resolveEvaluateOptions(options) {
31
+ const {
32
+ development,
33
+ Fragment,
34
+ jsx,
35
+ jsxs,
36
+ jsxDEV,
37
+ useOrgComponents,
38
+ ...rest
39
+ } = options || {}
40
+
41
+ if (!Fragment) throw new Error('Expected `Fragment` given to `evaluate`')
42
+ if (development) {
43
+ if (!jsxDEV) throw new Error('Expected `jsxDEV` given to `evaluate`')
44
+ } else {
45
+ if (!jsx) throw new Error('Expected `jsx` given to `evaluate`')
46
+ if (!jsxs) throw new Error('Expected `jsxs` given to `evaluate`')
47
+ }
48
+
49
+ return {
50
+ compiletime: {
51
+ ...rest,
52
+ development,
53
+ outputFormat: 'function-body',
54
+ providerImportSource: useOrgComponents ? '#' : undefined,
55
+ },
56
+ runtime: {
57
+ Fragment,
58
+ jsx,
59
+ jsxs,
60
+ jsxDEV,
61
+ useOrgComponents,
62
+ },
63
+ }
64
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @typedef {import('vfile').VFileCompatible} VFileCompatible
3
+ * @typedef {import('../core.js').ProcessorOptions} ProcessorOptions
4
+ * @typedef {import('../compile.js').CompileOptions} CompileOptions
5
+ */
6
+
7
+ import { VFile } from 'vfile'
8
+
9
+ /**
10
+ * Create a file and options from a given `vfileCompatible` and options that
11
+ * might contain `format: 'detect'`.
12
+ *
13
+ * @param {VFileCompatible} vfileCompatible
14
+ * @param {CompileOptions | null | undefined} [options]
15
+ * @returns {{file: VFile, options: ProcessorOptions}}
16
+ */
17
+ export function resolveFileAndOptions(vfileCompatible, options) {
18
+ const file = looksLikeAVFile(vfileCompatible)
19
+ ? vfileCompatible
20
+ : new VFile(vfileCompatible)
21
+ return {
22
+ file,
23
+ options: {
24
+ ...options,
25
+ },
26
+ }
27
+ }
28
+
29
+ /**
30
+ * @param {VFileCompatible | null | undefined} [value]
31
+ * @returns {value is VFile}
32
+ */
33
+ function looksLikeAVFile(value) {
34
+ return Boolean(
35
+ value &&
36
+ typeof value === 'object' &&
37
+ 'message' in value &&
38
+ 'messages' in value
39
+ )
40
+ }
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@orgajs/orgx",
3
- "version": "1.0.7",
3
+ "version": "2.0.0",
4
4
  "description": "orga compiler with jsx support",
5
- "main": "dist/index.js",
6
- "author": "Xiaoxing Hu <xiaoxing@huxx.org>",
5
+ "author": "Xiaoxing Hu <hi@xiaoxing.dev>",
7
6
  "license": "MIT",
8
7
  "homepage": "https://github.com/orgapp/orgajs/tree/main/packages/orgx#readme",
9
8
  "repository": {
@@ -11,39 +10,47 @@
11
10
  "url": "https://github.com/orgapp/orgajs.git",
12
11
  "directory": "packages/orgx"
13
12
  },
13
+ "type": "module",
14
+ "main": "index.js",
15
+ "types": "dist/index.d.ts",
16
+ "browser": {
17
+ "./lib/condition.js": "./lib/condition.browser.js"
18
+ },
14
19
  "files": [
15
- "dist"
20
+ "lib",
21
+ "dist",
22
+ "index.js"
16
23
  ],
17
- "scripts": {
18
- "build": "yarn clean && yarn compile",
19
- "clean": "del ./dist tsconfig.tsbuildinfo",
20
- "test": "jest",
21
- "compile": "tsc -b"
22
- },
23
24
  "devDependencies": {
24
- "@types/estree": "^0.0.50",
25
- "@types/estree-jsx": "^0.0.1",
25
+ "@types/estree": "^1.0.1",
26
+ "@types/estree-jsx": "^1.0.0",
26
27
  "@types/hast": "^2.3.4",
27
- "@types/jest": "^27.0.1",
28
- "@types/node": "^16.11.1",
29
- "jest": "^27.1.1",
30
- "jest-cli": "^27.1.1",
31
- "react": "^17.0.2",
32
- "ts-jest": "^27.0.5"
28
+ "@types/node": "^20.2.1",
29
+ "@types/react": "^18.2.6",
30
+ "react": "^18.2.0",
31
+ "react-dom": "^18.2.0"
33
32
  },
34
33
  "dependencies": {
35
- "@orgajs/reorg-parse": "3.1.6",
36
- "@orgajs/reorg-rehype": "3.0.9",
37
34
  "acorn": "^8.5.0",
38
35
  "acorn-jsx": "^5.3.2",
39
36
  "astring": "^1.7.5",
40
- "estree-util-build-jsx": "1.1.1",
41
- "estree-util-is-identifier-name": "1.1.0",
42
- "estree-walker": "2.0.2",
43
- "hast-util-to-estree": "1.4.0",
44
- "periscopic": "2.0.3",
45
- "unified": "9.2.2",
46
- "unist-util-stringify-position": "2.0.3",
47
- "vfile": "4.2.1"
37
+ "estree-util-build-jsx": "2.2.2",
38
+ "estree-util-is-identifier-name": "2.1.0",
39
+ "estree-util-to-js": "^1.2.0",
40
+ "estree-walker": "3.0.3",
41
+ "hast-util-to-estree": "^2.3.3",
42
+ "periscopic": "3.1.0",
43
+ "source-map": "^0.7.4",
44
+ "unified": "^10.1.2",
45
+ "unist-util-position-from-estree": "^1.1.2",
46
+ "unist-util-stringify-position": "^3.0.3",
47
+ "vfile": "^5.3.7",
48
+ "@orgajs/reorg-parse": "^4.0.0",
49
+ "@orgajs/reorg-rehype": "^4.0.0"
50
+ },
51
+ "scripts": {
52
+ "clean": "tsc --build --clean",
53
+ "build": "tsc --build",
54
+ "test": "node --test tests/*.test.js"
48
55
  }
49
- }
56
+ }
package/CHANGELOG.md DELETED
@@ -1,71 +0,0 @@
1
- # @orgajs/orgx
2
-
3
- ## 1.0.7
4
-
5
- ### Patch Changes
6
-
7
- - 6c1ddb9f: add latex support
8
- - @orgajs/reorg-rehype@3.0.9
9
- - @orgajs/reorg-parse@3.1.6
10
-
11
- ## 1.0.6
12
-
13
- ### Patch Changes
14
-
15
- - 4bde5155: tidy up dependencies
16
- - @orgajs/reorg-parse@3.1.5
17
- - @orgajs/reorg-rehype@3.0.8
18
-
19
- ## 1.0.5
20
-
21
- ### Patch Changes
22
-
23
- - @orgajs/reorg-rehype@3.0.7
24
- - @orgajs/reorg-parse@3.1.4
25
-
26
- ## 1.0.4
27
-
28
- ### Patch Changes
29
-
30
- - @orgajs/reorg-parse@3.1.3
31
- - @orgajs/reorg-rehype@3.0.6
32
-
33
- ## 1.0.3
34
-
35
- ### Patch Changes
36
-
37
- - cd7cac3d: export evaluateSync
38
-
39
- ## 1.0.2
40
-
41
- ### Patch Changes
42
-
43
- - c8edd571: add evaluateSync function to orgx
44
-
45
- ## 1.0.1
46
-
47
- ### Patch Changes
48
-
49
- - 594bf16b: ## @orgajs/orgx
50
-
51
- Introducing new compiler `@orgajs/orgx`. It's a (almost) a direct port of [xdm](https://github.com/wooorm/xdm).
52
-
53
- Most of the packages have already adopted `@orgajs/orgx`. The important ones are:
54
-
55
- - `@orgajs/loader`
56
- - `@orgajs/next`
57
- - `gatsby-plugin-orga`
58
- - `gatsby-theme-orga-docs`
59
- - `@orgajs/playground'`
60
-
61
- `gatsby-transformer-orga` is still using the original compiler, since it has it's own ecosystem which requires some work to do a proper migration. That means the derivative packages around it are using the original compiler.
62
-
63
- - `gatsby-theme-orga-posts`
64
- - `gatsby-theme-orga-posts-core`
65
-
66
- ## theme-ui support
67
-
68
- `theme-ui` has `mdx` support builtin, and it's hard to do a clean extraction. So the package `@orgajs/theme-ui` is wrapping theme-ui, and provide orga specific tweaks. For gatsby, `gatsby-plugin-orga-theme-ui` is the equivalent of `gatsby-plugin-theme-ui`, but with orga support.
69
-
70
- - @orgajs/reorg-parse@3.1.2
71
- - @orgajs/reorg-rehype@3.0.5
package/dist/compile.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { ProcessorOptions as ProcessorOptions } from './processor';
2
- import type { VFileCompatible } from 'vfile';
3
- export declare type CompileOptions = ProcessorOptions;
4
- export declare function compile(file: VFileCompatible, options?: Partial<CompileOptions>): Promise<import("vfile").VFile>;
5
- export declare function compileSync(file: VFileCompatible, options?: Partial<CompileOptions>): import("vfile").VFile;
6
- //# sourceMappingURL=compile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,IAAI,gBAAgB,EACrC,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAE5C,oBAAY,cAAc,GAAG,gBAAgB,CAAA;AAE7C,wBAAgB,OAAO,CACrB,IAAI,EAAE,eAAe,EACrB,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM,kCAGtC;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,eAAe,EACrB,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM,yBAGtC"}
package/dist/compile.js DELETED
@@ -1,12 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.compileSync = exports.compile = void 0;
3
- const processor_1 = require("./processor");
4
- function compile(file, options = {}) {
5
- return processor_1.createProcessor(options).process(file);
6
- }
7
- exports.compile = compile;
8
- function compileSync(file, options = {}) {
9
- return processor_1.createProcessor(options).processSync(file);
10
- }
11
- exports.compileSync = compileSync;
12
- //# sourceMappingURL=compile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compile.js","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":";;AAAA,2CAGoB;AAKpB,SAAgB,OAAO,CACrB,IAAqB,EACrB,UAAmC,EAAE;IAErC,OAAO,2BAAe,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC/C,CAAC;AALD,0BAKC;AAED,SAAgB,WAAW,CACzB,IAAqB,EACrB,UAAmC,EAAE;IAErC,OAAO,2BAAe,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;AACnD,CAAC;AALD,kCAKC"}
@@ -1,2 +0,0 @@
1
- export default function create(template: any, node: any): any;
2
- //# sourceMappingURL=create.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/estree/create.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,QAAQ,KAAA,EAAE,IAAI,KAAA,OAa5C"}
@@ -1,14 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- function create(template, node) {
3
- const fields = ['start', 'end', 'loc', 'range', 'comments'];
4
- let index = -1;
5
- while (++index < fields.length) {
6
- const field = fields[index];
7
- if (field in template) {
8
- node[field] = template[field];
9
- }
10
- }
11
- return node;
12
- }
13
- exports.default = create;
14
- //# sourceMappingURL=create.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/estree/create.ts"],"names":[],"mappings":";AAAA,SAAwB,MAAM,CAAC,QAAQ,EAAE,IAAI;IAC3C,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;IAC3D,IAAI,KAAK,GAAG,CAAC,CAAC,CAAA;IAEd,OAAO,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE;QAC9B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;QAE3B,IAAI,KAAK,IAAI,QAAQ,EAAE;YACrB,IAAI,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;SAC9B;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAbD,yBAaC"}
@@ -1,3 +0,0 @@
1
- import { Declaration, Expression } from 'estree';
2
- export default function declarationToExpression(declaration: Declaration): Expression;
3
- //# sourceMappingURL=declaration-to-expression.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"declaration-to-expression.d.ts","sourceRoot":"","sources":["../../src/estree/declaration-to-expression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAEhD,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,WAAW,EAAE,WAAW,GACvB,UAAU,CAYZ"}
@@ -1,12 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- function declarationToExpression(declaration) {
3
- if (declaration.type === 'FunctionDeclaration') {
4
- return { ...declaration, type: 'FunctionExpression' };
5
- }
6
- if (declaration.type === 'ClassDeclaration') {
7
- return { ...declaration, type: 'ClassExpression' };
8
- }
9
- throw new Error('Cannot turn `' + declaration.type + '` into an expression');
10
- }
11
- exports.default = declarationToExpression;
12
- //# sourceMappingURL=declaration-to-expression.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"declaration-to-expression.js","sourceRoot":"","sources":["../../src/estree/declaration-to-expression.ts"],"names":[],"mappings":";AAEA,SAAwB,uBAAuB,CAC7C,WAAwB;IAExB,IAAI,WAAW,CAAC,IAAI,KAAK,qBAAqB,EAAE;QAC9C,OAAO,EAAE,GAAG,WAAW,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAA;KACtD;IAED,IAAI,WAAW,CAAC,IAAI,KAAK,kBAAkB,EAAE;QAC3C,OAAO,EAAE,GAAG,WAAW,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAA;KAEnD;IAGD,MAAM,IAAI,KAAK,CAAC,eAAe,GAAG,WAAW,CAAC,IAAI,GAAG,sBAAsB,CAAC,CAAA;AAC9E,CAAC;AAdD,0CAcC"}
@@ -1,61 +0,0 @@
1
- declare const _default: (error: SyntaxError, bg?: string, color?: string) => {
2
- type: string;
3
- body: {
4
- type: string;
5
- expression: {
6
- type: string;
7
- openingElement: {
8
- type: string;
9
- attributes: {
10
- type: string;
11
- name: {
12
- type: string;
13
- name: string;
14
- };
15
- value: {
16
- type: string;
17
- expression: {
18
- type: string;
19
- properties: {
20
- type: string;
21
- method: boolean;
22
- shorthand: boolean;
23
- computed: boolean;
24
- key: {
25
- type: string;
26
- name: string;
27
- };
28
- value: {
29
- type: string;
30
- value: string;
31
- raw: string;
32
- };
33
- kind: string;
34
- }[];
35
- };
36
- };
37
- }[];
38
- name: {
39
- type: string;
40
- name: string;
41
- };
42
- selfClosing: boolean;
43
- };
44
- closingElement: {
45
- type: string;
46
- name: {
47
- type: string;
48
- name: string;
49
- };
50
- };
51
- children: {
52
- type: string;
53
- value: string;
54
- raw: string;
55
- }[];
56
- };
57
- }[];
58
- sourceType: string;
59
- };
60
- export default _default;
61
- //# sourceMappingURL=error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/estree/error.ts"],"names":[],"mappings":"gCAAuB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAlC,wBAoFC"}
@@ -1,87 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.default = (error, bg = '#F44336', color = 'white') => {
3
- return {
4
- type: 'Program',
5
- body: [
6
- {
7
- type: 'ExpressionStatement',
8
- expression: {
9
- type: 'JSXElement',
10
- openingElement: {
11
- type: 'JSXOpeningElement',
12
- attributes: [
13
- {
14
- type: 'JSXAttribute',
15
- name: {
16
- type: 'JSXIdentifier',
17
- name: 'style',
18
- },
19
- value: {
20
- type: 'JSXExpressionContainer',
21
- expression: {
22
- type: 'ObjectExpression',
23
- properties: [
24
- {
25
- type: 'Property',
26
- method: false,
27
- shorthand: false,
28
- computed: false,
29
- key: {
30
- type: 'Identifier',
31
- name: 'backgroundColor',
32
- },
33
- value: {
34
- type: 'Literal',
35
- value: bg,
36
- raw: `'${bg}'`,
37
- },
38
- kind: 'init',
39
- },
40
- {
41
- type: 'Property',
42
- method: false,
43
- shorthand: false,
44
- computed: false,
45
- key: {
46
- type: 'Identifier',
47
- name: 'color',
48
- },
49
- value: {
50
- type: 'Literal',
51
- value: color,
52
- raw: `'${color}'`,
53
- },
54
- kind: 'init',
55
- },
56
- ],
57
- },
58
- },
59
- },
60
- ],
61
- name: {
62
- type: 'JSXIdentifier',
63
- name: 'pre',
64
- },
65
- selfClosing: false,
66
- },
67
- closingElement: {
68
- type: 'JSXClosingElement',
69
- name: {
70
- type: 'JSXIdentifier',
71
- name: 'pre',
72
- },
73
- },
74
- children: [
75
- {
76
- type: 'JSXText',
77
- value: error.message,
78
- raw: error.message,
79
- },
80
- ],
81
- },
82
- },
83
- ],
84
- sourceType: 'module',
85
- };
86
- };
87
- //# sourceMappingURL=error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/estree/error.ts"],"names":[],"mappings":";AAAA,kBAAe,CAAC,KAAkB,EAAE,EAAE,GAAG,SAAS,EAAE,KAAK,GAAG,OAAO,EAAE,EAAE;IACrE,OAAO;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,UAAU,EAAE;oBACV,IAAI,EAAE,YAAY;oBAClB,cAAc,EAAE;wBACd,IAAI,EAAE,mBAAmB;wBACzB,UAAU,EAAE;4BACV;gCACE,IAAI,EAAE,cAAc;gCACpB,IAAI,EAAE;oCACJ,IAAI,EAAE,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rB,CAAA;AACH,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- import { Declaration, BaseNode } from 'estree';
2
- export default function isDeclaration(node: BaseNode): node is Declaration;
3
- //# sourceMappingURL=is-declaration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-declaration.d.ts","sourceRoot":"","sources":["../../src/estree/is-declaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAE9C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,WAAW,CAOzE"}
@@ -1,9 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- function isDeclaration(node) {
3
- const type = node && typeof node === 'object' && node.type;
4
- return Boolean(type === 'FunctionDeclaration' ||
5
- type === 'ClassDeclaration' ||
6
- type === 'VariableDeclaration');
7
- }
8
- exports.default = isDeclaration;
9
- //# sourceMappingURL=is-declaration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-declaration.js","sourceRoot":"","sources":["../../src/estree/is-declaration.ts"],"names":[],"mappings":";AAEA,SAAwB,aAAa,CAAC,IAAc;IAClD,MAAM,IAAI,GAAG,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAA;IAC1D,OAAO,OAAO,CACZ,IAAI,KAAK,qBAAqB;QAC5B,IAAI,KAAK,kBAAkB;QAC3B,IAAI,KAAK,qBAAqB,CACjC,CAAA;AACH,CAAC;AAPD,gCAOC"}
@@ -1,13 +0,0 @@
1
- export default function positionFromEstree(value: any): {
2
- start: {
3
- line: any;
4
- column: any;
5
- offset: number;
6
- };
7
- end: {
8
- line: any;
9
- column: any;
10
- offset: number;
11
- };
12
- };
13
- //# sourceMappingURL=position-from-estree.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"position-from-estree.d.ts","sourceRoot":"","sources":["../../src/estree/position-from-estree.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,KAAA;;;;;;;;;;;EAwC/C"}
@@ -1,34 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- function positionFromEstree(value) {
3
- const node = value || {};
4
- const loc = node.loc || {};
5
- const range = node.range || [0, 0];
6
- const startOffset = range[0] || node.start;
7
- const endOffset = range[1] || node.end;
8
- return {
9
- start: {
10
- line: loc.start && typeof loc.start.line === 'number' && loc.start.line > -1
11
- ? loc.start.line
12
- : undefined,
13
- column: loc.start &&
14
- typeof loc.start.column === 'number' &&
15
- loc.start.column > -1
16
- ? loc.start.column + 1
17
- : undefined,
18
- offset: typeof startOffset === 'number' && startOffset > -1
19
- ? startOffset
20
- : undefined,
21
- },
22
- end: {
23
- line: loc.end && typeof loc.end.line === 'number' && loc.end.line > -1
24
- ? loc.end.line
25
- : undefined,
26
- column: loc.end && typeof loc.end.column === 'number' && loc.end.column > -1
27
- ? loc.end.column + 1
28
- : undefined,
29
- offset: typeof endOffset === 'number' && endOffset > -1 ? endOffset : undefined,
30
- },
31
- };
32
- }
33
- exports.default = positionFromEstree;
34
- //# sourceMappingURL=position-from-estree.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"position-from-estree.js","sourceRoot":"","sources":["../../src/estree/position-from-estree.ts"],"names":[],"mappings":";AAAA,SAAwB,kBAAkB,CAAC,KAAK;IAE9C,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE,CAAA;IAExB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,CAAA;IAE1B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAClC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAA;IAC1C,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAA;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AwCC"}
@@ -1,5 +0,0 @@
1
- export default function specifiersToObjectPattern(specifiers: any): {
2
- type: string;
3
- properties: any;
4
- };
5
- //# sourceMappingURL=specifiers-to-object-pattern.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"specifiers-to-object-pattern.d.ts","sourceRoot":"","sources":["../../src/estree/specifiers-to-object-pattern.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,UAAU,KAAA;;;EA8B3D"}
@@ -1,33 +0,0 @@
1
- var __importDefault = (this && this.__importDefault) || function (mod) {
2
- return (mod && mod.__esModule) ? mod : { "default": mod };
3
- };
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- const create_1 = __importDefault(require("./create"));
6
- function specifiersToObjectPattern(specifiers) {
7
- return {
8
- type: 'ObjectPattern',
9
- properties: specifiers.map((specifier) => {
10
- let key = specifier.type === 'ImportSpecifier'
11
- ? specifier.imported
12
- : specifier.type === 'ExportSpecifier'
13
- ? specifier.exported
14
- : { type: 'Identifier', name: 'default' };
15
- let value = specifier.local;
16
- if (specifier.type === 'ExportSpecifier') {
17
- value = key;
18
- key = specifier.local;
19
- }
20
- return create_1.default(specifier, {
21
- type: 'Property',
22
- kind: 'init',
23
- shorthand: key.name === value.name,
24
- method: false,
25
- computed: false,
26
- key,
27
- value,
28
- });
29
- }),
30
- };
31
- }
32
- exports.default = specifiersToObjectPattern;
33
- //# sourceMappingURL=specifiers-to-object-pattern.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"specifiers-to-object-pattern.js","sourceRoot":"","sources":["../../src/estree/specifiers-to-object-pattern.ts"],"names":[],"mappings":";;;;AAAA,sDAA6B;AAE7B,SAAwB,yBAAyB,CAAC,UAAU;IAC1D,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YAEvC,IAAI,GAAG,GACL,SAAS,CAAC,IAAI,KAAK,iBAAiB;gBAClC,CAAC,CAAC,SAAS,CAAC,QAAQ;gBACpB,CAAC,CAAC,SAAS,CAAC,IAAI,KAAK,iBAAiB;oBACtC,CAAC,CAAC,SAAS,CAAC,QAAQ;oBACpB,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;YAC7C,IAAI,KAAK,GAAG,SAAS,CAAC,KAAK,CAAA;YAG3B,IAAI,SAAS,CAAC,IAAI,KAAK,iBAAiB,EAAE;gBACxC,KAAK,GAAG,GAAG,CAAA;gBACX,GAAG,GAAG,SAAS,CAAC,KAAK,CAAA;aACtB;YAED,OAAO,gBAAM,CAAC,SAAS,EAAE;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,MAAM;gBACZ,SAAS,EAAE,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;gBAClC,MAAM,EAAE,KAAK;gBACb,QAAQ,EAAE,KAAK;gBACf,GAAG;gBACH,KAAK;aACN,CAAC,CAAA;QACJ,CAAC,CAAC;KACH,CAAA;AACH,CAAC;AA9BD,4CA8BC"}