@orgajs/orgx 2.3.0 → 2.4.1
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/index.d.ts +1 -0
- package/dist/lib/types.d.ts +6 -6
- package/dist/lib/util/is-org-content.d.ts +6 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/index.js +1 -0
- package/lib/types.ts +31 -29
- package/lib/util/is-org-content.js +14 -0
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createProcessor } from "./lib/core.js";
|
|
2
|
+
export { isOrgContent } from "./lib/util/is-org-content.js";
|
|
2
3
|
export type ProcessorOptions = import("./lib/core.js").ProcessorOptions;
|
|
3
4
|
export type CompileOptions = import("./lib/compile.js").CompileOptions;
|
|
4
5
|
export type EvaluateOptions = import("./lib/evaluate.js").EvaluateOptions;
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
type FunctionComponent<Props> = (props: Props) => JSX.Element | null;
|
|
2
|
-
type ClassComponent<Props> = new (props: Props) => JSX.ElementClass;
|
|
3
|
-
type Component<Props> = FunctionComponent<Props> | ClassComponent<Props> | keyof JSX.IntrinsicElements;
|
|
1
|
+
type FunctionComponent<Props> = (props: Props) => React.JSX.Element | null;
|
|
2
|
+
type ClassComponent<Props> = new (props: Props) => React.JSX.ElementClass;
|
|
3
|
+
type Component<Props> = FunctionComponent<Props> | ClassComponent<Props> | keyof React.JSX.IntrinsicElements;
|
|
4
4
|
interface NestedOrgComponents {
|
|
5
5
|
[key: string]: NestedOrgComponents | Component<any>;
|
|
6
6
|
}
|
|
7
7
|
export type OrgComponents = NestedOrgComponents & {
|
|
8
|
-
[Key in keyof JSX.IntrinsicElements]?: Component<JSX.IntrinsicElements[Key]>;
|
|
8
|
+
[Key in keyof React.JSX.IntrinsicElements]?: Component<React.JSX.IntrinsicElements[Key]>;
|
|
9
9
|
} & {
|
|
10
10
|
/**
|
|
11
11
|
* If a wrapper component is defined, the org content will be wrapped inside of it.
|
|
@@ -23,14 +23,14 @@ export interface OrgProps {
|
|
|
23
23
|
*/
|
|
24
24
|
components?: OrgComponents;
|
|
25
25
|
}
|
|
26
|
-
export type OrgContent = (props: OrgProps) => JSX.Element;
|
|
26
|
+
export type OrgContent = (props: OrgProps) => React.JSX.Element;
|
|
27
27
|
export interface OrgModule {
|
|
28
28
|
/**
|
|
29
29
|
* This could be any value that is exported from the org file.
|
|
30
30
|
*/
|
|
31
31
|
[key: string]: unknown;
|
|
32
32
|
/**
|
|
33
|
-
* A functional JSX component which renders the content of the org file.
|
|
33
|
+
* A functional React.JSX component which renders the content of the org file.
|
|
34
34
|
*/
|
|
35
35
|
default: OrgContent;
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../lib/compile.js","../lib/core.js","../lib/evaluate.js","../lib/run.js","../lib/types.ts","../lib/plugin/recma-build-jsx-transform.js","../lib/plugin/recma-document.js","../lib/plugin/recma-jsx-rewrite.js","../lib/plugin/rehype-recma.js","../lib/util/estree-util-create.js","../lib/util/estree-util-declaration-to-expression.js","../lib/util/estree-util-is-declaration.js","../lib/util/estree-util-specifiers-to-declarations.js","../lib/util/estree-util-to-binary-addition.js","../lib/util/estree-util-to-id-or-member-expression.js","../lib/util/render-error.js","../lib/util/resolve-evaluate-options.js","../lib/util/resolve-file-and-options.js","../index.js"],"version":"5.7.3"}
|
|
1
|
+
{"root":["../lib/compile.js","../lib/core.js","../lib/evaluate.js","../lib/run.js","../lib/types.ts","../lib/plugin/recma-build-jsx-transform.js","../lib/plugin/recma-document.js","../lib/plugin/recma-jsx-rewrite.js","../lib/plugin/rehype-recma.js","../lib/util/estree-util-create.js","../lib/util/estree-util-declaration-to-expression.js","../lib/util/estree-util-is-declaration.js","../lib/util/estree-util-specifiers-to-declarations.js","../lib/util/estree-util-to-binary-addition.js","../lib/util/estree-util-to-id-or-member-expression.js","../lib/util/is-org-content.js","../lib/util/render-error.js","../lib/util/resolve-evaluate-options.js","../lib/util/resolve-file-and-options.js","../index.js"],"version":"5.7.3"}
|
package/index.js
CHANGED
|
@@ -12,3 +12,4 @@ export { createProcessor } from './lib/core.js'
|
|
|
12
12
|
export { compile, compileSync } from './lib/compile.js'
|
|
13
13
|
export { evaluate, evaluateSync } from './lib/evaluate.js'
|
|
14
14
|
export { run, runSync } from './lib/run.js'
|
|
15
|
+
export { isOrgContent } from './lib/util/is-org-content.js'
|
package/lib/types.ts
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
|
-
type FunctionComponent<Props> = (props: Props) => JSX.Element | null
|
|
2
|
-
type ClassComponent<Props> = new (props: Props) => JSX.ElementClass
|
|
1
|
+
type FunctionComponent<Props> = (props: Props) => React.JSX.Element | null
|
|
2
|
+
type ClassComponent<Props> = new (props: Props) => React.JSX.ElementClass
|
|
3
3
|
type Component<Props> =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
| FunctionComponent<Props>
|
|
5
|
+
| ClassComponent<Props>
|
|
6
|
+
| keyof React.JSX.IntrinsicElements
|
|
7
7
|
|
|
8
8
|
interface NestedOrgComponents {
|
|
9
|
-
|
|
9
|
+
[key: string]: NestedOrgComponents | Component<any>
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export type OrgComponents = NestedOrgComponents & {
|
|
13
|
-
|
|
13
|
+
[Key in keyof React.JSX.IntrinsicElements]?: Component<
|
|
14
|
+
React.JSX.IntrinsicElements[Key]
|
|
15
|
+
>
|
|
14
16
|
} & {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* If a wrapper component is defined, the org content will be wrapped inside of it.
|
|
19
|
+
*/
|
|
20
|
+
wrapper?: Component<any>
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export interface OrgProps {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Which props exactly may be passed into the component depends on the contents of the org
|
|
26
|
+
* file.
|
|
27
|
+
*/
|
|
28
|
+
[key: string]: unknown
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* This prop may be used to customize how certain components are rendered.
|
|
32
|
+
*/
|
|
33
|
+
components?: OrgComponents
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
export type OrgContent = (props: OrgProps) => JSX.Element
|
|
36
|
+
export type OrgContent = (props: OrgProps) => React.JSX.Element
|
|
35
37
|
|
|
36
38
|
export interface OrgModule {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* This could be any value that is exported from the org file.
|
|
41
|
+
*/
|
|
42
|
+
[key: string]: unknown
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
/**
|
|
45
|
+
* A functional React.JSX component which renders the content of the org file.
|
|
46
|
+
*/
|
|
47
|
+
default: OrgContent
|
|
46
48
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a node is an org content node.
|
|
3
|
+
* @param {import('react').ReactNode} node
|
|
4
|
+
* @returns {boolean}
|
|
5
|
+
*/
|
|
6
|
+
export function isOrgContent(node) {
|
|
7
|
+
return (
|
|
8
|
+
!!node &&
|
|
9
|
+
typeof node === 'object' &&
|
|
10
|
+
'type' in node &&
|
|
11
|
+
typeof node.type === 'function' &&
|
|
12
|
+
node.type.name === 'OrgContent'
|
|
13
|
+
)
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orgajs/orgx",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "orga compiler with jsx support",
|
|
5
5
|
"author": "Xiaoxing Hu <hi@xiaoxing.dev>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"@types/estree-jsx": "^1.0.5",
|
|
30
30
|
"@types/hast": "^3.0.4",
|
|
31
31
|
"@types/node": "^20.5.7",
|
|
32
|
-
"@types/react": "^
|
|
33
|
-
"react": "^
|
|
34
|
-
"react-dom": "^
|
|
32
|
+
"@types/react": "^19.0.8",
|
|
33
|
+
"react": "^19.0.0",
|
|
34
|
+
"react-dom": "^19.0.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"acorn": "^8.14.0",
|