@dxos/plugin-script 0.6.8-main.046e6cf
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 +8 -0
- package/README.md +4 -0
- package/dist/lib/browser/ScriptEditor-6Q7HFLJ6.mjs +220 -0
- package/dist/lib/browser/ScriptEditor-6Q7HFLJ6.mjs.map +7 -0
- package/dist/lib/browser/TypescriptEditor-HP35MTEQ.mjs +9 -0
- package/dist/lib/browser/TypescriptEditor-HP35MTEQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-2EM5Y66A.mjs +60 -0
- package/dist/lib/browser/chunk-2EM5Y66A.mjs.map +7 -0
- package/dist/lib/browser/chunk-EZ7PWOLU.mjs +235 -0
- package/dist/lib/browser/chunk-EZ7PWOLU.mjs.map +7 -0
- package/dist/lib/browser/chunk-JBACGDOJ.mjs +21 -0
- package/dist/lib/browser/chunk-JBACGDOJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-Z72YKDJ2.mjs +31 -0
- package/dist/lib/browser/chunk-Z72YKDJ2.mjs.map +7 -0
- package/dist/lib/browser/edge/index.mjs +19 -0
- package/dist/lib/browser/edge/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +395 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/browser/meta.mjs +9 -0
- package/dist/lib/browser/meta.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -0
- package/dist/lib/browser/types/index.mjs.map +7 -0
- package/dist/lib/node/ScriptEditor-AIVKL2NX.cjs +239 -0
- package/dist/lib/node/ScriptEditor-AIVKL2NX.cjs.map +7 -0
- package/dist/lib/node/TypescriptEditor-PWOAN5RQ.cjs +30 -0
- package/dist/lib/node/TypescriptEditor-PWOAN5RQ.cjs.map +7 -0
- package/dist/lib/node/chunk-4VMNBXWU.cjs +54 -0
- package/dist/lib/node/chunk-4VMNBXWU.cjs.map +7 -0
- package/dist/lib/node/chunk-6Y2S6SGK.cjs +49 -0
- package/dist/lib/node/chunk-6Y2S6SGK.cjs.map +7 -0
- package/dist/lib/node/chunk-LWUBFTPA.cjs +253 -0
- package/dist/lib/node/chunk-LWUBFTPA.cjs.map +7 -0
- package/dist/lib/node/chunk-SLV3SDZE.cjs +93 -0
- package/dist/lib/node/chunk-SLV3SDZE.cjs.map +7 -0
- package/dist/lib/node/edge/index.cjs +41 -0
- package/dist/lib/node/edge/index.cjs.map +7 -0
- package/dist/lib/node/index.cjs +417 -0
- package/dist/lib/node/index.cjs.map +7 -0
- package/dist/lib/node/meta.cjs +30 -0
- package/dist/lib/node/meta.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -0
- package/dist/lib/node/types/index.cjs +32 -0
- package/dist/lib/node/types/index.cjs.map +7 -0
- package/dist/types/src/ScriptPlugin.d.ts +7 -0
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -0
- package/dist/types/src/compiler/compiler.d.ts +38 -0
- package/dist/types/src/compiler/compiler.d.ts.map +1 -0
- package/dist/types/src/compiler/compiler.test.d.ts +2 -0
- package/dist/types/src/compiler/compiler.test.d.ts.map +1 -0
- package/dist/types/src/compiler/index.d.ts +2 -0
- package/dist/types/src/compiler/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/FrameContainer/FrameContainer.d.ts +12 -0
- package/dist/types/src/components/ScriptBlock/FrameContainer/FrameContainer.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/FrameContainer/frame.d.ts +2 -0
- package/dist/types/src/components/ScriptBlock/FrameContainer/frame.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/FrameContainer/index.d.ts +2 -0
- package/dist/types/src/components/ScriptBlock/FrameContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts +18 -0
- package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts +14 -0
- package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/Splitter/Splitter.d.ts +15 -0
- package/dist/types/src/components/ScriptBlock/Splitter/Splitter.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/Splitter/Splitter.stories.d.ts +13 -0
- package/dist/types/src/components/ScriptBlock/Splitter/Splitter.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/Splitter/index.d.ts +2 -0
- package/dist/types/src/components/ScriptBlock/Splitter/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/index.d.ts +2 -0
- package/dist/types/src/components/ScriptBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptEditor.d.ts +9 -0
- package/dist/types/src/components/ScriptEditor.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar.d.ts +11 -0
- package/dist/types/src/components/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar.stories.d.ts +16 -0
- package/dist/types/src/components/Toolbar.stories.d.ts.map +1 -0
- package/dist/types/src/components/TypescriptEditor.d.ts +10 -0
- package/dist/types/src/components/TypescriptEditor.d.ts.map +1 -0
- package/dist/types/src/components/TypescriptEditor.stories.d.ts +13 -0
- package/dist/types/src/components/TypescriptEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +4 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/edge/codec.d.ts +4 -0
- package/dist/types/src/edge/codec.d.ts.map +1 -0
- package/dist/types/src/edge/functions.d.ts +23 -0
- package/dist/types/src/edge/functions.d.ts.map +1 -0
- package/dist/types/src/edge/header-codec.d.ts +24 -0
- package/dist/types/src/edge/header-codec.d.ts.map +1 -0
- package/dist/types/src/edge/hub-protocol.d.ts +6 -0
- package/dist/types/src/edge/hub-protocol.d.ts.map +1 -0
- package/dist/types/src/edge/index.d.ts +5 -0
- package/dist/types/src/edge/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +7 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +15 -0
- package/dist/types/src/meta.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +19 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/script.d.ts +26 -0
- package/dist/types/src/types/script.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +8 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/package.json +120 -0
- package/src/ScriptPlugin.tsx +137 -0
- package/src/compiler/compiler.test.ts +17 -0
- package/src/compiler/compiler.ts +210 -0
- package/src/compiler/index.ts +5 -0
- package/src/components/ScriptBlock/FrameContainer/FrameContainer.tsx +82 -0
- package/src/components/ScriptBlock/FrameContainer/frame.html +25 -0
- package/src/components/ScriptBlock/FrameContainer/frame.tsx +51 -0
- package/src/components/ScriptBlock/FrameContainer/index.ts +5 -0
- package/src/components/ScriptBlock/ScriptBlock.stories.tsx +64 -0
- package/src/components/ScriptBlock/ScriptBlock.tsx +132 -0
- package/src/components/ScriptBlock/Splitter/Splitter.stories.tsx +37 -0
- package/src/components/ScriptBlock/Splitter/Splitter.tsx +52 -0
- package/src/components/ScriptBlock/Splitter/index.ts +5 -0
- package/src/components/ScriptBlock/index.ts +5 -0
- package/src/components/ScriptEditor.tsx +113 -0
- package/src/components/Toolbar.stories.tsx +19 -0
- package/src/components/Toolbar.tsx +163 -0
- package/src/components/TypescriptEditor.stories.tsx +63 -0
- package/src/components/TypescriptEditor.tsx +66 -0
- package/src/components/index.ts +8 -0
- package/src/edge/codec.ts +13 -0
- package/src/edge/functions.ts +128 -0
- package/src/edge/header-codec.ts +97 -0
- package/src/edge/hub-protocol.ts +27 -0
- package/src/edge/index.ts +10 -0
- package/src/index.ts +13 -0
- package/src/meta.tsx +19 -0
- package/src/translations.ts +25 -0
- package/src/types/index.ts +6 -0
- package/src/types/script.ts +16 -0
- package/src/types/types.tsx +27 -0
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var node_exports = {};
|
|
30
|
+
__export(node_exports, {
|
|
31
|
+
Compiler: () => Compiler,
|
|
32
|
+
ScriptAction: () => import_chunk_6Y2S6SGK.ScriptAction,
|
|
33
|
+
ScriptEditor: () => ScriptEditor,
|
|
34
|
+
ScriptPlugin: () => ScriptPlugin,
|
|
35
|
+
ScriptType: () => import_chunk_6Y2S6SGK.ScriptType,
|
|
36
|
+
TypescriptEditor: () => TypescriptEditor,
|
|
37
|
+
default: () => src_default,
|
|
38
|
+
initializeCompiler: () => initializeCompiler
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(node_exports);
|
|
41
|
+
var import_chunk_6Y2S6SGK = require("./chunk-6Y2S6SGK.cjs");
|
|
42
|
+
var import_chunk_4VMNBXWU = require("./chunk-4VMNBXWU.cjs");
|
|
43
|
+
var import_react = require("@phosphor-icons/react");
|
|
44
|
+
var import_react2 = __toESM(require("react"));
|
|
45
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
46
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
47
|
+
var import_plugin_client = require("@dxos/plugin-client");
|
|
48
|
+
var import_plugin_graph = require("@dxos/plugin-graph");
|
|
49
|
+
var import_types = require("@dxos/plugin-markdown/types");
|
|
50
|
+
var import_plugin_space = require("@dxos/plugin-space");
|
|
51
|
+
var import_echo = require("@dxos/react-client/echo");
|
|
52
|
+
var import_react3 = __toESM(require("react"));
|
|
53
|
+
var import_esbuild_wasm = require("esbuild-wasm");
|
|
54
|
+
var import_crypto = require("@dxos/crypto");
|
|
55
|
+
var import_invariant = require("@dxos/invariant");
|
|
56
|
+
var ScriptEditor = import_react3.default.lazy(() => import("./ScriptEditor-AIVKL2NX.cjs"));
|
|
57
|
+
var TypescriptEditor = import_react3.default.lazy(() => import("./TypescriptEditor-PWOAN5RQ.cjs"));
|
|
58
|
+
var translations_default = [
|
|
59
|
+
{
|
|
60
|
+
"en-US": {
|
|
61
|
+
[import_chunk_4VMNBXWU.SCRIPT_PLUGIN]: {
|
|
62
|
+
"plugin name": "Scripts",
|
|
63
|
+
"object title placeholder": "New script",
|
|
64
|
+
"create object label": "Create script",
|
|
65
|
+
"create stack section label": "Create script",
|
|
66
|
+
"binding label": "Binding",
|
|
67
|
+
"binding placeholder": "Enter binding",
|
|
68
|
+
"edit binding label": "Edit binding",
|
|
69
|
+
"deploy label": "Deploy",
|
|
70
|
+
"deployed label": "Current version of the script is deployed",
|
|
71
|
+
"upload failed label": "Upload failed",
|
|
72
|
+
"copy link label": "Copy function link"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
var ScriptPlugin = ({ containerUrl }) => {
|
|
78
|
+
return {
|
|
79
|
+
meta: import_chunk_4VMNBXWU.meta_default,
|
|
80
|
+
provides: {
|
|
81
|
+
metadata: {
|
|
82
|
+
records: {
|
|
83
|
+
[import_chunk_6Y2S6SGK.ScriptType.typename]: {
|
|
84
|
+
placeholder: [
|
|
85
|
+
"object title placeholder",
|
|
86
|
+
{
|
|
87
|
+
ns: import_chunk_4VMNBXWU.SCRIPT_PLUGIN
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
icon: (props) => /* @__PURE__ */ import_react2.default.createElement(import_react.Code, props),
|
|
91
|
+
iconSymbol: "ph--code--regular",
|
|
92
|
+
// TODO(wittjosiah): Move out of metadata.
|
|
93
|
+
loadReferences: (script) => (0, import_echo.loadObjectReferences)(script, (script2) => [
|
|
94
|
+
script2.source
|
|
95
|
+
])
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
translations: translations_default,
|
|
100
|
+
echo: {
|
|
101
|
+
schema: [
|
|
102
|
+
import_chunk_6Y2S6SGK.ScriptType
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
graph: {
|
|
106
|
+
builder: (plugins) => {
|
|
107
|
+
const client = (0, import_app_framework.resolvePlugin)(plugins, import_plugin_client.parseClientPlugin)?.provides.client;
|
|
108
|
+
const dispatch = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin)?.provides.intent.dispatch;
|
|
109
|
+
if (!client || !dispatch) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
return (0, import_plugin_graph.createExtension)({
|
|
113
|
+
id: import_chunk_6Y2S6SGK.ScriptAction.CREATE,
|
|
114
|
+
filter: (node) => (0, import_plugin_graph.isActionGroup)(node) && node.id.startsWith(import_plugin_space.SpaceAction.ADD_OBJECT),
|
|
115
|
+
actions: ({ node }) => {
|
|
116
|
+
const id = node.id.split("/").at(-1);
|
|
117
|
+
const [spaceId, objectId] = id?.split(":") ?? [];
|
|
118
|
+
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
119
|
+
const object = objectId && space?.db.getObjectById(objectId);
|
|
120
|
+
const target = objectId ? object : space;
|
|
121
|
+
if (!target) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
return [
|
|
125
|
+
{
|
|
126
|
+
id: `${import_chunk_4VMNBXWU.SCRIPT_PLUGIN}/create/${node.id}`,
|
|
127
|
+
data: async () => {
|
|
128
|
+
await dispatch([
|
|
129
|
+
{
|
|
130
|
+
plugin: import_chunk_4VMNBXWU.SCRIPT_PLUGIN,
|
|
131
|
+
action: import_chunk_6Y2S6SGK.ScriptAction.CREATE
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
action: import_plugin_space.SpaceAction.ADD_OBJECT,
|
|
135
|
+
data: {
|
|
136
|
+
target
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
action: import_app_framework.NavigationAction.OPEN
|
|
141
|
+
}
|
|
142
|
+
]);
|
|
143
|
+
},
|
|
144
|
+
properties: {
|
|
145
|
+
label: [
|
|
146
|
+
"create object label",
|
|
147
|
+
{
|
|
148
|
+
ns: import_chunk_4VMNBXWU.SCRIPT_PLUGIN
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
icon: (props) => /* @__PURE__ */ import_react2.default.createElement(import_react.Code, props),
|
|
152
|
+
iconSymbol: "ph--code--regular",
|
|
153
|
+
testId: "scriptPlugin.createObject"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
stack: {
|
|
162
|
+
creators: [
|
|
163
|
+
{
|
|
164
|
+
id: "create-stack-section-script",
|
|
165
|
+
testId: "scriptPlugin.createSectionSpaceScript",
|
|
166
|
+
type: [
|
|
167
|
+
"plugin name",
|
|
168
|
+
{
|
|
169
|
+
ns: import_chunk_4VMNBXWU.SCRIPT_PLUGIN
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
label: [
|
|
173
|
+
"create stack section label",
|
|
174
|
+
{
|
|
175
|
+
ns: import_chunk_4VMNBXWU.SCRIPT_PLUGIN
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
icon: (props) => /* @__PURE__ */ import_react2.default.createElement(import_react.Code, props),
|
|
179
|
+
intent: {
|
|
180
|
+
plugin: import_chunk_4VMNBXWU.SCRIPT_PLUGIN,
|
|
181
|
+
action: import_chunk_6Y2S6SGK.ScriptAction.CREATE
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
surface: {
|
|
187
|
+
component: ({ data, role }) => {
|
|
188
|
+
if (role && ![
|
|
189
|
+
"article",
|
|
190
|
+
"section"
|
|
191
|
+
].includes(role)) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
if (data.object instanceof import_chunk_6Y2S6SGK.ScriptType) {
|
|
195
|
+
return /* @__PURE__ */ import_react2.default.createElement(ScriptEditor, {
|
|
196
|
+
script: data.object,
|
|
197
|
+
role
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
intent: {
|
|
204
|
+
resolver: (intent) => {
|
|
205
|
+
switch (intent.action) {
|
|
206
|
+
case import_chunk_6Y2S6SGK.ScriptAction.CREATE: {
|
|
207
|
+
return {
|
|
208
|
+
data: (0, import_echo_schema.create)(import_chunk_6Y2S6SGK.ScriptType, {
|
|
209
|
+
source: (0, import_echo_schema.create)(import_types.TextType, {
|
|
210
|
+
content: example
|
|
211
|
+
})
|
|
212
|
+
})
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
var example = [
|
|
222
|
+
"export default {",
|
|
223
|
+
" async fetch(request, env, ctx) {",
|
|
224
|
+
" return new Response('Hello World, from ScriptPlugin!');",
|
|
225
|
+
" }",
|
|
226
|
+
"}",
|
|
227
|
+
""
|
|
228
|
+
].join("\n");
|
|
229
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/compiler/compiler.ts";
|
|
230
|
+
var initialized;
|
|
231
|
+
var initializeCompiler = async (options) => {
|
|
232
|
+
await (initialized ??= (0, import_esbuild_wasm.initialize)({
|
|
233
|
+
wasmURL: options.wasmURL
|
|
234
|
+
}));
|
|
235
|
+
};
|
|
236
|
+
var Compiler = class {
|
|
237
|
+
constructor(_options) {
|
|
238
|
+
this._options = _options;
|
|
239
|
+
}
|
|
240
|
+
async compile(source) {
|
|
241
|
+
const { providedModules, ...options } = this._options;
|
|
242
|
+
const createResult = async (result) => {
|
|
243
|
+
return {
|
|
244
|
+
timestamp: Date.now(),
|
|
245
|
+
sourceHash: Buffer.from(await import_crypto.subtleCrypto.digest("SHA-256", Buffer.from(source))),
|
|
246
|
+
...result
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
if (this._options.platform === "browser") {
|
|
250
|
+
(0, import_invariant.invariant)(initialized, "Compiler not initialized.", {
|
|
251
|
+
F: __dxlog_file,
|
|
252
|
+
L: 55,
|
|
253
|
+
S: this,
|
|
254
|
+
A: [
|
|
255
|
+
"initialized",
|
|
256
|
+
"'Compiler not initialized.'"
|
|
257
|
+
]
|
|
258
|
+
});
|
|
259
|
+
await initialized;
|
|
260
|
+
}
|
|
261
|
+
const imports = analyzeSourceFileImports(source);
|
|
262
|
+
try {
|
|
263
|
+
const result = await (0, import_esbuild_wasm.build)({
|
|
264
|
+
...options,
|
|
265
|
+
metafile: true,
|
|
266
|
+
write: false,
|
|
267
|
+
entryPoints: [
|
|
268
|
+
"memory:main.tsx"
|
|
269
|
+
],
|
|
270
|
+
bundle: true,
|
|
271
|
+
format: "esm",
|
|
272
|
+
plugins: [
|
|
273
|
+
{
|
|
274
|
+
name: "memory",
|
|
275
|
+
setup: (build2) => {
|
|
276
|
+
build2.onResolve({
|
|
277
|
+
filter: /^memory:/
|
|
278
|
+
}, ({ path }) => {
|
|
279
|
+
return {
|
|
280
|
+
path: path.split(":")[1],
|
|
281
|
+
namespace: "memory"
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
build2.onLoad({
|
|
285
|
+
filter: /.*/,
|
|
286
|
+
namespace: "memory"
|
|
287
|
+
}, ({ path }) => {
|
|
288
|
+
const imports2 = [
|
|
289
|
+
"import React from 'react';"
|
|
290
|
+
];
|
|
291
|
+
if (path === "main.tsx") {
|
|
292
|
+
return {
|
|
293
|
+
contents: [
|
|
294
|
+
...imports2,
|
|
295
|
+
source
|
|
296
|
+
].join("\n"),
|
|
297
|
+
loader: "tsx"
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
for (const module2 of providedModules) {
|
|
302
|
+
build2.onResolve({
|
|
303
|
+
filter: new RegExp(`^${module2}$`)
|
|
304
|
+
}, ({ path }) => {
|
|
305
|
+
return {
|
|
306
|
+
path,
|
|
307
|
+
namespace: "injected-module"
|
|
308
|
+
};
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
build2.onLoad({
|
|
312
|
+
filter: /.*/,
|
|
313
|
+
namespace: "injected-module"
|
|
314
|
+
}, ({ path }) => {
|
|
315
|
+
const namedImports = imports.find((entry) => entry.moduleIdentifier === path)?.namedImports ?? [];
|
|
316
|
+
return {
|
|
317
|
+
contents: `
|
|
318
|
+
const { ${namedImports.join(",")} } = window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}];
|
|
319
|
+
export { ${namedImports.join(",")} };
|
|
320
|
+
export default window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}].default;
|
|
321
|
+
`,
|
|
322
|
+
loader: "tsx"
|
|
323
|
+
};
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
]
|
|
328
|
+
});
|
|
329
|
+
return await createResult({
|
|
330
|
+
imports: this.analyzeImports(result),
|
|
331
|
+
bundle: result.outputFiles[0].text
|
|
332
|
+
});
|
|
333
|
+
} catch (err) {
|
|
334
|
+
return await createResult({
|
|
335
|
+
error: err
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
// TODO(dmaretskyi): In the future we can replace the compiler with SWC with plugins running in WASM.
|
|
340
|
+
analyzeImports(result) {
|
|
341
|
+
(0, import_invariant.invariant)(result.outputFiles, void 0, {
|
|
342
|
+
F: __dxlog_file,
|
|
343
|
+
L: 121,
|
|
344
|
+
S: this,
|
|
345
|
+
A: [
|
|
346
|
+
"result.outputFiles",
|
|
347
|
+
""
|
|
348
|
+
]
|
|
349
|
+
});
|
|
350
|
+
const parsedImports = allMatches(IMPORT_REGEX, result.outputFiles[0].text);
|
|
351
|
+
return Object.values(result.metafile.outputs)[0].imports.map((entry) => {
|
|
352
|
+
const namedImports = [];
|
|
353
|
+
const parsedImport = parsedImports.find((capture) => capture?.[4] === entry.path);
|
|
354
|
+
if (parsedImport?.[2]) {
|
|
355
|
+
NAMED_IMPORTS_REGEX.lastIndex = 0;
|
|
356
|
+
const namedImportsMatch = NAMED_IMPORTS_REGEX.exec(parsedImport[2]);
|
|
357
|
+
if (namedImportsMatch) {
|
|
358
|
+
namedImportsMatch[1].split(",").forEach((importName) => {
|
|
359
|
+
namedImports.push(importName.trim());
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return {
|
|
364
|
+
moduleUrl: entry.path,
|
|
365
|
+
defaultImport: !!parsedImport?.[1],
|
|
366
|
+
namedImports
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
analyzeSourceFileImports(code) {
|
|
371
|
+
const parsedImports = allMatches(IMPORT_REGEX, code);
|
|
372
|
+
return parsedImports.map((capture) => {
|
|
373
|
+
return {
|
|
374
|
+
defaultImportName: capture[1],
|
|
375
|
+
namedImports: capture[2]?.split(",").map((importName) => importName.trim()),
|
|
376
|
+
wildcardImportName: capture[3],
|
|
377
|
+
moduleIdentifier: capture[4],
|
|
378
|
+
quotes: capture[5]
|
|
379
|
+
};
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
var IMPORT_REGEX = /import(?:(?:(?:[ \n\t]+([^ *\n\t{},]+)[ \n\t]*(?:,|[ \n\t]+))?([ \n\t]*{(?:[ \n\t]*[^ \n\t"'{}]+[ \n\t]*,?)+})?[ \n\t]*)|[ \n\t]*\*[ \n\t]*as[ \n\t]+([^ \n\t{}]+)[ \n\t]+)from[ \n\t]*(?:['"])([^'"\n]+)(['"])/gm;
|
|
384
|
+
var NAMED_IMPORTS_REGEX = /[ \n\t]*{((?:[ \n\t]*[^ \n\t"'{}]+[ \n\t]*,?)+)}[ \n\t]*/gm;
|
|
385
|
+
var allMatches = (regex, str) => {
|
|
386
|
+
regex.lastIndex = 0;
|
|
387
|
+
let match;
|
|
388
|
+
const matches = [];
|
|
389
|
+
while (match = regex.exec(str)) {
|
|
390
|
+
matches.push(match);
|
|
391
|
+
}
|
|
392
|
+
return matches;
|
|
393
|
+
};
|
|
394
|
+
var analyzeSourceFileImports = (code) => {
|
|
395
|
+
const parsedImports = allMatches(IMPORT_REGEX, code);
|
|
396
|
+
return parsedImports.map((capture) => {
|
|
397
|
+
return {
|
|
398
|
+
defaultImportName: capture[1],
|
|
399
|
+
namedImports: capture[2]?.trim().slice(1, -1).split(",").map((importName) => importName.trim()),
|
|
400
|
+
wildcardImportName: capture[3],
|
|
401
|
+
moduleIdentifier: capture[4],
|
|
402
|
+
quotes: capture[5]
|
|
403
|
+
};
|
|
404
|
+
});
|
|
405
|
+
};
|
|
406
|
+
var src_default = ScriptPlugin;
|
|
407
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
408
|
+
0 && (module.exports = {
|
|
409
|
+
Compiler,
|
|
410
|
+
ScriptAction,
|
|
411
|
+
ScriptEditor,
|
|
412
|
+
ScriptPlugin,
|
|
413
|
+
ScriptType,
|
|
414
|
+
TypescriptEditor,
|
|
415
|
+
initializeCompiler
|
|
416
|
+
});
|
|
417
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ScriptPlugin.tsx", "../../../src/components/index.ts", "../../../src/translations.ts", "../../../src/compiler/compiler.ts", "../../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Code, type IconProps } from '@phosphor-icons/react';\nimport React from 'react';\n\nimport { parseIntentPlugin, type PluginDefinition, resolvePlugin, NavigationAction } from '@dxos/app-framework';\nimport { create } from '@dxos/echo-schema';\nimport { parseClientPlugin } from '@dxos/plugin-client';\nimport { type ActionGroup, createExtension, isActionGroup } from '@dxos/plugin-graph';\nimport { TextType } from '@dxos/plugin-markdown/types';\nimport { SpaceAction } from '@dxos/plugin-space';\nimport { loadObjectReferences } from '@dxos/react-client/echo';\n\nimport { ScriptEditor } from './components';\nimport meta, { SCRIPT_PLUGIN } from './meta';\nimport translations from './translations';\nimport { ScriptType } from './types';\nimport { ScriptAction, type ScriptPluginProvides } from './types';\n\nexport type ScriptPluginProps = {\n containerUrl: string;\n};\n\nexport const ScriptPlugin = ({ containerUrl }: ScriptPluginProps): PluginDefinition<ScriptPluginProvides> => {\n return {\n meta,\n provides: {\n metadata: {\n records: {\n [ScriptType.typename]: {\n placeholder: ['object title placeholder', { ns: SCRIPT_PLUGIN }],\n icon: (props: IconProps) => <Code {...props} />,\n iconSymbol: 'ph--code--regular',\n // TODO(wittjosiah): Move out of metadata.\n loadReferences: (script: ScriptType) => loadObjectReferences(script, (script) => [script.source]),\n },\n },\n },\n translations,\n echo: {\n schema: [ScriptType],\n },\n graph: {\n builder: (plugins) => {\n const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;\n const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;\n if (!client || !dispatch) {\n return [];\n }\n\n return createExtension({\n id: ScriptAction.CREATE,\n filter: (node): node is ActionGroup => isActionGroup(node) && node.id.startsWith(SpaceAction.ADD_OBJECT),\n actions: ({ node }) => {\n const id = node.id.split('/').at(-1);\n const [spaceId, objectId] = id?.split(':') ?? [];\n const space = client.spaces.get().find((space) => space.id === spaceId);\n const object = objectId && space?.db.getObjectById(objectId);\n const target = objectId ? object : space;\n if (!target) {\n return;\n }\n\n return [\n {\n id: `${SCRIPT_PLUGIN}/create/${node.id}`,\n data: async () => {\n await dispatch([\n { plugin: SCRIPT_PLUGIN, action: ScriptAction.CREATE },\n { action: SpaceAction.ADD_OBJECT, data: { target } },\n { action: NavigationAction.OPEN },\n ]);\n },\n properties: {\n label: ['create object label', { ns: SCRIPT_PLUGIN }],\n icon: (props: IconProps) => <Code {...props} />,\n iconSymbol: 'ph--code--regular',\n testId: 'scriptPlugin.createObject',\n },\n },\n ];\n },\n });\n },\n },\n stack: {\n creators: [\n {\n id: 'create-stack-section-script',\n testId: 'scriptPlugin.createSectionSpaceScript',\n type: ['plugin name', { ns: SCRIPT_PLUGIN }],\n label: ['create stack section label', { ns: SCRIPT_PLUGIN }],\n icon: (props: any) => <Code {...props} />,\n intent: {\n plugin: SCRIPT_PLUGIN,\n action: ScriptAction.CREATE,\n },\n },\n ],\n },\n surface: {\n component: ({ data, role }) => {\n if (role && !['article', 'section'].includes(role)) {\n return null;\n }\n\n if (data.object instanceof ScriptType) {\n return <ScriptEditor script={data.object} role={role} />;\n }\n\n return null;\n },\n },\n intent: {\n resolver: (intent) => {\n switch (intent.action) {\n case ScriptAction.CREATE: {\n return { data: create(ScriptType, { source: create(TextType, { content: example }) }) };\n }\n }\n },\n },\n },\n };\n};\n\n// TODO(burdon): Import.\nconst example = [\n 'export default {',\n ' async fetch(request, env, ctx) {',\n \" return new Response('Hello World, from ScriptPlugin!');\",\n ' }',\n '}',\n '',\n].join('\\n');\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nexport const ScriptEditor = React.lazy(() => import('./ScriptEditor'));\nexport const TypescriptEditor = React.lazy(() => import('./TypescriptEditor'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SCRIPT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [SCRIPT_PLUGIN]: {\n 'plugin name': 'Scripts',\n 'object title placeholder': 'New script',\n 'create object label': 'Create script',\n 'create stack section label': 'Create script',\n 'binding label': 'Binding',\n 'binding placeholder': 'Enter binding',\n 'edit binding label': 'Edit binding',\n 'deploy label': 'Deploy',\n 'deployed label': 'Current version of the script is deployed',\n 'upload failed label': 'Upload failed',\n 'copy link label': 'Copy function link',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type BuildOptions } from 'esbuild';\nimport { build, initialize, type BuildResult } from 'esbuild-wasm';\n\nimport { subtleCrypto } from '@dxos/crypto';\nimport { invariant } from '@dxos/invariant';\n\nexport type Import = {\n moduleUrl: string;\n defaultImport: boolean;\n namedImports: string[];\n};\n\nexport type CompilerResult = {\n timestamp: number;\n sourceHash: Buffer;\n imports?: Import[];\n bundle?: string;\n error?: any;\n};\n\nexport type CompilerOptions = {\n platform: BuildOptions['platform'];\n providedModules: string[];\n};\n\nlet initialized: Promise<void>;\nexport const initializeCompiler = async (options: { wasmURL: string }) => {\n await (initialized ??= initialize({\n wasmURL: options.wasmURL,\n }));\n};\n\n/**\n * ESBuild compiler.\n */\nexport class Compiler {\n constructor(private readonly _options: CompilerOptions) {}\n\n async compile(source: string): Promise<CompilerResult> {\n const { providedModules, ...options } = this._options;\n\n const createResult = async (result?: Partial<CompilerResult>) => {\n return {\n timestamp: Date.now(),\n sourceHash: Buffer.from(await subtleCrypto.digest('SHA-256', Buffer.from(source))),\n ...result,\n };\n };\n\n if (this._options.platform === 'browser') {\n invariant(initialized, 'Compiler not initialized.');\n await initialized;\n }\n\n const imports = analyzeSourceFileImports(source);\n\n // https://esbuild.github.io/api/#build\n try {\n const result = await build({\n ...options,\n metafile: true,\n write: false,\n entryPoints: ['memory:main.tsx'],\n bundle: true,\n format: 'esm',\n plugins: [\n {\n name: 'memory',\n setup: (build) => {\n build.onResolve({ filter: /^memory:/ }, ({ path }) => {\n return { path: path.split(':')[1], namespace: 'memory' };\n });\n\n build.onLoad({ filter: /.*/, namespace: 'memory' }, ({ path }) => {\n const imports = [\"import React from 'react';\"];\n if (path === 'main.tsx') {\n return {\n contents: [...imports, source].join('\\n'),\n loader: 'tsx',\n };\n }\n });\n\n for (const module of providedModules) {\n build.onResolve({ filter: new RegExp(`^${module}$`) }, ({ path }) => {\n return { path, namespace: 'injected-module' };\n });\n }\n\n build.onLoad({ filter: /.*/, namespace: 'injected-module' }, ({ path }) => {\n const namedImports = imports.find((entry) => entry.moduleIdentifier === path)?.namedImports ?? [];\n return {\n contents: `\n const { ${namedImports.join(',')} } = window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}];\n export { ${namedImports.join(',')} };\n export default window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}].default;\n `,\n loader: 'tsx',\n };\n });\n },\n },\n ],\n });\n\n return await createResult({\n imports: this.analyzeImports(result),\n bundle: result.outputFiles![0].text,\n });\n } catch (err) {\n return await createResult({ error: err });\n }\n }\n\n // TODO(dmaretskyi): In the future we can replace the compiler with SWC with plugins running in WASM.\n analyzeImports(result: BuildResult): Import[] {\n invariant(result.outputFiles);\n\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, result.outputFiles[0].text);\n return Object.values(result.metafile!.outputs)[0].imports.map((entry): Import => {\n const namedImports: string[] = [];\n\n const parsedImport = parsedImports.find((capture) => capture?.[4] === entry.path);\n if (parsedImport?.[2]) {\n NAMED_IMPORTS_REGEX.lastIndex = 0;\n const namedImportsMatch = NAMED_IMPORTS_REGEX.exec(parsedImport[2]);\n if (namedImportsMatch) {\n namedImportsMatch[1].split(',').forEach((importName) => {\n namedImports.push(importName.trim());\n });\n }\n }\n\n return {\n moduleUrl: entry.path,\n defaultImport: !!parsedImport?.[1],\n namedImports,\n };\n });\n }\n\n analyzeSourceFileImports(code: string) {\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, code);\n return parsedImports.map((capture) => {\n return {\n defaultImportName: capture[1],\n namedImports: capture[2]?.split(',').map((importName) => importName.trim()),\n wildcardImportName: capture[3],\n moduleIdentifier: capture[4],\n quotes: capture[5],\n };\n });\n }\n}\n\n// https://regex101.com/r/FEN5ks/1\n// https://stackoverflow.com/a/73265022\n// $1 = default import name (can be non-existent)\n// $2 = destructured exports (can be non-existent)\n// $3 = wildcard import name (can be non-existent)\n// $4 = module identifier\n// $5 = quotes used (either ' or \")\nconst IMPORT_REGEX =\n /import(?:(?:(?:[ \\n\\t]+([^ *\\n\\t{},]+)[ \\n\\t]*(?:,|[ \\n\\t]+))?([ \\n\\t]*{(?:[ \\n\\t]*[^ \\n\\t\"'{}]+[ \\n\\t]*,?)+})?[ \\n\\t]*)|[ \\n\\t]*\\*[ \\n\\t]*as[ \\n\\t]+([^ \\n\\t{}]+)[ \\n\\t]+)from[ \\n\\t]*(?:['\"])([^'\"\\n]+)(['\"])/gm;\n\nconst NAMED_IMPORTS_REGEX = /[ \\n\\t]*{((?:[ \\n\\t]*[^ \\n\\t\"'{}]+[ \\n\\t]*,?)+)}[ \\n\\t]*/gm;\n\nconst allMatches = (regex: RegExp, str: string) => {\n regex.lastIndex = 0;\n\n let match;\n const matches = [];\n while ((match = regex.exec(str))) {\n matches.push(match);\n }\n\n return matches;\n};\n\ntype ParsedImport = {\n defaultImportName?: string;\n namedImports: string[];\n wildcardImportName?: string;\n moduleIdentifier: string;\n quotes: string;\n};\n\nconst analyzeSourceFileImports = (code: string): ParsedImport[] => {\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, code);\n return parsedImports.map((capture) => {\n return {\n defaultImportName: capture[1],\n namedImports: capture[2]\n ?.trim()\n .slice(1, -1)\n .split(',')\n .map((importName) => importName.trim()),\n wildcardImportName: capture[3],\n moduleIdentifier: capture[4],\n quotes: capture[5],\n };\n });\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ScriptPlugin } from './ScriptPlugin';\n\nexport default ScriptPlugin;\n\nexport * from './compiler';\nexport * from './components';\nexport * from './types';\n\nexport * from './ScriptPlugin';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAqC;AACrC,IAAAA,gBAAkB;AAElB,2BAA0F;AAC1F,yBAAuB;AACvB,2BAAkC;AAClC,0BAAiE;AACjE,mBAAyB;AACzB,0BAA4B;AAC5B,kBAAqC;ACTrC,IAAAA,gBAAkB;AEClB,0BAAoD;AAEpD,oBAA6B;AAC7B,uBAA0B;AFFnB,IAAMC,eAAeC,cAAAA,QAAMC,KAAK,MAAM,OAAO,6BAAA,CAAA;AAC7C,IAAMC,mBAAmBF,cAAAA,QAAMC,KAAK,MAAM,OAAO,iCAAA,CAAA;ACDxD,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACE,mCAAAA,GAAgB;QACf,eAAe;QACf,4BAA4B;QAC5B,uBAAuB;QACvB,8BAA8B;QAC9B,iBAAiB;QACjB,uBAAuB;QACvB,sBAAsB;QACtB,gBAAgB;QAChB,kBAAkB;QAClB,uBAAuB;QACvB,mBAAmB;MACrB;IACF;EACF;;AFEK,IAAMC,eAAe,CAAC,E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AAA,EACDW,MAAM,GAAG,EAAC,EACV9G,MAAM,GAAA,EACNyF,IAAI,CAACQ,eAAeA,WAAWE,KAAI,CAAA;MACtCK,oBAAoBb,QAAQ,CAAA;MAC5BhB,kBAAkBgB,QAAQ,CAAA;MAC1Bc,QAAQd,QAAQ,CAAA;IAClB;EACF,CAAA;AACF;AC3MA,IAAA,cAAepI;",
|
|
6
|
+
"names": ["import_react", "ScriptEditor", "React", "lazy", "TypescriptEditor", "SCRIPT_PLUGIN", "ScriptPlugin", "containerUrl", "meta", "provides", "metadata", "records", "ScriptType", "typename", "placeholder", "ns", "icon", "props", "Code", "iconSymbol", "loadReferences", "script", "loadObjectReferences", "source", "translations", "echo", "schema", "graph", "builder", "plugins", "client", "resolvePlugin", "parseClientPlugin", "dispatch", "parseIntentPlugin", "intent", "createExtension", "id", "ScriptAction", "CREATE", "filter", "node", "isActionGroup", "startsWith", "SpaceAction", "ADD_OBJECT", "actions", "split", "at", "spaceId", "objectId", "space", "spaces", "get", "find", "object", "db", "getObjectById", "target", "data", "plugin", "action", "NavigationAction", "OPEN", "properties", "label", "testId", "stack", "creators", "type", "surface", "component", "role", "includes", "resolver", "create", "TextType", "content", "example", "join", "initialized", "initializeCompiler", "options", "initialize", "wasmURL", "Compiler", "constructor", "_options", "compile", "providedModules", "createResult", "result", "timestamp", "Date", "now", "sourceHash", "Buffer", "from", "subtleCrypto", "digest", "platform", "invariant", "imports", "analyzeSourceFileImports", "build", "metafile", "write", "entryPoints", "bundle", "format", "name", "setup", "onResolve", "path", "namespace", "onLoad", "contents", "loader", "module", "RegExp", "namedImports", "entry", "moduleIdentifier", "JSON", "stringify", "analyzeImports", "outputFiles", "text", "err", "error", "parsedImports", "allMatches", "IMPORT_REGEX", "Object", "values", "outputs", "map", "parsedImport", "capture", "NAMED_IMPORTS_REGEX", "lastIndex", "namedImportsMatch", "exec", "forEach", "importName", "push", "trim", "moduleUrl", "defaultImport", "code", "defaultImportName", "wildcardImportName", "quotes", "regex", "str", "match", "matches", "slice"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var meta_exports = {};
|
|
20
|
+
__export(meta_exports, {
|
|
21
|
+
SCRIPT_PLUGIN: () => import_chunk_4VMNBXWU.SCRIPT_PLUGIN,
|
|
22
|
+
default: () => import_chunk_4VMNBXWU.meta_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(meta_exports);
|
|
25
|
+
var import_chunk_4VMNBXWU = require("./chunk-4VMNBXWU.cjs");
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
SCRIPT_PLUGIN
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=meta.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["meta.cjs"],
|
|
4
|
+
"sourcesContent": ["import {\n SCRIPT_PLUGIN,\n meta_default\n} from \"./chunk-4VMNBXWU.cjs\";\nexport {\n SCRIPT_PLUGIN,\n meta_default as default\n};\n//# sourceMappingURL=meta.cjs.map\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAGO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"packages/plugins/experimental/plugin-script/src/edge/header-codec.ts":{"bytes":10228,"imports":[],"format":"esm"},"packages/plugins/experimental/plugin-script/src/edge/codec.ts":{"bytes":1702,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-script/src/edge/header-codec.ts","kind":"import-statement","original":"./header-codec"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/edge/hub-protocol.ts":{"bytes":2750,"imports":[],"format":"esm"},"packages/plugins/experimental/plugin-script/src/edge/functions.ts":{"bytes":14187,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-script/src/edge/codec.ts","kind":"import-statement","original":"./codec"},{"path":"packages/plugins/experimental/plugin-script/src/edge/hub-protocol.ts","kind":"import-statement","original":"./hub-protocol"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/edge/index.ts":{"bytes":907,"imports":[{"path":"packages/plugins/experimental/plugin-script/src/edge/codec.ts","kind":"import-statement","original":"./codec"},{"path":"packages/plugins/experimental/plugin-script/src/edge/functions.ts","kind":"import-statement","original":"./functions"},{"path":"packages/plugins/experimental/plugin-script/src/edge/header-codec.ts","kind":"import-statement","original":"./header-codec"},{"path":"packages/plugins/experimental/plugin-script/src/edge/hub-protocol.ts","kind":"import-statement","original":"./hub-protocol"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/meta.tsx":{"bytes":1964,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/components/Toolbar.tsx":{"bytes":17016,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-script/src/meta.tsx","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/components/TypescriptEditor.tsx":{"bytes":7040,"imports":[{"path":"@codemirror/lang-javascript","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/theme-one-dark","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/components/ScriptEditor.tsx":{"bytes":13730,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-client/halo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-script/src/components/Toolbar.tsx","kind":"import-statement","original":"./Toolbar"},{"path":"packages/plugins/experimental/plugin-script/src/components/TypescriptEditor.tsx","kind":"import-statement","original":"./TypescriptEditor"},{"path":"packages/plugins/experimental/plugin-script/src/edge/index.ts","kind":"import-statement","original":"../edge"},{"path":"packages/plugins/experimental/plugin-script/src/meta.tsx","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/components/index.ts":{"bytes":1121,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-script/src/components/ScriptEditor.tsx","kind":"dynamic-import","original":"./ScriptEditor"},{"path":"packages/plugins/experimental/plugin-script/src/components/TypescriptEditor.tsx","kind":"dynamic-import","original":"./TypescriptEditor"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/translations.ts":{"bytes":2462,"imports":[{"path":"packages/plugins/experimental/plugin-script/src/meta.tsx","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/types/script.ts":{"bytes":2107,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown/types","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/types/types.tsx":{"bytes":1612,"imports":[{"path":"packages/plugins/experimental/plugin-script/src/meta.tsx","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/types/index.ts":{"bytes":600,"imports":[{"path":"packages/plugins/experimental/plugin-script/src/types/script.ts","kind":"import-statement","original":"./script"},{"path":"packages/plugins/experimental/plugin-script/src/types/types.tsx","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx":{"bytes":19018,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown/types","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-script/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/experimental/plugin-script/src/meta.tsx","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/experimental/plugin-script/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/experimental/plugin-script/src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"packages/plugins/experimental/plugin-script/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/compiler/compiler.ts":{"bytes":23524,"imports":[{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/compiler/index.ts":{"bytes":524,"imports":[{"path":"packages/plugins/experimental/plugin-script/src/compiler/compiler.ts","kind":"import-statement","original":"./compiler"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/index.ts":{"bytes":1062,"imports":[{"path":"packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx","kind":"import-statement","original":"./ScriptPlugin"},{"path":"packages/plugins/experimental/plugin-script/src/compiler/index.ts","kind":"import-statement","original":"./compiler"},{"path":"packages/plugins/experimental/plugin-script/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/experimental/plugin-script/src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx","kind":"import-statement","original":"./ScriptPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/experimental/plugin-script/dist/lib/node/edge/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/node/edge/index.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-LWUBFTPA.cjs","kind":"import-statement"}],"exports":["HeaderCodec","codec","getUserFunctionUrlInMetadata","matchServiceCredential","publicKeyToDid","setUserFunctionUrlInMetadata","uploadWorkerFunction"],"entryPoint":"packages/plugins/experimental/plugin-script/src/edge/index.ts","inputs":{},"bytes":398},"packages/plugins/experimental/plugin-script/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":21254},"packages/plugins/experimental/plugin-script/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-6Y2S6SGK.cjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4VMNBXWU.cjs","kind":"import-statement"},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown/types","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/ScriptEditor-AIVKL2NX.cjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/TypescriptEditor-PWOAN5RQ.cjs","kind":"dynamic-import"},{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"exports":["Compiler","ScriptAction","ScriptEditor","ScriptPlugin","ScriptType","TypescriptEditor","default","initializeCompiler"],"entryPoint":"packages/plugins/experimental/plugin-script/src/index.ts","inputs":{"packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx":{"bytesInOutput":5034},"packages/plugins/experimental/plugin-script/src/components/index.ts":{"bytesInOutput":187},"packages/plugins/experimental/plugin-script/src/translations.ts":{"bytesInOutput":612},"packages/plugins/experimental/plugin-script/src/compiler/compiler.ts":{"bytesInOutput":5832},"packages/plugins/experimental/plugin-script/src/compiler/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-script/src/index.ts":{"bytesInOutput":32}},"bytes":12438},"packages/plugins/experimental/plugin-script/dist/lib/node/meta.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/node/meta.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4VMNBXWU.cjs","kind":"import-statement"}],"exports":["SCRIPT_PLUGIN","default"],"entryPoint":"packages/plugins/experimental/plugin-script/src/meta.tsx","inputs":{},"bytes":161},"packages/plugins/experimental/plugin-script/dist/lib/node/types/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/node/types/index.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-6Y2S6SGK.cjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4VMNBXWU.cjs","kind":"import-statement"}],"exports":["ScriptAction","ScriptType"],"entryPoint":"packages/plugins/experimental/plugin-script/src/types/index.ts","inputs":{},"bytes":178},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-6Y2S6SGK.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1863},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-6Y2S6SGK.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4VMNBXWU.cjs","kind":"import-statement"},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown/types","kind":"import-statement","external":true}],"exports":["ScriptAction","ScriptType"],"inputs":{"packages/plugins/experimental/plugin-script/src/types/script.ts":{"bytesInOutput":437},"packages/plugins/experimental/plugin-script/src/types/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-script/src/types/types.tsx":{"bytesInOutput":167}},"bytes":882},"packages/plugins/experimental/plugin-script/dist/lib/node/TypescriptEditor-PWOAN5RQ.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/node/TypescriptEditor-PWOAN5RQ.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-SLV3SDZE.cjs","kind":"import-statement"}],"exports":["TypescriptEditor","default"],"entryPoint":"packages/plugins/experimental/plugin-script/src/components/TypescriptEditor.tsx","inputs":{},"bytes":212},"packages/plugins/experimental/plugin-script/dist/lib/node/ScriptEditor-AIVKL2NX.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16203},"packages/plugins/experimental/plugin-script/dist/lib/node/ScriptEditor-AIVKL2NX.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-LWUBFTPA.cjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4VMNBXWU.cjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-SLV3SDZE.cjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-client/halo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["ScriptEditor","default"],"entryPoint":"packages/plugins/experimental/plugin-script/src/components/ScriptEditor.tsx","inputs":{"packages/plugins/experimental/plugin-script/src/components/ScriptEditor.tsx":{"bytesInOutput":3479},"packages/plugins/experimental/plugin-script/src/components/Toolbar.tsx":{"bytesInOutput":4861}},"bytes":8948},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-LWUBFTPA.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14649},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-LWUBFTPA.cjs":{"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["HeaderCodec","codec","getUserFunctionUrlInMetadata","matchServiceCredential","publicKeyToDid","setUserFunctionUrlInMetadata","uploadWorkerFunction"],"inputs":{"packages/plugins/experimental/plugin-script/src/edge/codec.ts":{"bytesInOutput":221},"packages/plugins/experimental/plugin-script/src/edge/header-codec.ts":{"bytesInOutput":2132},"packages/plugins/experimental/plugin-script/src/edge/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-script/src/edge/functions.ts":{"bytesInOutput":3303},"packages/plugins/experimental/plugin-script/src/edge/hub-protocol.ts":{"bytesInOutput":425}},"bytes":6710},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4VMNBXWU.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":961},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4VMNBXWU.cjs":{"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"exports":["SCRIPT_PLUGIN","meta_default"],"inputs":{"packages/plugins/experimental/plugin-script/src/meta.tsx":{"bytesInOutput":430}},"bytes":579},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-SLV3SDZE.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3598},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-SLV3SDZE.cjs":{"imports":[{"path":"@codemirror/lang-javascript","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/theme-one-dark","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["TypescriptEditor","TypescriptEditor_default"],"inputs":{"packages/plugins/experimental/plugin-script/src/components/TypescriptEditor.tsx":{"bytesInOutput":1702}},"bytes":1889}}}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var types_exports = {};
|
|
20
|
+
__export(types_exports, {
|
|
21
|
+
ScriptAction: () => import_chunk_6Y2S6SGK.ScriptAction,
|
|
22
|
+
ScriptType: () => import_chunk_6Y2S6SGK.ScriptType
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(types_exports);
|
|
25
|
+
var import_chunk_6Y2S6SGK = require("../chunk-6Y2S6SGK.cjs");
|
|
26
|
+
var import_chunk_4VMNBXWU = require("../chunk-4VMNBXWU.cjs");
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
ScriptAction,
|
|
30
|
+
ScriptType
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.cjs"],
|
|
4
|
+
"sourcesContent": ["import {\n ScriptAction,\n ScriptType\n} from \"../chunk-6Y2S6SGK.cjs\";\nimport \"../chunk-4VMNBXWU.cjs\";\nexport {\n ScriptAction,\n ScriptType\n};\n//# sourceMappingURL=index.cjs.map\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAGO;AACP,4BAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type PluginDefinition } from '@dxos/app-framework';
|
|
2
|
+
import { type ScriptPluginProvides } from './types';
|
|
3
|
+
export type ScriptPluginProps = {
|
|
4
|
+
containerUrl: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const ScriptPlugin: ({ containerUrl }: ScriptPluginProps) => PluginDefinition<ScriptPluginProvides>;
|
|
7
|
+
//# sourceMappingURL=ScriptPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScriptPlugin.d.ts","sourceRoot":"","sources":["../../../src/ScriptPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAqB,KAAK,gBAAgB,EAAmC,MAAM,qBAAqB,CAAC;AAYhH,OAAO,EAAgB,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAElE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,YAAY,qBAAsB,iBAAiB,KAAG,gBAAgB,CAAC,oBAAoB,CAqGvG,CAAC"}
|