@dxos/plugin-script 0.6.10-main.e92b5eb → 0.6.10-staging.7621a6e

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 (91) hide show
  1. package/README.md +45 -0
  2. package/dist/lib/browser/ScriptEditor-WNCGR5OU.mjs +452 -0
  3. package/dist/lib/browser/ScriptEditor-WNCGR5OU.mjs.map +7 -0
  4. package/dist/lib/browser/{TypescriptEditor-PIRIDDUS.mjs → TypescriptEditor-XTGRVCMY.mjs} +2 -2
  5. package/dist/lib/browser/{chunk-ISMNAD3P.mjs → chunk-DL5XQRQM.mjs} +13 -7
  6. package/dist/lib/browser/{chunk-ISMNAD3P.mjs.map → chunk-DL5XQRQM.mjs.map} +3 -3
  7. package/dist/lib/browser/{chunk-D4O723CR.mjs → chunk-DX5CSOBP.mjs} +22 -5
  8. package/dist/lib/browser/chunk-DX5CSOBP.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-RHEZ5LUU.mjs +229 -0
  10. package/dist/lib/browser/chunk-RHEZ5LUU.mjs.map +7 -0
  11. package/dist/lib/browser/edge/index.mjs +1 -1
  12. package/dist/lib/browser/index.mjs +88 -195
  13. package/dist/lib/browser/index.mjs.map +4 -4
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/node/ScriptEditor-RR7AVOQL.cjs +465 -0
  16. package/dist/lib/node/ScriptEditor-RR7AVOQL.cjs.map +7 -0
  17. package/dist/lib/node/{TypescriptEditor-OTWJUIWB.cjs → TypescriptEditor-CRONCQSI.cjs} +7 -7
  18. package/dist/lib/node/{TypescriptEditor-OTWJUIWB.cjs.map → TypescriptEditor-CRONCQSI.cjs.map} +2 -2
  19. package/dist/lib/node/chunk-4GTXIELQ.cjs +252 -0
  20. package/dist/lib/node/chunk-4GTXIELQ.cjs.map +7 -0
  21. package/dist/lib/node/{chunk-HN3AVLUL.cjs → chunk-PFH3ROEH.cjs} +16 -10
  22. package/dist/lib/node/{chunk-HN3AVLUL.cjs.map → chunk-PFH3ROEH.cjs.map} +3 -3
  23. package/dist/lib/node/{chunk-ITLHJMWP.cjs → chunk-RXI576K3.cjs} +24 -7
  24. package/dist/lib/node/chunk-RXI576K3.cjs.map +7 -0
  25. package/dist/lib/node/edge/index.cjs +8 -8
  26. package/dist/lib/node/edge/index.cjs.map +1 -1
  27. package/dist/lib/node/index.cjs +85 -194
  28. package/dist/lib/node/index.cjs.map +4 -4
  29. package/dist/lib/node/meta.json +1 -1
  30. package/dist/types/src/ScriptPlugin.d.ts +1 -4
  31. package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
  32. package/dist/types/src/bundler/bundler.d.ts +39 -0
  33. package/dist/types/src/bundler/bundler.d.ts.map +1 -0
  34. package/dist/types/src/bundler/bundler.test.d.ts +2 -0
  35. package/dist/types/src/bundler/bundler.test.d.ts.map +1 -0
  36. package/dist/types/src/bundler/index.d.ts +2 -0
  37. package/dist/types/src/bundler/index.d.ts.map +1 -0
  38. package/dist/types/src/compiler/compiler.browser.test.d.ts +2 -0
  39. package/dist/types/src/compiler/compiler.browser.test.d.ts.map +1 -0
  40. package/dist/types/src/compiler/compiler.d.ts +9 -34
  41. package/dist/types/src/compiler/compiler.d.ts.map +1 -1
  42. package/dist/types/src/components/DetailsPanel.d.ts +9 -0
  43. package/dist/types/src/components/DetailsPanel.d.ts.map +1 -0
  44. package/dist/types/src/components/ScriptBlock/FrameContainer/FrameContainer.d.ts +2 -2
  45. package/dist/types/src/components/ScriptBlock/FrameContainer/FrameContainer.d.ts.map +1 -1
  46. package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts.map +1 -1
  47. package/dist/types/src/components/ScriptEditor.d.ts +3 -2
  48. package/dist/types/src/components/ScriptEditor.d.ts.map +1 -1
  49. package/dist/types/src/components/Toolbar.d.ts +9 -7
  50. package/dist/types/src/components/Toolbar.d.ts.map +1 -1
  51. package/dist/types/src/components/Toolbar.stories.d.ts +1 -1
  52. package/dist/types/src/components/TypescriptEditor.d.ts +3 -1
  53. package/dist/types/src/components/TypescriptEditor.d.ts.map +1 -1
  54. package/dist/types/src/components/TypescriptEditor.stories.d.ts +1 -1
  55. package/dist/types/src/components/index.d.ts +2 -2
  56. package/dist/types/src/components/index.d.ts.map +1 -1
  57. package/dist/types/src/data/templates.md.d.ts +3 -0
  58. package/dist/types/src/data/templates.md.d.ts.map +1 -0
  59. package/dist/types/src/edge/functions.d.ts.map +1 -1
  60. package/dist/types/src/index.d.ts +1 -0
  61. package/dist/types/src/index.d.ts.map +1 -1
  62. package/dist/types/src/translations.d.ts +3 -2
  63. package/dist/types/src/translations.d.ts.map +1 -1
  64. package/package.json +38 -33
  65. package/src/ScriptPlugin.tsx +29 -10
  66. package/src/bundler/bundler.test.ts +44 -0
  67. package/src/bundler/bundler.ts +246 -0
  68. package/src/bundler/index.ts +5 -0
  69. package/src/compiler/compiler.browser.test.ts +18 -0
  70. package/src/compiler/compiler.ts +31 -190
  71. package/src/compiler/index.ts +1 -1
  72. package/src/components/DetailsPanel.tsx +218 -0
  73. package/src/components/ScriptBlock/FrameContainer/FrameContainer.tsx +2 -2
  74. package/src/components/ScriptBlock/ScriptBlock.tsx +10 -7
  75. package/src/components/ScriptEditor.tsx +71 -13
  76. package/src/components/Toolbar.tsx +69 -91
  77. package/src/components/TypescriptEditor.tsx +18 -4
  78. package/src/data/templates.md.ts +44 -0
  79. package/src/edge/functions.ts +9 -2
  80. package/src/index.ts +1 -0
  81. package/src/translations.ts +4 -3
  82. package/dist/lib/browser/ScriptEditor-MSQDR6D7.mjs +0 -241
  83. package/dist/lib/browser/ScriptEditor-MSQDR6D7.mjs.map +0 -7
  84. package/dist/lib/browser/chunk-D4O723CR.mjs.map +0 -7
  85. package/dist/lib/node/ScriptEditor-KBSACFYK.cjs +0 -258
  86. package/dist/lib/node/ScriptEditor-KBSACFYK.cjs.map +0 -7
  87. package/dist/lib/node/chunk-ITLHJMWP.cjs.map +0 -7
  88. package/dist/types/src/compiler/compiler.test.d.ts +0 -2
  89. package/dist/types/src/compiler/compiler.test.d.ts.map +0 -1
  90. package/src/compiler/compiler.test.ts +0 -17
  91. /package/dist/lib/browser/{TypescriptEditor-PIRIDDUS.mjs.map → TypescriptEditor-XTGRVCMY.mjs.map} +0 -0
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var node_exports = {};
30
30
  __export(node_exports, {
31
+ Bundler: () => import_chunk_4GTXIELQ.Bundler,
31
32
  Compiler: () => Compiler,
32
33
  FunctionType: () => import_chunk_VW2POILW.FunctionType,
33
34
  ScriptAction: () => import_chunk_VW2POILW.ScriptAction,
@@ -36,12 +37,14 @@ __export(node_exports, {
36
37
  ScriptType: () => import_chunk_VW2POILW.ScriptType,
37
38
  TypescriptEditor: () => TypescriptEditor,
38
39
  default: () => src_default,
39
- initializeCompiler: () => initializeCompiler
40
+ initializeBundler: () => import_chunk_4GTXIELQ.initializeBundler
40
41
  });
41
42
  module.exports = __toCommonJS(node_exports);
43
+ var import_chunk_4GTXIELQ = require("./chunk-4GTXIELQ.cjs");
42
44
  var import_chunk_VW2POILW = require("./chunk-VW2POILW.cjs");
43
45
  var import_chunk_4VMNBXWU = require("./chunk-4VMNBXWU.cjs");
44
46
  var import_react = require("@phosphor-icons/react");
47
+ var import_esbuild = __toESM(require("esbuild-wasm/esbuild.wasm?url"));
45
48
  var import_react2 = __toESM(require("react"));
46
49
  var import_app_framework = require("@dxos/app-framework");
47
50
  var import_echo_schema = require("@dxos/echo-schema");
@@ -50,12 +53,60 @@ var import_plugin_graph = require("@dxos/plugin-graph");
50
53
  var import_types = require("@dxos/plugin-markdown/types");
51
54
  var import_plugin_space = require("@dxos/plugin-space");
52
55
  var import_echo = require("@dxos/react-client/echo");
53
- var import_react3 = __toESM(require("react"));
54
- var import_esbuild_wasm = require("esbuild-wasm");
55
- var import_crypto = require("@dxos/crypto");
56
+ var import_vfs = require("@typescript/vfs");
57
+ var import_typescript = __toESM(require("typescript"));
56
58
  var import_invariant = require("@dxos/invariant");
57
- var ScriptEditor = import_react3.default.lazy(() => import("./ScriptEditor-KBSACFYK.cjs"));
58
- var TypescriptEditor = import_react3.default.lazy(() => import("./TypescriptEditor-OTWJUIWB.cjs"));
59
+ var import_react3 = __toESM(require("react"));
60
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/compiler/compiler.ts";
61
+ var defaultOptions = {
62
+ lib: [
63
+ "DOM",
64
+ "es2022"
65
+ ],
66
+ target: import_typescript.default.ScriptTarget.ES2022
67
+ };
68
+ var Compiler = class {
69
+ constructor(_options = defaultOptions) {
70
+ this._options = _options;
71
+ }
72
+ async initialize() {
73
+ if (this._env) {
74
+ return;
75
+ }
76
+ this._fsMap = await (0, import_vfs.createDefaultMapFromCDN)(this._options, "5.5.4", true, import_typescript.default);
77
+ const system = (0, import_vfs.createSystem)(this._fsMap);
78
+ this._env = (0, import_vfs.createVirtualTypeScriptEnvironment)(system, [], import_typescript.default, this._options);
79
+ }
80
+ get environment() {
81
+ (0, import_invariant.invariant)(this._env, "Compiler environment not initialized.", {
82
+ F: __dxlog_file,
83
+ L: 39,
84
+ S: this,
85
+ A: [
86
+ "this._env",
87
+ "'Compiler environment not initialized.'"
88
+ ]
89
+ });
90
+ return this._env;
91
+ }
92
+ setFile(fileName, content) {
93
+ (0, import_invariant.invariant)(this._fsMap, "File system map not initialized.", {
94
+ F: __dxlog_file,
95
+ L: 44,
96
+ S: this,
97
+ A: [
98
+ "this._fsMap",
99
+ "'File system map not initialized.'"
100
+ ]
101
+ });
102
+ this.environment.createFile(fileName, content);
103
+ }
104
+ compile(fileName) {
105
+ return this.environment.languageService.getEmitOutput(fileName);
106
+ }
107
+ };
108
+ var ScriptEditor = import_react3.default.lazy(() => import("./ScriptEditor-RR7AVOQL.cjs"));
109
+ var TypescriptEditor = import_react3.default.lazy(() => import("./TypescriptEditor-CRONCQSI.cjs"));
59
110
  var translations_default = [
60
111
  {
61
112
  "en-US": {
@@ -64,20 +115,34 @@ var translations_default = [
64
115
  "object title placeholder": "New script",
65
116
  "create object label": "Create script",
66
117
  "create stack section label": "Create script",
67
- "binding label": "Binding",
68
- "binding placeholder": "Enter binding",
69
- "edit binding label": "Edit binding",
118
+ "binding placeholder": "Function name",
119
+ "function request placeholder": "Function request",
70
120
  "deploy label": "Deploy",
71
121
  "deployed label": "Current version of the script is deployed",
72
122
  "upload failed label": "Upload failed",
73
- "copy link label": "Copy function link"
123
+ "copy link label": "Copy function link",
124
+ "format label": "Format",
125
+ "toggle details label": "Toggle details panel"
74
126
  }
75
127
  }
76
128
  }
77
129
  ];
78
- var ScriptPlugin = ({ containerUrl }) => {
130
+ var ScriptPlugin = () => {
131
+ const compiler = new Compiler();
79
132
  return {
80
133
  meta: import_chunk_4VMNBXWU.meta_default,
134
+ initialize: async () => {
135
+ await compiler.initialize();
136
+ compiler.setFile("/src/typings.d.ts", "declare module 'https://*';");
137
+ compiler.setFile("/src/runtime.ts", `
138
+ export const Filter: any = {};
139
+ export type FunctionHandler = ({ event, context }: { event: any; context: any }) => Promise<Response>;
140
+ export const functionHandler = (handler: FunctionHandler) => handler;
141
+ `);
142
+ await (0, import_chunk_4GTXIELQ.initializeBundler)({
143
+ wasmUrl: import_esbuild.default
144
+ });
145
+ },
81
146
  provides: {
82
147
  metadata: {
83
148
  records: {
@@ -195,6 +260,7 @@ var ScriptPlugin = ({ containerUrl }) => {
195
260
  }
196
261
  if (data.object instanceof import_chunk_VW2POILW.ScriptType) {
197
262
  return /* @__PURE__ */ import_react2.default.createElement(ScriptEditor, {
263
+ env: compiler.environment,
198
264
  script: data.object,
199
265
  role
200
266
  });
@@ -221,193 +287,18 @@ var ScriptPlugin = ({ containerUrl }) => {
221
287
  };
222
288
  };
223
289
  var example = [
224
- "export default {",
225
- " async fetch(request, env, ctx) {",
226
- " return new Response('Hello World, from ScriptPlugin!');",
227
- " }",
228
- "}",
290
+ "export default async ({ ",
291
+ " event: { data: { request } },",
292
+ " context: { space, ai } ",
293
+ "}) => {",
294
+ " return new Response('Hello World, from ScriptPlugin!');",
295
+ "};",
229
296
  ""
230
297
  ].join("\n");
231
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/compiler/compiler.ts";
232
- var initialized;
233
- var initializeCompiler = async (options) => {
234
- await (initialized ??= (0, import_esbuild_wasm.initialize)({
235
- wasmURL: options.wasmURL
236
- }));
237
- };
238
- var Compiler = class {
239
- constructor(_options) {
240
- this._options = _options;
241
- }
242
- async compile(source) {
243
- const { providedModules, ...options } = this._options;
244
- const createResult = async (result) => {
245
- return {
246
- timestamp: Date.now(),
247
- sourceHash: Buffer.from(await import_crypto.subtleCrypto.digest("SHA-256", Buffer.from(source))),
248
- ...result
249
- };
250
- };
251
- if (this._options.platform === "browser") {
252
- (0, import_invariant.invariant)(initialized, "Compiler not initialized.", {
253
- F: __dxlog_file,
254
- L: 55,
255
- S: this,
256
- A: [
257
- "initialized",
258
- "'Compiler not initialized.'"
259
- ]
260
- });
261
- await initialized;
262
- }
263
- const imports = analyzeSourceFileImports(source);
264
- try {
265
- const result = await (0, import_esbuild_wasm.build)({
266
- ...options,
267
- metafile: true,
268
- write: false,
269
- entryPoints: [
270
- "memory:main.tsx"
271
- ],
272
- bundle: true,
273
- format: "esm",
274
- plugins: [
275
- {
276
- name: "memory",
277
- setup: (build2) => {
278
- build2.onResolve({
279
- filter: /^memory:/
280
- }, ({ path }) => {
281
- return {
282
- path: path.split(":")[1],
283
- namespace: "memory"
284
- };
285
- });
286
- build2.onLoad({
287
- filter: /.*/,
288
- namespace: "memory"
289
- }, ({ path }) => {
290
- const imports2 = [
291
- "import React from 'react';"
292
- ];
293
- if (path === "main.tsx") {
294
- return {
295
- contents: [
296
- ...imports2,
297
- source
298
- ].join("\n"),
299
- loader: "tsx"
300
- };
301
- }
302
- });
303
- for (const module2 of providedModules) {
304
- build2.onResolve({
305
- filter: new RegExp(`^${module2}$`)
306
- }, ({ path }) => {
307
- return {
308
- path,
309
- namespace: "injected-module"
310
- };
311
- });
312
- }
313
- build2.onLoad({
314
- filter: /.*/,
315
- namespace: "injected-module"
316
- }, ({ path }) => {
317
- const namedImports = imports.find((entry) => entry.moduleIdentifier === path)?.namedImports ?? [];
318
- return {
319
- contents: `
320
- const { ${namedImports.join(",")} } = window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}];
321
- export { ${namedImports.join(",")} };
322
- export default window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}].default;
323
- `,
324
- loader: "tsx"
325
- };
326
- });
327
- }
328
- }
329
- ]
330
- });
331
- return await createResult({
332
- imports: this.analyzeImports(result),
333
- bundle: result.outputFiles[0].text
334
- });
335
- } catch (err) {
336
- return await createResult({
337
- error: err
338
- });
339
- }
340
- }
341
- // TODO(dmaretskyi): In the future we can replace the compiler with SWC with plugins running in WASM.
342
- analyzeImports(result) {
343
- (0, import_invariant.invariant)(result.outputFiles, void 0, {
344
- F: __dxlog_file,
345
- L: 121,
346
- S: this,
347
- A: [
348
- "result.outputFiles",
349
- ""
350
- ]
351
- });
352
- const parsedImports = allMatches(IMPORT_REGEX, result.outputFiles[0].text);
353
- return Object.values(result.metafile.outputs)[0].imports.map((entry) => {
354
- const namedImports = [];
355
- const parsedImport = parsedImports.find((capture) => capture?.[4] === entry.path);
356
- if (parsedImport?.[2]) {
357
- NAMED_IMPORTS_REGEX.lastIndex = 0;
358
- const namedImportsMatch = NAMED_IMPORTS_REGEX.exec(parsedImport[2]);
359
- if (namedImportsMatch) {
360
- namedImportsMatch[1].split(",").forEach((importName) => {
361
- namedImports.push(importName.trim());
362
- });
363
- }
364
- }
365
- return {
366
- moduleUrl: entry.path,
367
- defaultImport: !!parsedImport?.[1],
368
- namedImports
369
- };
370
- });
371
- }
372
- analyzeSourceFileImports(code) {
373
- const parsedImports = allMatches(IMPORT_REGEX, code);
374
- return parsedImports.map((capture) => {
375
- return {
376
- defaultImportName: capture[1],
377
- namedImports: capture[2]?.split(",").map((importName) => importName.trim()),
378
- wildcardImportName: capture[3],
379
- moduleIdentifier: capture[4],
380
- quotes: capture[5]
381
- };
382
- });
383
- }
384
- };
385
- 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;
386
- var NAMED_IMPORTS_REGEX = /[ \n\t]*{((?:[ \n\t]*[^ \n\t"'{}]+[ \n\t]*,?)+)}[ \n\t]*/gm;
387
- var allMatches = (regex, str) => {
388
- regex.lastIndex = 0;
389
- let match;
390
- const matches = [];
391
- while (match = regex.exec(str)) {
392
- matches.push(match);
393
- }
394
- return matches;
395
- };
396
- var analyzeSourceFileImports = (code) => {
397
- const parsedImports = allMatches(IMPORT_REGEX, code);
398
- return parsedImports.map((capture) => {
399
- return {
400
- defaultImportName: capture[1],
401
- namedImports: capture[2]?.trim().slice(1, -1).split(",").map((importName) => importName.trim()),
402
- wildcardImportName: capture[3],
403
- moduleIdentifier: capture[4],
404
- quotes: capture[5]
405
- };
406
- });
407
- };
408
298
  var src_default = ScriptPlugin;
409
299
  // Annotate the CommonJS export names for ESM import in node:
410
300
  0 && (module.exports = {
301
+ Bundler,
411
302
  Compiler,
412
303
  FunctionType,
413
304
  ScriptAction,
@@ -415,6 +306,6 @@ var src_default = ScriptPlugin;
415
306
  ScriptPlugin,
416
307
  ScriptType,
417
308
  TypescriptEditor,
418
- initializeCompiler
309
+ initializeBundler
419
310
  });
420
311
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
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 { FunctionType, 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, FunctionType],\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: { plugin: SCRIPT_PLUGIN, action: ScriptAction.CREATE },\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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AACE,YAAAA;AACxB,aAAO;QACLY,mBAAmBZ,QAAQ,CAAA;QAC3BlB,cAAckB,QAAQ,CAAA,GAAI3F,MAAM,GAAA,EAAKyF,IAAI,CAACQ,eAAeA,WAAWE,KAAI,CAAA;QACxEK,oBAAoBb,QAAQ,CAAA;QAC5BhB,kBAAkBgB,QAAQ,CAAA;QAC1Bc,QAAQd,QAAQ,CAAA;MAClB;IACF,CAAA;EACF;AACF;AASA,IAAMN,eACJ;AAEF,IAAMO,sBAAsB;AAE5B,IAAMR,aAAa,CAACsB,OAAeC,QAAAA;AACjCD,QAAMb,YAAY;AAElB,MAAIe;AACJ,QAAMC,UAAU,CAAA;AAChB,SAAQD,QAAQF,MAAMX,KAAKY,GAAAA,GAAO;AAChCE,YAAQX,KAAKU,KAAAA;EACf;AAEA,SAAOC;AACT;AAUA,IAAMrD,2BAA2B,CAAC8C,SAAAA;AAEhC,QAAMnB,gBAAgBC,WAAWC,cAAciB,IAAAA;AAC/C,SAAOnB,cAAcM,IAAI,CAACE,YAAAA;AACxB,WAAO;MACLY,mBAAmBZ,QAAQ,CAAA;MAC3BlB,cAAckB,QAAQ,CAAA,GAClBQ,KAAAA,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,cAAerI;",
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", "FunctionType", "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"]
3
+ "sources": ["../../../src/ScriptPlugin.tsx", "../../../src/compiler/compiler.ts", "../../../src/components/index.ts", "../../../src/translations.ts", "../../../src/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Code, type IconProps } from '@phosphor-icons/react';\n// @ts-ignore\nimport wasmUrl from 'esbuild-wasm/esbuild.wasm?url';\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 { initializeBundler } from './bundler';\nimport { Compiler } from './compiler';\nimport { ScriptEditor } from './components';\nimport meta, { SCRIPT_PLUGIN } from './meta';\nimport translations from './translations';\nimport { FunctionType, ScriptType } from './types';\nimport { ScriptAction, type ScriptPluginProvides } from './types';\n\nexport const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {\n const compiler = new Compiler();\n\n return {\n meta,\n initialize: async () => {\n await compiler.initialize();\n // TODO(wittjosiah): Fetch types for https modules.\n compiler.setFile('/src/typings.d.ts', \"declare module 'https://*';\");\n // TODO(wittjosiah): Proper function handler types.\n // TODO(wittjosiah): Remove.\n compiler.setFile(\n '/src/runtime.ts',\n `\n export const Filter: any = {};\n export type FunctionHandler = ({ event, context }: { event: any; context: any }) => Promise<Response>;\n export const functionHandler = (handler: FunctionHandler) => handler;\n `,\n );\n await initializeBundler({ wasmUrl });\n },\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, FunctionType],\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: { plugin: SCRIPT_PLUGIN, action: ScriptAction.CREATE },\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 env={compiler.environment} 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 async ({ ',\n ' event: { data: { request } },',\n ' context: { space, ai } ',\n '}) => {',\n \" return new Response('Hello World, from ScriptPlugin!');\",\n '};',\n '',\n].join('\\n');\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport {\n createDefaultMapFromCDN,\n createSystem,\n createVirtualTypeScriptEnvironment,\n type VirtualTypeScriptEnvironment,\n} from '@typescript/vfs';\nimport ts from 'typescript';\n\nimport { invariant } from '@dxos/invariant';\n\nconst defaultOptions: ts.CompilerOptions = {\n lib: ['DOM', 'es2022'],\n target: ts.ScriptTarget.ES2022,\n};\n\nexport class Compiler {\n private _env: VirtualTypeScriptEnvironment | undefined;\n private _fsMap: Map<string, string> | undefined;\n\n constructor(private readonly _options: ts.CompilerOptions = defaultOptions) {}\n\n async initialize() {\n if (this._env) {\n return;\n }\n\n // TODO(wittjosiah): Figure out how to get workers working in plugin packages.\n // https://github.com/val-town/codemirror-ts?tab=readme-ov-file#setup-worker\n this._fsMap = await createDefaultMapFromCDN(this._options, '5.5.4', true, ts);\n const system = createSystem(this._fsMap);\n this._env = createVirtualTypeScriptEnvironment(system, [], ts, this._options);\n }\n\n get environment() {\n invariant(this._env, 'Compiler environment not initialized.');\n return this._env;\n }\n\n setFile(fileName: string, content: string) {\n invariant(this._fsMap, 'File system map not initialized.');\n this.environment.createFile(fileName, content);\n }\n\n compile(fileName: string) {\n return this.environment.languageService.getEmitOutput(fileName);\n }\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 placeholder': 'Function name',\n 'function request placeholder': 'Function request',\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 'format label': 'Format',\n 'toggle details label': 'Toggle details panel',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ScriptPlugin } from './ScriptPlugin';\n\nexport default ScriptPlugin;\n\nexport * from './bundler';\nexport * from './compiler';\nexport * from './components';\nexport * from './types';\n\nexport * from './ScriptPlugin';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAqC;AAErC,qBAAoB;AACpB,IAAAA,gBAAkB;AAElB,2BAA0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;cAAa2E,KAAKrE,SAASf;cAAa+B,QAAQsC,KAAKH;cAAQgB;;UACvE;AAEA,iBAAO;QACT;MACF;MACApC,QAAQ;QACNuC,UAAU,CAACvC,WAAAA;AACT,kBAAQA,OAAOyB,QAAM;YACnB,KAAKtB,mCAAaC,QAAQ;AACxB,qBAAO;gBAAEmB,UAAMiB,2BAAOhE,kCAAY;kBAAEW,YAAQqD,2BAAOC,uBAAU;oBAAEnF,SAASoF;kBAAQ,CAAA;gBAAG,CAAA;cAAG;YACxF;UACF;QACF;MACF;IACF;EACF;AACF;AAGA,IAAMA,UAAU;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACAC,KAAK,IAAA;AIlJP,IAAA,cAAe3E;",
6
+ "names": ["import_react", "defaultOptions", "lib", "target", "ts", "ScriptTarget", "ES2022", "Compiler", "constructor", "_options", "initialize", "_env", "_fsMap", "createDefaultMapFromCDN", "system", "createSystem", "createVirtualTypeScriptEnvironment", "environment", "invariant", "setFile", "fileName", "content", "createFile", "compile", "languageService", "getEmitOutput", "ScriptEditor", "React", "lazy", "TypescriptEditor", "SCRIPT_PLUGIN", "ScriptPlugin", "compiler", "meta", "initializeBundler", "wasmUrl", "provides", "metadata", "records", "ScriptType", "typename", "placeholder", "ns", "icon", "props", "Code", "iconSymbol", "loadReferences", "script", "loadObjectReferences", "source", "translations", "echo", "schema", "FunctionType", "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", "data", "plugin", "action", "NavigationAction", "OPEN", "properties", "label", "testId", "stack", "creators", "type", "surface", "component", "role", "includes", "env", "resolver", "create", "TextType", "example", "join"]
7
7
  }
@@ -1 +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":14103,"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":18081,"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":7342,"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/types/script.ts":{"bytes":2909,"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/components/ScriptEditor.tsx":{"bytes":15542,"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"},{"path":"packages/plugins/experimental/plugin-script/src/types/index.ts","kind":"import-statement","original":"../types"}],"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/ScriptPlugin.tsx":{"bytes":19090,"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-HN3AVLUL.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":21262},"packages/plugins/experimental/plugin-script/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-VW2POILW.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-KBSACFYK.cjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/TypescriptEditor-OTWJUIWB.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","FunctionType","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":5058},"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":12494},"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-VW2POILW.cjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4VMNBXWU.cjs","kind":"import-statement"}],"exports":["FunctionType","ScriptAction","ScriptType"],"entryPoint":"packages/plugins/experimental/plugin-script/src/types/index.ts","inputs":{},"bytes":210},"packages/plugins/experimental/plugin-script/dist/lib/node/TypescriptEditor-OTWJUIWB.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/node/TypescriptEditor-OTWJUIWB.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-ITLHJMWP.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-KBSACFYK.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17783},"packages/plugins/experimental/plugin-script/dist/lib/node/ScriptEditor-KBSACFYK.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-HN3AVLUL.cjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-VW2POILW.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-ITLHJMWP.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":3929},"packages/plugins/experimental/plugin-script/src/components/Toolbar.tsx":{"bytesInOutput":5100}},"bytes":9692},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-HN3AVLUL.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14612},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-HN3AVLUL.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":3316},"packages/plugins/experimental/plugin-script/src/edge/hub-protocol.ts":{"bytesInOutput":425}},"bytes":6723},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-VW2POILW.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2276},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-VW2POILW.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":["FunctionType","ScriptAction","ScriptType"],"inputs":{"packages/plugins/experimental/plugin-script/src/types/script.ts":{"bytesInOutput":673},"packages/plugins/experimental/plugin-script/src/types/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-script/src/types/types.tsx":{"bytesInOutput":167}},"bytes":1134},"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-ITLHJMWP.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3777},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-ITLHJMWP.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":1776}},"bytes":1963}}}
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":14898,"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/bundler/bundler.ts":{"bytes":28987,"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},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/bundler/index.ts":{"bytes":522,"imports":[{"path":"packages/plugins/experimental/plugin-script/src/bundler/bundler.ts","kind":"import-statement","original":"./bundler"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/compiler/compiler.ts":{"bytes":5747,"imports":[{"path":"@typescript/vfs","kind":"import-statement","external":true},{"path":"typescript","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/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/DetailsPanel.tsx":{"bytes":22995,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","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/Toolbar.tsx":{"bytes":15688,"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":9408,"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":"@valtown/codemirror-ts","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/types/script.ts":{"bytes":2909,"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/components/ScriptEditor.tsx":{"bytes":22760,"imports":[{"path":"prettier","kind":"import-statement","external":true},{"path":"prettier/plugins/estree","kind":"import-statement","external":true},{"path":"prettier/plugins/typescript","kind":"import-statement","external":true},{"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/DetailsPanel.tsx","kind":"import-statement","original":"./DetailsPanel"},{"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/bundler/index.ts","kind":"import-statement","original":"../bundler"},{"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"},{"path":"packages/plugins/experimental/plugin-script/src/types/index.ts","kind":"import-statement","original":"../types"}],"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":2650,"imports":[{"path":"packages/plugins/experimental/plugin-script/src/meta.tsx","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx":{"bytes":21717,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"esbuild-wasm/esbuild.wasm?url","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/bundler/index.ts","kind":"import-statement","original":"./bundler"},{"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/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/index.ts":{"bytes":1149,"imports":[{"path":"packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx","kind":"import-statement","original":"./ScriptPlugin"},{"path":"packages/plugins/experimental/plugin-script/src/bundler/index.ts","kind":"import-statement","original":"./bundler"},{"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-PFH3ROEH.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":13928},"packages/plugins/experimental/plugin-script/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4GTXIELQ.cjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-VW2POILW.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":"esbuild-wasm/esbuild.wasm?url","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":"@typescript/vfs","kind":"import-statement","external":true},{"path":"typescript","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/ScriptEditor-RR7AVOQL.cjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/TypescriptEditor-CRONCQSI.cjs","kind":"dynamic-import"}],"exports":["Bundler","Compiler","FunctionType","ScriptAction","ScriptEditor","ScriptPlugin","ScriptType","TypescriptEditor","default","initializeBundler"],"entryPoint":"packages/plugins/experimental/plugin-script/src/index.ts","inputs":{"packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx":{"bytesInOutput":5698},"packages/plugins/experimental/plugin-script/src/compiler/compiler.ts":{"bytesInOutput":1440},"packages/plugins/experimental/plugin-script/src/compiler/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-script/src/components/index.ts":{"bytesInOutput":187},"packages/plugins/experimental/plugin-script/src/translations.ts":{"bytesInOutput":680},"packages/plugins/experimental/plugin-script/src/index.ts":{"bytesInOutput":32}},"bytes":8891},"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-VW2POILW.cjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4VMNBXWU.cjs","kind":"import-statement"}],"exports":["FunctionType","ScriptAction","ScriptType"],"entryPoint":"packages/plugins/experimental/plugin-script/src/types/index.ts","inputs":{},"bytes":210},"packages/plugins/experimental/plugin-script/dist/lib/node/TypescriptEditor-CRONCQSI.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/node/TypescriptEditor-CRONCQSI.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-RXI576K3.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-RR7AVOQL.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":31972},"packages/plugins/experimental/plugin-script/dist/lib/node/ScriptEditor-RR7AVOQL.cjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-PFH3ROEH.cjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4GTXIELQ.cjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-VW2POILW.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-RXI576K3.cjs","kind":"import-statement"},{"path":"prettier","kind":"import-statement","external":true},{"path":"prettier/plugins/estree","kind":"import-statement","external":true},{"path":"prettier/plugins/typescript","kind":"import-statement","external":true},{"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":"react","kind":"import-statement","external":true},{"path":"@dxos/log","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":"@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":5691},"packages/plugins/experimental/plugin-script/src/components/DetailsPanel.tsx":{"bytesInOutput":6233},"packages/plugins/experimental/plugin-script/src/components/Toolbar.tsx":{"bytesInOutput":4536}},"bytes":17253},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-PFH3ROEH.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15020},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-PFH3ROEH.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":3474},"packages/plugins/experimental/plugin-script/src/edge/hub-protocol.ts":{"bytesInOutput":425}},"bytes":6881},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4GTXIELQ.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13644},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-4GTXIELQ.cjs":{"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},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Bundler","initializeBundler"],"inputs":{"packages/plugins/experimental/plugin-script/src/bundler/bundler.ts":{"bytesInOutput":6790},"packages/plugins/experimental/plugin-script/src/bundler/index.ts":{"bytesInOutput":0}},"bytes":6948},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-VW2POILW.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2276},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-VW2POILW.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":["FunctionType","ScriptAction","ScriptType"],"inputs":{"packages/plugins/experimental/plugin-script/src/types/script.ts":{"bytesInOutput":673},"packages/plugins/experimental/plugin-script/src/types/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-script/src/types/types.tsx":{"bytesInOutput":167}},"bytes":1134},"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-RXI576K3.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4826},"packages/plugins/experimental/plugin-script/dist/lib/node/chunk-RXI576K3.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":"@valtown/codemirror-ts","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":2254}},"bytes":2441}}}
@@ -1,7 +1,4 @@
1
1
  import { type PluginDefinition } from '@dxos/app-framework';
2
2
  import { type ScriptPluginProvides } from './types';
3
- export type ScriptPluginProps = {
4
- containerUrl: string;
5
- };
6
- export declare const ScriptPlugin: ({ containerUrl }: ScriptPluginProps) => PluginDefinition<ScriptPluginProvides>;
3
+ export declare const ScriptPlugin: () => PluginDefinition<ScriptPluginProvides>;
7
4
  //# sourceMappingURL=ScriptPlugin.d.ts.map
@@ -1 +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,CAkGvG,CAAC"}
1
+ {"version":3,"file":"ScriptPlugin.d.ts","sourceRoot":"","sources":["../../../src/ScriptPlugin.tsx"],"names":[],"mappings":"AASA,OAAO,EAAqB,KAAK,gBAAgB,EAAmC,MAAM,qBAAqB,CAAC;AAchH,OAAO,EAAgB,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAElE,eAAO,MAAM,YAAY,QAAO,gBAAgB,CAAC,oBAAoB,CAoHpE,CAAC"}