@dxos/plugin-script 0.6.10-main.bbdfaa4 → 0.6.10-staging.00555f6

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
@@ -1,3 +1,7 @@
1
+ import {
2
+ Bundler,
3
+ initializeBundler
4
+ } from "./chunk-RHEZ5LUU.mjs";
1
5
  import {
2
6
  FunctionType,
3
7
  ScriptAction,
@@ -10,6 +14,7 @@ import {
10
14
 
11
15
  // packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx
12
16
  import { Code } from "@phosphor-icons/react";
17
+ import wasmUrl from "esbuild-wasm/esbuild.wasm?url";
13
18
  import React2 from "react";
14
19
  import { parseIntentPlugin, resolvePlugin, NavigationAction } from "@dxos/app-framework";
15
20
  import { create } from "@dxos/echo-schema";
@@ -19,10 +24,63 @@ import { TextType } from "@dxos/plugin-markdown/types";
19
24
  import { SpaceAction } from "@dxos/plugin-space";
20
25
  import { loadObjectReferences } from "@dxos/react-client/echo";
21
26
 
27
+ // packages/plugins/experimental/plugin-script/src/compiler/compiler.ts
28
+ import { createDefaultMapFromCDN, createSystem, createVirtualTypeScriptEnvironment } from "@typescript/vfs";
29
+ import ts from "typescript";
30
+ import { invariant } from "@dxos/invariant";
31
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/compiler/compiler.ts";
32
+ var defaultOptions = {
33
+ lib: [
34
+ "DOM",
35
+ "es2022"
36
+ ],
37
+ target: ts.ScriptTarget.ES2022
38
+ };
39
+ var Compiler = class {
40
+ constructor(_options = defaultOptions) {
41
+ this._options = _options;
42
+ }
43
+ async initialize() {
44
+ if (this._env) {
45
+ return;
46
+ }
47
+ this._fsMap = await createDefaultMapFromCDN(this._options, "5.5.4", true, ts);
48
+ const system = createSystem(this._fsMap);
49
+ this._env = createVirtualTypeScriptEnvironment(system, [], ts, this._options);
50
+ }
51
+ get environment() {
52
+ invariant(this._env, "Compiler environment not initialized.", {
53
+ F: __dxlog_file,
54
+ L: 39,
55
+ S: this,
56
+ A: [
57
+ "this._env",
58
+ "'Compiler environment not initialized.'"
59
+ ]
60
+ });
61
+ return this._env;
62
+ }
63
+ setFile(fileName, content) {
64
+ invariant(this._fsMap, "File system map not initialized.", {
65
+ F: __dxlog_file,
66
+ L: 44,
67
+ S: this,
68
+ A: [
69
+ "this._fsMap",
70
+ "'File system map not initialized.'"
71
+ ]
72
+ });
73
+ this.environment.createFile(fileName, content);
74
+ }
75
+ compile(fileName) {
76
+ return this.environment.languageService.getEmitOutput(fileName);
77
+ }
78
+ };
79
+
22
80
  // packages/plugins/experimental/plugin-script/src/components/index.ts
23
81
  import React from "react";
24
- var ScriptEditor = React.lazy(() => import("./ScriptEditor-MSQDR6D7.mjs"));
25
- var TypescriptEditor = React.lazy(() => import("./TypescriptEditor-PIRIDDUS.mjs"));
82
+ var ScriptEditor = React.lazy(() => import("./ScriptEditor-WNCGR5OU.mjs"));
83
+ var TypescriptEditor = React.lazy(() => import("./TypescriptEditor-XTGRVCMY.mjs"));
26
84
 
27
85
  // packages/plugins/experimental/plugin-script/src/translations.ts
28
86
  var translations_default = [
@@ -33,22 +91,36 @@ var translations_default = [
33
91
  "object title placeholder": "New script",
34
92
  "create object label": "Create script",
35
93
  "create stack section label": "Create script",
36
- "binding label": "Binding",
37
- "binding placeholder": "Enter binding",
38
- "edit binding label": "Edit binding",
94
+ "binding placeholder": "Function name",
95
+ "function request placeholder": "Function request",
39
96
  "deploy label": "Deploy",
40
97
  "deployed label": "Current version of the script is deployed",
41
98
  "upload failed label": "Upload failed",
42
- "copy link label": "Copy function link"
99
+ "copy link label": "Copy function link",
100
+ "format label": "Format",
101
+ "toggle details label": "Toggle details panel"
43
102
  }
44
103
  }
45
104
  }
46
105
  ];
