@orgajs/orgx 2.0.1 → 2.2.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/dist/lib/core.d.ts +1 -1
- package/dist/lib/evaluate.d.ts +1 -1
- package/dist/lib/plugin/rehype-recma.d.ts +2 -2
- package/dist/lib/types.d.ts +38 -0
- package/lib/evaluate.js +1 -1
- package/lib/plugin/recma-jsx-rewrite.js +1 -1
- package/package.json +10 -9
- package/types.d.ts +5 -0
- /package/lib/{types.d.ts → types.ts} +0 -0
package/dist/lib/core.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type BaseProcessorOptions = {
|
|
|
29
29
|
/**
|
|
30
30
|
* Whether to compile to a whole program or a function body..
|
|
31
31
|
*/
|
|
32
|
-
outputFormat?:
|
|
32
|
+
outputFormat?: "function-body" | "program" | undefined;
|
|
33
33
|
/**
|
|
34
34
|
* List of recma (esast, JavaScript) plugins.
|
|
35
35
|
*/
|
package/dist/lib/evaluate.d.ts
CHANGED
|
@@ -40,10 +40,10 @@ export type MoreOptions = {
|
|
|
40
40
|
/**
|
|
41
41
|
* - Whether to skip imports
|
|
42
42
|
*/
|
|
43
|
-
skipImport?: boolean;
|
|
43
|
+
skipImport?: boolean | undefined;
|
|
44
44
|
/**
|
|
45
45
|
* - Specify which hast properties to parse as JSX.
|
|
46
46
|
*/
|
|
47
|
-
parseJSX?: string[];
|
|
47
|
+
parseJSX?: string[] | undefined;
|
|
48
48
|
};
|
|
49
49
|
export type Options = HastToEstreeOptions & MoreOptions;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type FunctionComponent<Props> = (props: Props) => JSX.Element | null;
|
|
3
|
+
type ClassComponent<Props> = new (props: Props) => JSX.ElementClass;
|
|
4
|
+
type Component<Props> = FunctionComponent<Props> | ClassComponent<Props> | keyof JSX.IntrinsicElements;
|
|
5
|
+
interface NestedOrgComponents {
|
|
6
|
+
[key: string]: NestedOrgComponents | Component<any>;
|
|
7
|
+
}
|
|
8
|
+
export type OrgComponents = NestedOrgComponents & {
|
|
9
|
+
[Key in keyof JSX.IntrinsicElements]?: Component<JSX.IntrinsicElements[Key]>;
|
|
10
|
+
} & {
|
|
11
|
+
/**
|
|
12
|
+
* If a wrapper component is defined, the org content will be wrapped inside of it.
|
|
13
|
+
*/
|
|
14
|
+
wrapper?: Component<any>;
|
|
15
|
+
};
|
|
16
|
+
export interface OrgProps {
|
|
17
|
+
/**
|
|
18
|
+
* Which props exactly may be passed into the component depends on the contents of the org
|
|
19
|
+
* file.
|
|
20
|
+
*/
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
/**
|
|
23
|
+
* This prop may be used to customize how certain components are rendered.
|
|
24
|
+
*/
|
|
25
|
+
components?: OrgComponents;
|
|
26
|
+
}
|
|
27
|
+
export type OrgContent = (props: OrgProps) => JSX.Element;
|
|
28
|
+
export interface OrgModule {
|
|
29
|
+
/**
|
|
30
|
+
* This could be any value that is exported from the org file.
|
|
31
|
+
*/
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
/**
|
|
34
|
+
* A functional JSX component which renders the content of the org file.
|
|
35
|
+
*/
|
|
36
|
+
default: OrgContent;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
package/lib/evaluate.js
CHANGED
|
@@ -9,7 +9,7 @@ import { run, runSync } from './run.js'
|
|
|
9
9
|
import { resolveEvaluateOptions } from './util/resolve-evaluate-options.js'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Evaluate
|
|
12
|
+
* Evaluate Org Content.
|
|
13
13
|
*
|
|
14
14
|
* @param {VFileCompatible} vfileCompatible
|
|
15
15
|
* MDX document to parse (`string`, `Buffer`, `vfile`, anything that can be
|
|
@@ -564,7 +564,7 @@ function createImportProvider(providerImportSource, outputFormat) {
|
|
|
564
564
|
const specifiers = [
|
|
565
565
|
{
|
|
566
566
|
type: 'ImportSpecifier',
|
|
567
|
-
imported: { type: 'Identifier', name: '
|
|
567
|
+
imported: { type: 'Identifier', name: 'useOrgComponents' },
|
|
568
568
|
local: { type: 'Identifier', name: '_provideComponents' },
|
|
569
569
|
},
|
|
570
570
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orgajs/orgx",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "orga compiler with jsx support",
|
|
5
5
|
"author": "Xiaoxing Hu <hi@xiaoxing.dev>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,21 +19,22 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"lib",
|
|
21
21
|
"dist",
|
|
22
|
-
"index.js"
|
|
22
|
+
"index.js",
|
|
23
|
+
"types.d.ts"
|
|
23
24
|
],
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@types/estree": "^1.0.1",
|
|
26
27
|
"@types/estree-jsx": "^1.0.0",
|
|
27
|
-
"@types/hast": "^2.3.
|
|
28
|
-
"@types/node": "^20.
|
|
29
|
-
"@types/react": "^18.2.
|
|
28
|
+
"@types/hast": "^2.3.5",
|
|
29
|
+
"@types/node": "^20.5.7",
|
|
30
|
+
"@types/react": "^18.2.21",
|
|
30
31
|
"react": "^18.2.0",
|
|
31
32
|
"react-dom": "^18.2.0"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"acorn": "^8.
|
|
35
|
+
"acorn": "^8.10.0",
|
|
35
36
|
"acorn-jsx": "^5.3.2",
|
|
36
|
-
"astring": "^1.
|
|
37
|
+
"astring": "^1.8.6",
|
|
37
38
|
"estree-util-build-jsx": "2.2.2",
|
|
38
39
|
"estree-util-is-identifier-name": "2.1.0",
|
|
39
40
|
"estree-util-to-js": "^1.2.0",
|
|
@@ -45,8 +46,8 @@
|
|
|
45
46
|
"unist-util-position-from-estree": "^1.1.2",
|
|
46
47
|
"unist-util-stringify-position": "^3.0.3",
|
|
47
48
|
"vfile": "^5.3.7",
|
|
48
|
-
"@orgajs/reorg-parse": "^4.
|
|
49
|
-
"@orgajs/reorg-rehype": "^4.
|
|
49
|
+
"@orgajs/reorg-parse": "^4.1.1",
|
|
50
|
+
"@orgajs/reorg-rehype": "^4.1.1"
|
|
50
51
|
},
|
|
51
52
|
"scripts": {
|
|
52
53
|
"clean": "tsc --build --clean",
|
package/types.d.ts
ADDED
|
File without changes
|