@monbolc/lowcode-renderer-core 2.1.5 → 2.1.6
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/LICENSE +21 -0
- package/es/adapter.js +124 -0
- package/es/adapter.js.map +1 -0
- package/es/base.js +53 -0
- package/es/base.js.map +1 -0
- package/es/index.js +10 -0
- package/es/index.js.map +1 -0
- package/es/renderer.js +74 -0
- package/es/renderer.js.map +1 -0
- package/es/types.js +8 -0
- package/es/types.js.map +1 -0
- package/package.json +7 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 monbo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/es/adapter.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @monbolc/lowcode-renderer-core — Adapter
|
|
3
|
+
*
|
|
4
|
+
* Singleton that holds the injected framework runtime. Renderers read
|
|
5
|
+
* from here instead of importing React directly. This keeps
|
|
6
|
+
* renderer-core framework-agnostic — a Vue or Solid adapter could be
|
|
7
|
+
* plugged in by setting a different runtime.
|
|
8
|
+
*/
|
|
9
|
+
import { uid } from '@monbolc/lowcode-utils';
|
|
10
|
+
/**
|
|
11
|
+
* The names of runtime fields that must be present for a runtime to
|
|
12
|
+
* be considered valid. `findDOMNode` is optional because React 19
|
|
13
|
+
* removed it.
|
|
14
|
+
*/
|
|
15
|
+
const REQUIRED_RUNTIME_MODULES = [
|
|
16
|
+
'Component',
|
|
17
|
+
'PureComponent',
|
|
18
|
+
'createElement',
|
|
19
|
+
'createContext',
|
|
20
|
+
'forwardRef',
|
|
21
|
+
];
|
|
22
|
+
class Adapter {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.id = uid('adapter');
|
|
25
|
+
this.renderers = {};
|
|
26
|
+
this.env = 'unknown';
|
|
27
|
+
this.runtime = this.makeStubRuntime();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Install a real runtime. Throws if required modules are missing.
|
|
31
|
+
*/
|
|
32
|
+
setRuntime(runtime) {
|
|
33
|
+
if (!this.isValidRuntime(runtime)) {
|
|
34
|
+
throw new Error(`[adapter:${this.id}] runtime is invalid — missing one of ${REQUIRED_RUNTIME_MODULES.join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
this.runtime = runtime;
|
|
37
|
+
this.env = 'react'; // best guess; concrete adapter overrides if needed
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Reset the runtime to the no-op stub. Useful in tests.
|
|
41
|
+
*/
|
|
42
|
+
initRuntime() {
|
|
43
|
+
this.runtime = this.makeStubRuntime();
|
|
44
|
+
this.env = 'unknown';
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Check that all required runtime modules are present (and not null).
|
|
48
|
+
*/
|
|
49
|
+
isValidRuntime(runtime) {
|
|
50
|
+
if (!runtime || typeof runtime !== 'object')
|
|
51
|
+
return false;
|
|
52
|
+
for (const key of REQUIRED_RUNTIME_MODULES) {
|
|
53
|
+
if (runtime[key] === undefined || runtime[key] === null) {
|
|
54
|
+
throw new Error(`[adapter] runtime is missing required module "${key}"`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
getRuntime() {
|
|
60
|
+
return this.runtime;
|
|
61
|
+
}
|
|
62
|
+
setEnv(env) {
|
|
63
|
+
this.env = env;
|
|
64
|
+
}
|
|
65
|
+
isReact() {
|
|
66
|
+
return this.env === 'react';
|
|
67
|
+
}
|
|
68
|
+
setRenderers(renderers) {
|
|
69
|
+
this.renderers = renderers;
|
|
70
|
+
}
|
|
71
|
+
getRenderers() {
|
|
72
|
+
return this.renderers;
|
|
73
|
+
}
|
|
74
|
+
setConfigProvider(component) {
|
|
75
|
+
this.configProvider = component;
|
|
76
|
+
}
|
|
77
|
+
getConfigProvider() {
|
|
78
|
+
return this.configProvider;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Walk the configured renderers and find one whose name matches the
|
|
82
|
+
* provided schema's `componentName`. Returns `undefined` if no match.
|
|
83
|
+
*/
|
|
84
|
+
pickRenderer(schema) {
|
|
85
|
+
const name = schema.componentName ?? '';
|
|
86
|
+
// Convention: schema.componentName === 'Page' → PageRenderer; etc.
|
|
87
|
+
if (name === 'Page' || name === 'PageRenderer')
|
|
88
|
+
return this.renderers.PageRenderer;
|
|
89
|
+
if (name === 'Block' || name === 'BlockRenderer')
|
|
90
|
+
return this.renderers.BlockRenderer;
|
|
91
|
+
if (name === 'Addon' || name === 'AddonRenderer')
|
|
92
|
+
return this.renderers.AddonRenderer;
|
|
93
|
+
if (name === 'Temp' || name === 'TempRenderer')
|
|
94
|
+
return this.renderers.TempRenderer;
|
|
95
|
+
if (name === 'Div' || name === 'DivRenderer')
|
|
96
|
+
return this.renderers.DivRenderer;
|
|
97
|
+
return this.renderers.ComponentRenderer;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* A no-op runtime for environments that have not yet injected one
|
|
101
|
+
* (e.g. during tests, or before the React adapter loads).
|
|
102
|
+
*/
|
|
103
|
+
makeStubRuntime() {
|
|
104
|
+
return {
|
|
105
|
+
Component: class Stub {
|
|
106
|
+
setState() { }
|
|
107
|
+
forceUpdate() { }
|
|
108
|
+
render() { return null; }
|
|
109
|
+
},
|
|
110
|
+
PureComponent: class Stub {
|
|
111
|
+
setState() { }
|
|
112
|
+
forceUpdate() { }
|
|
113
|
+
render() { return null; }
|
|
114
|
+
},
|
|
115
|
+
createElement: () => null,
|
|
116
|
+
createContext: () => ({ Provider: () => null, Consumer: () => null }),
|
|
117
|
+
forwardRef: (fn) => fn,
|
|
118
|
+
findDOMNode: () => null,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/** Process-wide singleton. */
|
|
123
|
+
export const adapter = new Adapter();
|
|
124
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAS7C;;;;GAIG;AACH,MAAM,wBAAwB,GAAkC;IAC9D,WAAW;IACX,eAAe;IACf,eAAe;IACf,eAAe;IACf,YAAY;CACb,CAAC;AAEF,MAAM,OAAO;IAOX;QANS,OAAE,GAAW,GAAG,CAAC,SAAS,CAAC,CAAC;QAErC,cAAS,GAA8B,EAAE,CAAC;QAE1C,QAAG,GAAwB,SAAS,CAAC;QAGnC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,EA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C,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;YACrE,UAAU,EAAE,CAAC,EAAW,EAAE,EAAE,CAAC,EAAE;YAC/B,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI;SACxB,CAAC;IACJ,CAAC;CACF;AAED,8BAA8B;AAC9B,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC"}
|
package/es/base.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @monbolc/lowcode-renderer-core — BaseRenderer
|
|
3
|
+
*
|
|
4
|
+
* A thin wrapper around the runtime's `Component` class that handles
|
|
5
|
+
* common renderer concerns: ref capture, error boundary, child
|
|
6
|
+
* dispatch. Renderers built on top of this class remain framework-
|
|
7
|
+
* agnostic because they call `createElement(...)` from the runtime.
|
|
8
|
+
*/
|
|
9
|
+
import { adapter } from './adapter.js';
|
|
10
|
+
/**
|
|
11
|
+
* Base class for all renderers. Holds the runtime-provided Component
|
|
12
|
+
* and provides a `render()` that subclasses override.
|
|
13
|
+
*
|
|
14
|
+
* Concrete renderers (Page, Component, Block, ...) extend this class
|
|
15
|
+
* and use the `createElement` from the runtime — they never import
|
|
16
|
+
* React directly.
|
|
17
|
+
*/
|
|
18
|
+
export class BaseRenderer {
|
|
19
|
+
constructor(props) {
|
|
20
|
+
this.state = {};
|
|
21
|
+
// Lifecycle methods below are typed as plain functions; the runtime
|
|
22
|
+
// wrapper (React 19, etc.) is responsible for invoking them. This
|
|
23
|
+
// keeps the base class framework-agnostic.
|
|
24
|
+
this.setState = () => undefined;
|
|
25
|
+
this.forceUpdate = () => undefined;
|
|
26
|
+
/** Capture a ref to this renderer instance, e.g. for editor selection. */
|
|
27
|
+
this.__getRef = (ref) => {
|
|
28
|
+
this.__ref = ref;
|
|
29
|
+
if (ref && this.props.onCompGetRef) {
|
|
30
|
+
this.props.onCompGetRef(this.props.schema, ref);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
this.props = props;
|
|
34
|
+
}
|
|
35
|
+
/** Subclass-overridable render method. */
|
|
36
|
+
render() {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Factory helper: ensure the adapter's runtime is loaded before any
|
|
42
|
+
* renderer factory is called. Concrete renderers are responsible for
|
|
43
|
+
* using `createElement` to wrap their render output — they should
|
|
44
|
+
* NOT subclass the runtime's Component.
|
|
45
|
+
*/
|
|
46
|
+
export function ensureRuntimeLoaded() {
|
|
47
|
+
const runtime = adapter.getRuntime();
|
|
48
|
+
if (!runtime.Component) {
|
|
49
|
+
throw new Error('[renderer-core] no Component in adapter runtime. ' +
|
|
50
|
+
'Did you forget to call adapter.setRuntime({...})?');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=base.js.map
|
package/es/base.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC;;;;;;;GAOG;AACH,MAAM,OAAO,YAAY;IAWvB,YAAY,KAAqB;QATjC,UAAK,GAAmB,EAAE,CAAC;QAG3B,oEAAoE;QACpE,kEAAkE;QAClE,2CAA2C;QAC3C,aAAQ,GAAoE,GAAG,EAAE,CAAC,SAAS,CAAC;QAC5F,gBAAW,GAAoC,GAAG,EAAE,CAAC,SAAS,CAAC;QAoB/D,0EAA0E;QAC1E,aAAQ,GAAG,CAAC,GAAY,EAAE,EAAE;YAC1B,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;YACjB,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;gBACnC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAClD,CAAC;QACH,CAAC,CAAC;QAvBA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,0CAA0C;IAC1C,MAAM;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;CAkBF;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IACrC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,mDAAmD;YACjD,mDAAmD,CACtD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/es/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @monbolc/lowcode-renderer-core — barrel export
|
|
3
|
+
*
|
|
4
|
+
* SapuLowcodeEngine renderer abstractions (L2). Framework-agnostic — the
|
|
5
|
+
* concrete React implementation is in @monbolc/lowcode-react-renderer.
|
|
6
|
+
*/
|
|
7
|
+
export { adapter } from './adapter.js';
|
|
8
|
+
export { BaseRenderer, ensureRuntimeLoaded } from './base.js';
|
|
9
|
+
export { PageRenderer, ComponentRenderer, BlockRenderer, AddonRenderer, TempRenderer, DivRenderer, pageRendererFactory, componentRendererFactory, blockRendererFactory, addonRendererFactory, tempRendererFactory, divRendererFactory, } from './renderer.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
package/es/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
package/es/renderer.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @monbolc/lowcode-renderer-core — renderer factory functions
|
|
3
|
+
*
|
|
4
|
+
* Each factory returns a class that, when instantiated, renders a
|
|
5
|
+
* particular kind of node from the schema:
|
|
6
|
+
* - PageRenderer — root schema
|
|
7
|
+
* - ComponentRenderer — any non-special node
|
|
8
|
+
* - BlockRenderer — block of components
|
|
9
|
+
* - AddonRenderer — read-only "add-on" node (e.g. comments)
|
|
10
|
+
* - TempRenderer — placeholder / loading
|
|
11
|
+
*
|
|
12
|
+
* For now the renderers are minimal stubs that return null. The
|
|
13
|
+
* concrete React-based implementations live in
|
|
14
|
+
* @monbolc/lowcode-react-renderer, which calls `adapter.setRenderers(...)`
|
|
15
|
+
* at boot to install richer versions.
|
|
16
|
+
*/
|
|
17
|
+
import { BaseRenderer } from './base.js';
|
|
18
|
+
/** Renderer for a Page node (root schema). */
|
|
19
|
+
export class PageRenderer extends BaseRenderer {
|
|
20
|
+
render() {
|
|
21
|
+
// Real implementation is plugged in by @monbolc/lowcode-react-renderer.
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Renderer for an arbitrary component. */
|
|
26
|
+
export class ComponentRenderer extends BaseRenderer {
|
|
27
|
+
render() {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Renderer for a Block (a static block of components, no per-component meta). */
|
|
32
|
+
export class BlockRenderer extends BaseRenderer {
|
|
33
|
+
render() {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** Renderer for an Addon (a UI overlay, like a comment indicator). */
|
|
38
|
+
export class AddonRenderer extends BaseRenderer {
|
|
39
|
+
render() {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Renderer for a Temp placeholder (used while data is loading). */
|
|
44
|
+
export class TempRenderer extends BaseRenderer {
|
|
45
|
+
render() {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** Renderer for an inert Div fallback. */
|
|
50
|
+
export class DivRenderer extends BaseRenderer {
|
|
51
|
+
render() {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Factory form: returns a class. Mostly here for API symmetry. */
|
|
56
|
+
export function pageRendererFactory() {
|
|
57
|
+
return PageRenderer;
|
|
58
|
+
}
|
|
59
|
+
export function componentRendererFactory() {
|
|
60
|
+
return ComponentRenderer;
|
|
61
|
+
}
|
|
62
|
+
export function blockRendererFactory() {
|
|
63
|
+
return BlockRenderer;
|
|
64
|
+
}
|
|
65
|
+
export function addonRendererFactory() {
|
|
66
|
+
return AddonRenderer;
|
|
67
|
+
}
|
|
68
|
+
export function tempRendererFactory() {
|
|
69
|
+
return TempRenderer;
|
|
70
|
+
}
|
|
71
|
+
export function divRendererFactory() {
|
|
72
|
+
return DivRenderer;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,8CAA8C;AAC9C,MAAM,OAAO,YAAa,SAAQ,YAAY;IACnC,MAAM;QACb,wEAAwE;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,2CAA2C;AAC3C,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACxC,MAAM;QACb,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,kFAAkF;AAClF,MAAM,OAAO,aAAc,SAAQ,YAAY;IACpC,MAAM;QACb,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,sEAAsE;AACtE,MAAM,OAAO,aAAc,SAAQ,YAAY;IACpC,MAAM;QACb,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,oEAAoE;AACpE,MAAM,OAAO,YAAa,SAAQ,YAAY;IACnC,MAAM;QACb,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,0CAA0C;AAC1C,MAAM,OAAO,WAAY,SAAQ,YAAY;IAClC,MAAM;QACb,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,mEAAmE;AACnE,MAAM,UAAU,mBAAmB;IACjC,OAAO,YAA2C,CAAC;AACrD,CAAC;AACD,MAAM,UAAU,wBAAwB;IACtC,OAAO,iBAAgD,CAAC;AAC1D,CAAC;AACD,MAAM,UAAU,oBAAoB;IAClC,OAAO,aAA4C,CAAC;AACtD,CAAC;AACD,MAAM,UAAU,oBAAoB;IAClC,OAAO,aAA4C,CAAC;AACtD,CAAC;AACD,MAAM,UAAU,mBAAmB;IACjC,OAAO,YAA2C,CAAC;AACrD,CAAC;AACD,MAAM,UAAU,kBAAkB;IAChC,OAAO,WAA0C,CAAC;AACpD,CAAC"}
|
package/es/types.js
ADDED
package/es/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monbolc/lowcode-renderer-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6",
|
|
4
4
|
"description": "Framework-agnostic renderer core with React-runtime adapter for SapuLowcodeEngine (L2)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"lib",
|
|
18
|
-
"es"
|
|
18
|
+
"es",
|
|
19
|
+
"LICENSE"
|
|
19
20
|
],
|
|
20
21
|
"scripts": {
|
|
21
|
-
"build": "
|
|
22
|
+
"build": "npm run build:cjs && npm run build:es",
|
|
22
23
|
"build:es": "tsc -p tsconfig.esm.json && node ../../scripts/add-js-extensions.mjs es",
|
|
23
|
-
"clean": "rimraf lib es"
|
|
24
|
+
"clean": "rimraf lib es",
|
|
25
|
+
"build:cjs": "tsc -p tsconfig.json"
|
|
24
26
|
},
|
|
25
27
|
"dependencies": {
|
|
26
28
|
"@monbolc/lowcode-types": "^2.1.5",
|
|
@@ -61,5 +63,5 @@
|
|
|
61
63
|
"renderer",
|
|
62
64
|
"react"
|
|
63
65
|
],
|
|
64
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "11e98f766bf66eabdae929d0103f798654f13dfb"
|
|
65
67
|
}
|