47
106
 
48
107
  // packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx
49
- var ScriptPlugin = ({ containerUrl }) => {
108
+ var ScriptPlugin = () => {
109
+ const compiler = new Compiler();
50
110
  return {
51
111
  meta: meta_default,
112
+ initialize: async () => {
113
+ await compiler.initialize();
114
+ compiler.setFile("/src/typings.d.ts", "declare module 'https://*';");
115
+ compiler.setFile("/src/runtime.ts", `
116
+ export const Filter: any = {};
117
+ export type FunctionHandler = ({ event, context }: { event: any; context: any }) => Promise<Response>;
118
+ export const functionHandler = (handler: FunctionHandler) => handler;
119
+ `);
120
+ await initializeBundler({
121
+ wasmUrl
122
+ });
123
+ },
52
124
  provides: {
53
125
  metadata: {
54
126
  records: {
@@ -166,6 +238,7 @@ var ScriptPlugin = ({ containerUrl }) => {
166
238
  }
167
239
  if (data.object instanceof ScriptType) {
168
240
  return /* @__PURE__ */ React2.createElement(ScriptEditor, {
241
+ env: compiler.environment,
169
242
  script: data.object,
170
243
  role
171
244
  });
@@ -192,199 +265,19 @@ var ScriptPlugin = ({ containerUrl }) => {
192
265
  };
193
266
  };
194
267
  var example = [
195
- "export default {",
196
- " async fetch(request, env, ctx) {",
197
- " return new Response('Hello World, from ScriptPlugin!');",
198
- " }",
199
- "}",
268
+ "export default async ({ ",
269
+ " event: { data: { request } },",
270
+ " context: { space, ai } ",
271
+ "}) => {",
272
+ " return new Response('Hello World, from ScriptPlugin!');",
273
+ "};",
200
274
  ""
201
275
  ].join("\n");
202
276
 
203
- // packages/plugins/experimental/plugin-script/src/compiler/compiler.ts
204
- import { build, initialize } from "esbuild-wasm";
205
- import { subtleCrypto } from "@dxos/crypto";
206
- import { invariant } from "@dxos/invariant";
207
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/compiler/compiler.ts";
208
- var initialized;
209
- var initializeCompiler = async (options) => {
210
- await (initialized ??= initialize({
211
- wasmURL: options.wasmURL
212
- }));
213
- };
214
- var Compiler = class {
215
- constructor(_options) {
216
- this._options = _options;
217
- }
218
- async compile(source) {
219
- const { providedModules, ...options } = this._options;
220
- const createResult = async (result) => {
221
- return {
222
- timestamp: Date.now(),
223
- sourceHash: Buffer.from(await subtleCrypto.digest("SHA-256", Buffer.from(source))),
224
- ...result
225
- };
226
- };
227
- if (this._options.platform === "browser") {
228
- invariant(initialized, "Compiler not initialized.", {
229
- F: __dxlog_file,
230
- L: 55,
231
- S: this,
232
- A: [
233
- "initialized",
234
- "'Compiler not initialized.'"
235
- ]
236
- });
237
- await initialized;
238
- }
239
- const imports = analyzeSourceFileImports(source);
240
- try {
241
- const result = await build({
242
- ...options,
243
- metafile: true,
244
- write: false,
245
- entryPoints: [
246
- "memory:main.tsx"
247
- ],
248
- bundle: true,
249
- format: "esm",
250
- plugins: [
251
- {
252
- name: "memory",
253
- setup: (build2) => {
254
- build2.onResolve({
255
- filter: /^memory:/
256
- }, ({ path }) => {
257
- return {
258
- path: path.split(":")[1],
259
- namespace: "memory"
260
- };
261
- });
262
- build2.onLoad({
263
- filter: /.*/,
264
- namespace: "memory"
265
- }, ({ path }) => {
266
- const imports2 = [
267
- "import React from 'react';"
268
- ];
269
- if (path === "main.tsx") {
270
- return {
271
- contents: [
272
- ...imports2,
273
- source
274
- ].join("\n"),
275
- loader: "tsx"
276
- };
277
- }
278
- });
279
- for (const module of providedModules) {
280
- build2.onResolve({
281
- filter: new RegExp(`^${module}$`)
282
- }, ({ path }) => {
283
- return {
284
- path,
285
- namespace: "injected-module"
286
- };
287
- });
288
- }
289
- build2.onLoad({
290
- filter: /.*/,
291
- namespace: "injected-module"
292
- }, ({ path }) => {
293
- const namedImports = imports.find((entry) => entry.moduleIdentifier === path)?.namedImports ?? [];
294
- return {
295
- contents: `
296
- const { ${namedImports.join(",")} } = window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}];
297
- export { ${namedImports.join(",")} };
298
- export default window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}].default;
299
- `,
300
- loader: "tsx"
301
- };
302
- });
303
- }
304
- }
305
- ]
306
- });
307
- return await createResult({
308
- imports: this.analyzeImports(result),
309
- bundle: result.outputFiles[0].text
310
- });
311
- } catch (err) {
312
- return await createResult({
313
- error: err
314
- });
315
- }
316
- }
317
- // TODO(dmaretskyi): In the future we can replace the compiler with SWC with plugins running in WASM.
318
- analyzeImports(result) {
319
- invariant(result.outputFiles, void 0, {
320
- F: __dxlog_file,
321
- L: 121,
322
- S: this,
323
- A: [
324
- "result.outputFiles",
325
- ""
326
- ]
327
- });
328
- const parsedImports = allMatches(IMPORT_REGEX, result.outputFiles[0].text);
329
- return Object.values(result.metafile.outputs)[0].imports.map((entry) => {
330
- const namedImports = [];
331
- const parsedImport = parsedImports.find((capture) => capture?.[4] === entry.path);
332
- if (parsedImport?.[2]) {
333
- NAMED_IMPORTS_REGEX.lastIndex = 0;
334
- const namedImportsMatch = NAMED_IMPORTS_REGEX.exec(parsedImport[2]);
335
- if (namedImportsMatch) {
336
- namedImportsMatch[1].split(",").forEach((importName) => {
337
- namedImports.push(importName.trim());
338
- });
339
- }
340
- }
341
- return {
342
- moduleUrl: entry.path,
343
- defaultImport: !!parsedImport?.[1],
344
- namedImports
345
- };
346
- });
347
- }
348
- analyzeSourceFileImports(code) {
349
- const parsedImports = allMatches(IMPORT_REGEX, code);
350
- return parsedImports.map((capture) => {
351
- return {
352
- defaultImportName: capture[1],
353
- namedImports: capture[2]?.split(",").map((importName) => importName.trim()),
354
- wildcardImportName: capture[3],
355
- moduleIdentifier: capture[4],
356
- quotes: capture[5]
357
- };
358
- });
359
- }
360
- };
361
- 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;
362
- var NAMED_IMPORTS_REGEX = /[ \n\t]*{((?:[ \n\t]*[^ \n\t"'{}]+[ \n\t]*,?)+)}[ \n\t]*/gm;
363
- var allMatches = (regex, str) => {
364
- regex.lastIndex = 0;
365
- let match;
366
- const matches = [];
367
- while (match = regex.exec(str)) {
368
- matches.push(match);
369
- }
370
- return matches;
371
- };
372
- var analyzeSourceFileImports = (code) => {
373
- const parsedImports = allMatches(IMPORT_REGEX, code);
374
- return parsedImports.map((capture) => {
375
- return {
376
- defaultImportName: capture[1],
377
- namedImports: capture[2]?.trim().slice(1, -1).split(",").map((importName) => importName.trim()),
378
- wildcardImportName: capture[3],
379
- moduleIdentifier: capture[4],
380
- quotes: capture[5]
381
- };
382
- });
383
- };
384
-
385
277
  // packages/plugins/experimental/plugin-script/src/index.ts
386
278
  var src_default = ScriptPlugin;
387
279
  export {
280
+ Bundler,
388
281
  Compiler,
389
282
  FunctionType,
390
283
  ScriptAction,
@@ -393,6 +286,6 @@ export {
393
286
  ScriptType,
394
287
  TypescriptEditor,
395
288
  src_default as default,
396
- initializeCompiler
289
+ initializeBundler
397
290
  };
398
291
  //# sourceMappingURL=index.mjs.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';\nexport * from './types';\n\nexport * from './ScriptPlugin';\n"],
5
- "mappings": ";;;;;;;;;;;AAIA,SAASA,YAA4B;AACrC,OAAOC,YAAW;AAElB,SAASC,mBAA0CC,eAAeC,wBAAwB;AAC1F,SAASC,cAAc;AACvB,SAASC,yBAAyB;AAClC,SAA2BC,iBAAiBC,qBAAqB;AACjE,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAC5B,SAASC,4BAA4B;;;ACTrC,OAAOC,WAAW;AAEX,IAAMC,eAAeC,MAAMC,KAAK,MAAM,OAAO,6BAAA,CAAA;AAC7C,IAAMC,mBAAmBF,MAAMC,KAAK,MAAM,OAAO,iCAAA,CAAA;;;ACDxD,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACE,aAAAA,GAAgB;QACf,eAAe;QACf,4BAA4B;QAC5B,uBAAuB;QACvB,8BAA8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ACT;AAUA,IAAMzD,2BAA2B,CAACkD,SAAAA;AAEhC,QAAMnB,gBAAgBC,WAAWC,cAAciB,IAAAA;AAC/C,SAAOnB,cAAcM,IAAI,CAACE,YAAAA;AACxB,WAAO;MACLY,mBAAmBZ,QAAQ,CAAA;MAC3BnB,cAAcmB,QAAQ,CAAA,GAClBQ,KAAAA,EACDW,MAAM,GAAG,EAAC,EACV9C,MAAM,GAAA,EACNyB,IAAI,CAACQ,eAAeA,WAAWE,KAAI,CAAA;MACtCK,oBAAoBb,QAAQ,CAAA;MAC5BhB,kBAAkBgB,QAAQ,CAAA;MAC1Bc,QAAQd,QAAQ,CAAA;IAClB;EACF,CAAA;AACF;;;AC3MA,IAAA,cAAeoB;",
6
- "names": ["Code", "React", "parseIntentPlugin", "resolvePlugin", "NavigationAction", "create", "parseClientPlugin", "createExtension", "isActionGroup", "TextType", "SpaceAction", "loadObjectReferences", "React", "ScriptEditor", "React", "lazy", "TypescriptEditor", "SCRIPT_PLUGIN", "ScriptPlugin", "containerUrl", "meta", "provides", "metadata", "records", "ScriptType", "typename", "placeholder", "ns", "SCRIPT_PLUGIN", "icon", "props", "React", "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", "ScriptEditor", "resolver", "create", "TextType", "content", "example", "join", "build", "initialize", "subtleCrypto", "invariant", "initialized", "initializeCompiler", "options", "wasmURL", "Compiler", "constructor", "_options", "compile", "source", "providedModules", "createResult", "result", "timestamp", "Date", "now", "sourceHash", "Buffer", "from", "digest", "platform", "imports", "analyzeSourceFileImports", "metafile", "write", "entryPoints", "bundle", "format", "plugins", "name", "setup", "onResolve", "filter", "path", "split", "namespace", "onLoad", "contents", "join", "loader", "module", "RegExp", "namedImports", "find", "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", "ScriptPlugin"]
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,SAASA,YAA4B;AAErC,OAAOC,aAAa;AACpB,OAAOC,YAAW;AAElB,SAASC,mBAA0CC,eAAeC,wBAAwB;AAC1F,SAASC,cAAc;AACvB,SAASC,yBAAyB;AAClC,SAA2BC,iBAAiBC,qBAAqB;AACjE,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAC5B,SAASC,4BAA4B;;;ACXrC,SACEC,yBACAC,cACAC,0CAEK;AACP,OAAOC,QAAQ;AAEf,SAASC,iBAAiB;;AAE1B,IAAMC,iBAAqC;EACzCC,KAAK;IAAC;IAAO;;EACbC,QAAQJ,GAAGK,aAAaC;AAC1B;AAEO,IAAMC,WAAN,MAAMA;EAIXC,YAA6BC,W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A;EACA;EACA;EACA;EACA;EACA;EACAC,KAAK,IAAA;;;AIlJP,IAAA,cAAeC;",
6
+ "names": ["Code", "wasmUrl", "React", "parseIntentPlugin", "resolvePlugin", "NavigationAction", "create", "parseClientPlugin", "createExtension", "isActionGroup", "TextType", "SpaceAction", "loadObjectReferences", "createDefaultMapFromCDN", "createSystem", "createVirtualTypeScriptEnvironment", "ts", "invariant", "defaultOptions", "lib", "target", "ScriptTarget", "ES2022", "Compiler", "constructor", "_options", "initialize", "_env", "_fsMap", "system", "environment", "setFile", "fileName", "content", "createFile", "compile", "languageService", "getEmitOutput", "React", "ScriptEditor", "React", "lazy", "TypescriptEditor", "SCRIPT_PLUGIN", "ScriptPlugin", "compiler", "Compiler", "meta", "initialize", "setFile", "initializeBundler", "wasmUrl", "provides", "metadata", "records", "ScriptType", "typename", "placeholder", "ns", "SCRIPT_PLUGIN", "icon", "props", "React", "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", "ScriptEditor", "env", "environment", "resolver", "create", "TextType", "content", "example", "join", "ScriptPlugin"]
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/browser/edge/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/browser/edge/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-ISMNAD3P.mjs","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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":21262},"packages/plugins/experimental/plugin-script/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-ZGCETT2W.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs","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/browser/ScriptEditor-MSQDR6D7.mjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/TypescriptEditor-PIRIDDUS.mjs","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/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs","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/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-ZGCETT2W.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs","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/browser/TypescriptEditor-PIRIDDUS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/browser/TypescriptEditor-PIRIDDUS.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-D4O723CR.mjs","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/browser/ScriptEditor-MSQDR6D7.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17783},"packages/plugins/experimental/plugin-script/dist/lib/browser/ScriptEditor-MSQDR6D7.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-ISMNAD3P.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-ZGCETT2W.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-D4O723CR.mjs","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/browser/chunk-ISMNAD3P.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14612},"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-ISMNAD3P.mjs":{"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/browser/chunk-ZGCETT2W.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2276},"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-ZGCETT2W.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs","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/browser/chunk-JBACGDOJ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":961},"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs":{"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/browser/chunk-D4O723CR.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3777},"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-D4O723CR.mjs":{"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/browser/edge/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/browser/edge/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-DL5XQRQM.mjs","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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13928},"packages/plugins/experimental/plugin-script/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-RHEZ5LUU.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-ZGCETT2W.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs","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/browser/ScriptEditor-WNCGR5OU.mjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/TypescriptEditor-XTGRVCMY.mjs","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/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs","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/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-ZGCETT2W.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs","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/browser/TypescriptEditor-XTGRVCMY.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-script/dist/lib/browser/TypescriptEditor-XTGRVCMY.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-DX5CSOBP.mjs","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/browser/ScriptEditor-WNCGR5OU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":31972},"packages/plugins/experimental/plugin-script/dist/lib/browser/ScriptEditor-WNCGR5OU.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-DL5XQRQM.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-RHEZ5LUU.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-ZGCETT2W.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-DX5CSOBP.mjs","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/browser/chunk-DL5XQRQM.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15020},"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-DL5XQRQM.mjs":{"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/browser/chunk-RHEZ5LUU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13644},"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-RHEZ5LUU.mjs":{"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/browser/chunk-ZGCETT2W.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2276},"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-ZGCETT2W.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs","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/browser/chunk-JBACGDOJ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":961},"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-JBACGDOJ.mjs":{"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/browser/chunk-DX5CSOBP.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4826},"packages/plugins/experimental/plugin-script/dist/lib/browser/chunk-DX5CSOBP.mjs":{"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}}}