@luna-park/plugin 2.0.0 → 2.1.0

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.
@@ -0,0 +1,85 @@
1
+ // ../utils/dist/index.mjs
2
+ const NPM_CDN_ORIGIN = "https://esm.sh";
3
+ function getNpmCdnUrl(target, externals = []) {
4
+ const url = `${NPM_CDN_ORIGIN}/${target}`;
5
+ return externals.length ? `${url}?external=${externals.join(",")}` : url;
6
+ }
7
+ function cloneDeep(object) {
8
+ if (typeof object !== "object") return object;
9
+ const strategies = [
10
+ () => JSON.parse(JSON.stringify(object)),
11
+ () => structuredClone(object),
12
+ () => safeClone(object)
13
+ ];
14
+ let lastError;
15
+ for (const strategy of strategies) try {
16
+ return strategy();
17
+ } catch (error) {
18
+ lastError = error;
19
+ continue;
20
+ }
21
+ console.error("Failed to deep clone object:", object);
22
+ throw new Error(String(lastError));
23
+ }
24
+ function safeClone(object) {
25
+ const seen = /* @__PURE__ */ new WeakSet();
26
+ return recursiveClone(object);
27
+ function recursiveClone(object) {
28
+ if (typeof object !== "object" || object === null) return object;
29
+ if (seen.has(object)) return { recursive: true };
30
+ seen.add(object);
31
+ if (Array.isArray(object)) return object.map((element) => recursiveClone(element));
32
+ const clone = {};
33
+ for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(object))) clone[key] = recursiveClone(descriptor.value);
34
+ return clone;
35
+ }
36
+ }
37
+ function cloneWithFunctions(object) {
38
+ if (Array.isArray(object)) return object.map(cloneWithFunctions);
39
+ if (typeof object !== "object" || object === null) return object;
40
+ const clone = {};
41
+ for (const [key, value] of Object.entries(object)) clone[key] = typeof value === "function" ? value : cloneWithFunctions(value);
42
+ return clone;
43
+ }
44
+ function assertType(_arg) {}
45
+ function objectMap(source, func) {
46
+ if (!source) return {};
47
+ return Object.fromEntries(Object.entries(source).map(([key, value]) => [key, func({
48
+ key,
49
+ value
50
+ })]));
51
+ }
52
+ function objectFilter(source, func) {
53
+ if (!source) return {};
54
+ return Object.fromEntries(Object.entries(source).filter(([key, value]) => func({
55
+ key,
56
+ value
57
+ })));
58
+ }
59
+ function objectFullMap(source, func) {
60
+ if (!source) return {};
61
+ return Object.fromEntries(Object.entries(source).map(([key, value]) => {
62
+ const result = func({
63
+ key,
64
+ value
65
+ });
66
+ return [result.key, result.value];
67
+ }));
68
+ }
69
+ function cleanObject(target) {
70
+ const record = cloneDeep(target);
71
+ for (const key in record) cleanDeep(record, key);
72
+ function cleanDeep(value, key) {
73
+ const child = value[key];
74
+ if (child && typeof child === "object") {
75
+ for (const childKey in child) cleanDeep(child, childKey);
76
+ if (Object.keys(child).length === 0) delete value[key];
77
+ }
78
+ }
79
+ return record;
80
+ }
81
+ function isRawObject(target) {
82
+ if (target !== null && typeof target === "object") return Object.getPrototypeOf(target) === Object.prototype;
83
+ return false;
84
+ }
85
+ export { getNpmCdnUrl as a, objectFullMap as c, cloneWithFunctions as i, objectMap as l, cleanObject as n, isRawObject as o, cloneDeep as r, objectFilter as s, assertType as t };
@@ -1,82 +1,4 @@
1
- // ../utils/dist/index.mjs
2
- function cloneDeep(object) {
3
- if (typeof object !== "object") return object;
4
- const strategies = [
5
- () => JSON.parse(JSON.stringify(object)),
6
- () => structuredClone(object),
7
- () => safeClone(object)
8
- ];
9
- let lastError;
10
- for (const strategy of strategies) try {
11
- return strategy();
12
- } catch (error) {
13
- lastError = error;
14
- continue;
15
- }
16
- console.error("Failed to deep clone object:", object);
17
- throw new Error(String(lastError));
18
- }
19
- function safeClone(object) {
20
- const seen = /* @__PURE__ */ new WeakSet();
21
- return recursiveClone(object);
22
- function recursiveClone(object) {
23
- if (typeof object !== "object" || object === null) return object;
24
- if (seen.has(object)) return { recursive: true };
25
- seen.add(object);
26
- if (Array.isArray(object)) return object.map((element) => recursiveClone(element));
27
- const clone = {};
28
- for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(object))) clone[key] = recursiveClone(descriptor.value);
29
- return clone;
30
- }
31
- }
32
- function cloneWithFunctions(object) {
33
- if (Array.isArray(object)) return object.map(cloneWithFunctions);
34
- if (typeof object !== "object" || object === null) return object;
35
- const clone = {};
36
- for (const [key, value] of Object.entries(object)) clone[key] = typeof value === "function" ? value : cloneWithFunctions(value);
37
- return clone;
38
- }
39
- function assertType(_arg) {}
40
- function objectMap(source, func) {
41
- if (!source) return {};
42
- return Object.fromEntries(Object.entries(source).map(([key, value]) => [key, func({
43
- key,
44
- value
45
- })]));
46
- }
47
- function objectFilter(source, func) {
48
- if (!source) return {};
49
- return Object.fromEntries(Object.entries(source).filter(([key, value]) => func({
50
- key,
51
- value
52
- })));
53
- }
54
- function objectFullMap(source, func) {
55
- if (!source) return {};
56
- return Object.fromEntries(Object.entries(source).map(([key, value]) => {
57
- const result = func({
58
- key,
59
- value
60
- });
61
- return [result.key, result.value];
62
- }));
63
- }
64
- function cleanObject(target) {
65
- const record = cloneDeep(target);
66
- for (const key in record) cleanDeep(record, key);
67
- function cleanDeep(value, key) {
68
- const child = value[key];
69
- if (child && typeof child === "object") {
70
- for (const childKey in child) cleanDeep(child, childKey);
71
- if (Object.keys(child).length === 0) delete value[key];
72
- }
73
- }
74
- return record;
75
- }
76
- function isRawObject(target) {
77
- if (target !== null && typeof target === "object") return Object.getPrototypeOf(target) === Object.prototype;
78
- return false;
79
- }
1
+ import { c as objectFullMap, l as objectMap, o as isRawObject, r as cloneDeep, s as objectFilter, t as assertType } from "./dist-BBW6rNSm.mjs";
80
2
  // ../logicnodes/dist/index.mjs
81
3
  const interfaceConfigs = {};
82
4
  function isInterfaceConstant(value) {
@@ -368,6 +290,7 @@ function objectToSchema(object, args = {}) {
368
290
  switch (typeof object) {
369
291
  case "object":
370
292
  if (Array.isArray(object)) {
293
+ assertType(args);
371
294
  if (object.length === 0) return LogicType.array(LogicType.unknown(), {
372
295
  ...args,
373
296
  customizable: true
@@ -378,10 +301,17 @@ function objectToSchema(object, args = {}) {
378
301
  if (object === null) return LogicType.unknown(args);
379
302
  if (isInterfaceConstant(object)) return LogicType.interface(object._interface, args);
380
303
  if (object._dynamic) return LogicType.unknown(args);
304
+ assertType(args);
381
305
  return LogicType.object(objectMap(object, ({ key, value }) => objectToSchema(value, { name: key })), args);
382
- case "boolean": return LogicType.boolean(args);
383
- case "number": return LogicType.number(args);
384
- case "string": return LogicType.string(args);
306
+ case "boolean":
307
+ assertType(args);
308
+ return LogicType.boolean(args);
309
+ case "number":
310
+ assertType(args);
311
+ return LogicType.number(args);
312
+ case "string":
313
+ assertType(args);
314
+ return LogicType.string(args);
385
315
  default: return LogicType.unknown(args);
386
316
  }
387
317
  }
@@ -823,7 +753,10 @@ function schemaLoop(schema, func, key) {
823
753
  schema.inputs = schemaLoop(schema.inputs, func);
824
754
  schema.output = schemaLoop(schema.output, func);
825
755
  }
826
- if (["union", "intersection"].includes(schema.type)) for (const key in schema.elements) schema.elements[key] = schemaLoop(schema.elements[key], func);
756
+ if (["union", "intersection"].includes(schema.type)) {
757
+ assertType(schema);
758
+ for (const key in schema.elements) schema.elements[key] = schemaLoop(schema.elements[key], func);
759
+ }
827
760
  return schema;
828
761
  }
829
762
  function getSubSchema(schema) {
@@ -891,4 +824,4 @@ function createInterfaceInstance(className) {
891
824
  return;
892
825
  }
893
826
  }
894
- export { LogicUtil as a, mergeIntersection as c, assertType as d, cleanObject as f, LogicType as i, schemaLoop as l, objectMap as m, ELogicType as n, getSchemaDefault as o, cloneWithFunctions as p, EVarType as r, makeLogicNode as s, ELogicScope as t, typeToSchema as u };
827
+ export { LogicUtil as a, mergeIntersection as c, LogicType as i, schemaLoop as l, ELogicType as n, getSchemaDefault as o, EVarType as r, makeLogicNode as s, ELogicScope as t, typeToSchema as u };
@@ -1,4 +1,4 @@
1
- import { d as TSchema } from "./index-B4kxQtaL.mjs";
1
+ import { d as TSchema } from "./index-Dz0vJvpL.mjs";
2
2
  import * as ts$1 from "typescript";
3
3
  import ts from "typescript";
4
4
  type TExportResult = {
@@ -1,4 +1,5 @@
1
- import { d as assertType, f as cleanObject, i as LogicType, l as schemaLoop, m as objectMap, r as EVarType, u as typeToSchema } from "./dist-CZjmIqBC.mjs";
1
+ import { l as objectMap, n as cleanObject, t as assertType } from "./dist-BBW6rNSm.mjs";
2
+ import { i as LogicType, l as schemaLoop, r as EVarType, u as typeToSchema } from "./dist-Dyisk4Ug.mjs";
2
3
  import fs from "node:fs";
3
4
  import ts, * as ts$1 from "typescript";
4
5
  import * as path from "path";
@@ -43,8 +43,9 @@ declare enum EVarType {
43
43
  void = "void"
44
44
  }
45
45
  type TProperties = Record<string, TSchema>;
46
- /** Schema options, augmentable by the packages that own each option with `declare module "@luna-park/logicnodes"`. */
46
+ /** Schema options, augmentable by the packages that own each option with `declare module "@luna-park/logicnodes"`. Other keys are free for plugin inputs. */
47
47
  interface TSchemaOptions {
48
+ [key: string]: unknown;
48
49
  access?: TSchema<TObject>;
49
50
  clamp?: boolean;
50
51
  clean?: boolean;
@@ -56,6 +57,7 @@ interface TSchemaOptions {
56
57
  index?: boolean;
57
58
  input?: string;
58
59
  insert?: number | "last";
60
+ literal?: boolean;
59
61
  max?: number;
60
62
  min?: number;
61
63
  multiplier?: number;
@@ -196,21 +198,21 @@ type TSchema<TLogic extends TAnyLogic = TAnyLogic> = TLogic & TArguments;
196
198
  declare const LogicType: {
197
199
  array: <T extends TSchema, TArgs extends TSchemaArguments<Array<StaticSchema<T>>>>(items: T, args?: TArgs) => TSchema<TArray<T>> & NoInfer<TArgs>;
198
200
  boolean: <TArgs extends TSchemaArguments<boolean>>(args?: TArgs) => TSchema<TBoolean> & NoInfer<TArgs>;
199
- exec: <const TArgs extends TArguments = {}>(args?: TArgs) => TSchema<TExec> & NoInfer<TArgs>;
201
+ exec: <const TArgs extends TArguments = {}>(args?: TArgs & TArguments) => TSchema<TExec> & NoInfer<TArgs>;
200
202
  function: typeof createFunction;
201
203
  interface: <T = unknown, TArgs extends TSchemaArguments<T> = TSchemaArguments<T>>(interfaceClass: (new (...args: Array<never>) => T) | string, args?: TArgs) => TSchema<TInterface<T>> & NoInfer<TArgs>;
202
- intersection: <const T extends ReadonlyArray<TSchema>, const TArgs extends TSchemaArguments<StaticIntersection<T>> = {}>(elements: T, args?: TArgs) => TSchema<TIntersection<T>> & NoInfer<TArgs>;
204
+ intersection: <const T extends ReadonlyArray<TSchema>, const TArgs extends TSchemaArguments<StaticIntersection<T>> = {}>(elements: T, args?: TArgs & TSchemaArguments<StaticIntersection<T>>) => TSchema<TIntersection<T>> & NoInfer<TArgs>;
203
205
  number: <TArgs extends TSchemaArguments<number>>(args?: TArgs) => TSchema<TNumber> & NoInfer<TArgs>;
204
206
  object: <T extends TProperties, TArgs extends TSchemaArguments<object>>(properties?: T, args?: TArgs) => TSchema<TObject<T>> & NoInfer<TArgs>;
205
- record: <TKey extends TRecordKey, TValue extends TSchema, const TArgs extends TSchemaArguments<StaticRecord<TKey, TValue>> = {}>(key: TKey, value: TValue, args?: TArgs) => TSchema<TRecord<TKey, TValue>> & NoInfer<TArgs>;
207
+ record: <TKey extends TRecordKey, TValue extends TSchema, const TArgs extends TSchemaArguments<StaticRecord<TKey, TValue>> = {}>(key: TKey, value: TValue, args?: TArgs & TSchemaArguments<StaticRecord<TKey, TValue>>) => TSchema<TRecord<TKey, TValue>> & NoInfer<TArgs>;
206
208
  string: <const TValue extends string = string, TArgs extends TSchemaArguments<string> = TSchemaArguments<string>>(args?: TArgs & {
207
209
  enum?: TEnum<TValue>;
208
210
  }) => TSchema<TString<TValue>> & NoInfer<TArgs>;
209
211
  type: typeof createType;
210
- undefined: <const TArgs extends TSchemaArguments<undefined> = {}>(args?: TArgs) => TSchema<TUndefined> & NoInfer<TArgs>;
211
- union: <const T extends ReadonlyArray<TSchema>, const TArgs extends TSchemaArguments<StaticUnion<T>> = {}>(elements: T, args?: TArgs) => TSchema<TUnion<T>> & NoInfer<TArgs>;
212
+ undefined: <const TArgs extends TSchemaArguments<undefined> = {}>(args?: TArgs & TSchemaArguments<undefined>) => TSchema<TUndefined> & NoInfer<TArgs>;
213
+ union: <const T extends ReadonlyArray<TSchema>, const TArgs extends TSchemaArguments<StaticUnion<T>> = {}>(elements: T, args?: TArgs & TSchemaArguments<StaticUnion<T>>) => TSchema<TUnion<T>> & NoInfer<TArgs>;
212
214
  unknown: <T = unknown, TArgs extends TSchemaArguments<T> = TSchemaArguments<T>>(args?: TArgs) => TSchema<TUnknown<T>> & NoInfer<TArgs>;
213
- void: <const TArgs extends TSchemaArguments<void> = {}>(args?: TArgs) => TSchema<TVoid> & NoInfer<TArgs>;
215
+ void: <const TArgs extends TSchemaArguments<void> = {}>(args?: TArgs & TSchemaArguments<void>) => TSchema<TVoid> & NoInfer<TArgs>;
214
216
  };
215
217
  type OptionalKeys<T extends TProperties> = { [K in keyof T]: T[K] extends {
216
218
  optional: true;
@@ -371,6 +373,7 @@ type TDocumentation = {
371
373
  value: unknown;
372
374
  }>;
373
375
  }>;
376
+ llm?: string;
374
377
  parameters?: Array<{
375
378
  description: string;
376
379
  name: string;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as TVector, a as LogicUtil, c as TInterfaceConstantValue, d as TSchema, f as TVoid, g as MaybePromise, h as DeepPartial, i as LogicType, l as TLogicNode, m as CVector, n as ELogicType, o as Static, p as makeLogicNode, r as EVarType, s as TInterfaceConfig, t as ELogicScope, u as TObject } from "./index-B4kxQtaL.mjs";
1
+ import { _ as TVector, a as LogicUtil, c as TInterfaceConstantValue, d as TSchema, f as TVoid, g as MaybePromise, h as DeepPartial, i as LogicType, l as TLogicNode, m as CVector, n as ELogicType, o as Static, p as makeLogicNode, r as EVarType, s as TInterfaceConfig, t as ELogicScope, u as TObject } from "./index-Dz0vJvpL.mjs";
2
2
  import { Component, ComputedRef, Directive } from "vue";
3
3
  import "@sinclair/typebox";
4
4
  import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
@@ -178,48 +178,6 @@ type TFileBase = TFileBaseExport & {
178
178
  id: string;
179
179
  parent?: TFolder;
180
180
  };
181
- declare enum ELayoutElement {
182
- input = "input",
183
- div = "div",
184
- media = "media",
185
- customText = "customText",
186
- component = "component",
187
- package = "package",
188
- customHtml = "customHtml",
189
- slot = "slot",
190
- template = "template",
191
- variable = "variable",
192
- link = "link"
193
- }
194
- declare enum ETokenType {
195
- Class = "class",
196
- Color = "color",
197
- FontSize = "font-size",
198
- FontWeight = "font-weight",
199
- FontFamily = "font-family",
200
- Length = "length",
201
- Time = "time"
202
- }
203
- declare module "@luna-park/logicnodes" {
204
- interface TSchemaOptions {
205
- custom?: boolean;
206
- displayGrid?: number;
207
- dual?: boolean;
208
- filter?: boolean;
209
- flex?: boolean;
210
- grid?: boolean;
211
- image?: boolean;
212
- mode?: "corner";
213
- number?: boolean;
214
- quad?: boolean;
215
- ref?: boolean;
216
- shadow?: boolean;
217
- units?: Array<string>;
218
- }
219
- interface TString<T extends string = string> {
220
- target?: string;
221
- }
222
- }
223
181
  declare enum ELayoutValueType {
224
182
  Variable = "variable",
225
183
  Property = "property",
@@ -338,6 +296,48 @@ type TValue = {
338
296
  parent?: TLogic;
339
297
  schema: TSchema;
340
298
  };
299
+ declare enum ELayoutElement {
300
+ input = "input",
301
+ div = "div",
302
+ media = "media",
303
+ customText = "customText",
304
+ component = "component",
305
+ package = "package",
306
+ customHtml = "customHtml",
307
+ slot = "slot",
308
+ template = "template",
309
+ variable = "variable",
310
+ link = "link"
311
+ }
312
+ declare enum ETokenType {
313
+ Class = "class",
314
+ Color = "color",
315
+ FontSize = "font-size",
316
+ FontWeight = "font-weight",
317
+ FontFamily = "font-family",
318
+ Length = "length",
319
+ Time = "time"
320
+ }
321
+ declare module "@luna-park/logicnodes" {
322
+ interface TSchemaOptions {
323
+ custom?: boolean;
324
+ displayGrid?: number;
325
+ dual?: boolean;
326
+ filter?: boolean;
327
+ flex?: boolean;
328
+ grid?: boolean;
329
+ image?: boolean;
330
+ mode?: "corner";
331
+ number?: boolean;
332
+ quad?: boolean;
333
+ ref?: boolean;
334
+ shadow?: boolean;
335
+ units?: Array<string>;
336
+ }
337
+ interface TString<T extends string = string> {
338
+ target?: string;
339
+ }
340
+ }
341
341
  type TTextBlock = {
342
342
  content: string;
343
343
  key: string;
@@ -391,6 +391,13 @@ type TLayoutClassOf<TStyle> = {
391
391
  };
392
392
  type TLayoutClassExport = TLayoutClassOf<TLayoutStyleExport>;
393
393
  type TLayoutClass = TLayoutClassOf<TLayoutStyle>;
394
+ /**
395
+ * Class applied to an element: `name` is a constant, a class token or a variable, applied while `toggle` is truthy (always when absent)
396
+ */
397
+ type TLayoutClassBindingOf<TVariable> = {
398
+ name: TVariable;
399
+ toggle?: TVariable;
400
+ };
394
401
  type TLayoutEventParameterOf<TVariable> = {
395
402
  schema: TSchema;
396
403
  value: TVariable;
@@ -401,7 +408,7 @@ interface TLayoutNodeOf<TElement extends TLayoutElementType, TVariable, TChild,
401
408
  id: string;
402
409
  name: string;
403
410
  children: Array<TChild>;
404
- classes: Array<TVariable>;
411
+ classes: Array<TLayoutClassBindingOf<TVariable>>;
405
412
  collapsed?: boolean;
406
413
  content: TLayoutContentOf<TElement, TVariable, TChild>;
407
414
  element: TElement;
@@ -719,6 +726,8 @@ type TApplicationConfig = {
719
726
  }>;
720
727
  state: {
721
728
  currentTab: string;
729
+ deployAppId?: string;
730
+ deployServerId?: string;
722
731
  explorerSort?: EFileSortStrategy;
723
732
  tabs: Array<string>;
724
733
  };
@@ -802,7 +811,10 @@ interface TLogicOf<TGraph, TValue, TAnchor> extends TLogicBaseOf<TGraph, TValue>
802
811
  type: EElementType.Logic | EElementType.Standalone;
803
812
  async: boolean;
804
813
  code?: string;
814
+ description?: string;
805
815
  export: boolean;
816
+ hue?: number;
817
+ icon?: string;
806
818
  inputs: Record<string, TAnchor>;
807
819
  mode: ELogicMode;
808
820
  outputs: Record<string, TAnchor>;
@@ -1157,12 +1169,18 @@ type TBasePlugin<TConfig extends TSchema = TSchema, TInternals = unknown> = {
1157
1169
  };
1158
1170
  llm?: string;
1159
1171
  name: string;
1160
- settings?: Array<{
1161
- component: Component;
1162
- icon?: IconDefinition | string;
1163
- label: string;
1164
- }>;
1165
1172
  windows?: Record<string, Component>;
1173
+ workspace?: {
1174
+ preview?: Component;
1175
+ sections: Array<TPluginWorkspaceSection>;
1176
+ };
1177
+ };
1178
+ type TPluginWorkspaceSection = {
1179
+ component: Component;
1180
+ description?: string;
1181
+ icon: IconDefinition | string;
1182
+ id: string;
1183
+ title: string;
1166
1184
  };
1167
1185
  type TPlugin<TConfig extends TSchema = TSchema, TInternal = unknown, TBase extends TBasePlugin<TConfig, TInternal> = TBasePlugin<TConfig, TInternal>> = Omit<TBase, "build" | "editor" | "inject"> & { [TCategory in "build" | "editor" | "inject"]?: { [TKey in keyof NonNullable<TBase[TCategory]>]: TOption<TEnv<TConfig, TInternal>, NonNullable<TBase[TCategory]>[TKey]>; }; };
1168
1186
  type TProxyPlugin<TConfig extends TSchema = TSchema, TInternal = unknown, TBase extends TBasePlugin<TConfig, TInternal> = TBasePlugin<TConfig, TInternal>> = Omit<TBase, "build" | "editor" | "inject"> & { [TCategory in "build" | "editor" | "inject"]?: { [TKey in keyof NonNullable<TBase[TCategory]>]: Promise<NonNullable<TBase[TCategory]>[TKey]>; }; };
@@ -1201,4 +1219,4 @@ export declare function loadPlugin<TConfig extends TSchema, TInternal>(plugin: T
1201
1219
  export declare function sortPlugins<T extends Pick<TBasePlugin, "dependencies" | "id">>(plugins: Array<T>): Array<T>;
1202
1220
  export declare function getPluginApi<TApi = unknown>(plugin: Pick<TBasePlugin, "api" | "config" | "id"> | undefined, env: Partial<TEnv>): Promise<TApi | undefined>;
1203
1221
  export declare function getPluginParam<T>(target: TOption<TEnv, T>, env: Partial<TEnv>): Promise<T>;
1204
- export { EDBCondition, EDBOperation, EElementType, ELogicScope, ELogicType, ETokenType, EVarType, _default as LSettingsStoryWrapper, LogicType, LogicUtil, type Static, type TAnyLogic, type TAnyLogicExport, type TApplication, type TApplicationExport, type TBasePlugin, type TComponent, type TDBCondition, type TDBOperation, type TElementPanel, type TElementPanelAction, type TElementPanelProps, type TEnv, type TFile, type TFileComponent, type TFileComponentExport, type TFileConfig, type TFileConfigExport, type TFileCron, type TFileCronExport, type TFileDatabase, type TFileDatabaseExport, type TFileExport, type TFileMedia, type TFileMediaExport, type TFileRoute, type TFileRouteExport, type TFileScript, type TFileScriptExport, type TFileStore, type TFileStoreExport, type TFileText, type TFileTextExport, type TFileType, type TFileTypeExport, type TFolder, type TFolderExport, type THookParams, type THost, type TInterface, type TInterfaceEditorProps, type TLayoutSchema, type TLayoutSchemaExport, type TLogic, type TLogicExport, type TLogicMain, type TLogicMainExport, type TLogicNode, type TOption, type TPanels, type TPlugin, type TPluginElement, type TProxyPlugin, type TRouteGuard, type TSchema, type TSlot, type TTemplate, type TToken, makeLogicNode };
1222
+ export { EDBCondition, EDBOperation, EElementType, ELogicScope, ELogicType, ETokenType, EVarType, _default as LSettingsStoryWrapper, LogicType, LogicUtil, type Static, type TAnyLogic, type TAnyLogicExport, type TApplication, type TApplicationExport, type TBasePlugin, type TComponent, type TDBCondition, type TDBOperation, type TElementPanel, type TElementPanelAction, type TElementPanelProps, type TEnv, type TFile, type TFileComponent, type TFileComponentExport, type TFileConfig, type TFileConfigExport, type TFileCron, type TFileCronExport, type TFileDatabase, type TFileDatabaseExport, type TFileExport, type TFileMedia, type TFileMediaExport, type TFileRoute, type TFileRouteExport, type TFileScript, type TFileScriptExport, type TFileStore, type TFileStoreExport, type TFileText, type TFileTextExport, type TFileType, type TFileTypeExport, type TFolder, type TFolderExport, type THookParams, type THost, type TInterface, type TInterfaceEditorProps, type TLayoutSchema, type TLayoutSchemaExport, type TLogic, type TLogicExport, type TLogicMain, type TLogicMainExport, type TLogicNode, type TOption, type TPanels, type TPlugin, type TPluginElement, type TPluginWorkspaceSection, type TProxyPlugin, type TRouteGuard, type TSchema, type TSlot, type TTemplate, type TToken, makeLogicNode };
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import { a as LogicUtil, c as mergeIntersection, i as LogicType, n as ELogicType, o as getSchemaDefault, p as cloneWithFunctions, r as EVarType, s as makeLogicNode, t as ELogicScope } from "./dist-CZjmIqBC.mjs";
1
+ import { i as cloneWithFunctions } from "./dist-BBW6rNSm.mjs";
2
+ import { a as LogicUtil, c as mergeIntersection, i as LogicType, n as ELogicType, o as getSchemaDefault, r as EVarType, s as makeLogicNode, t as ELogicScope } from "./dist-Dyisk4Ug.mjs";
2
3
  import { createElementBlock, openBlock, renderSlot } from "vue";
3
4
  import { Type } from "@sinclair/typebox";
4
5
  // \0/plugin-vue/export-helper
@@ -25,73 +26,7 @@ var __exportAll = (all, no_symbols) => {
25
26
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
26
27
  return target;
27
28
  };
28
- // ../shared/dist/index.mjs
29
- const config = {
30
- backendUrl: "https://luna-park.app",
31
- hostUrl: "https://host.luna-park.app",
32
- webSocketUrl: "wss://luna-park.app"
33
- };
34
- const baseConfig = {
35
- credentials: "include",
36
- headers: {
37
- "Accept": "application/json, text/plain",
38
- "Content-Type": "application/json"
39
- },
40
- mode: "cors"
41
- };
42
- const baseMultiConfig = {
43
- credentials: "include",
44
- headers: { Accept: "application/json, text/plain" },
45
- mode: "cors"
46
- };
47
- var api_default = {
48
- async delete(url, config) {
49
- const init = {
50
- ...baseConfig,
51
- method: "DELETE",
52
- ...config
53
- };
54
- if (!init.body) {
55
- init.headers = { ...init.headers };
56
- delete init.headers["Content-Type"];
57
- }
58
- return fetch(url, init);
59
- },
60
- async get(url, config) {
61
- return await fetch(url, {
62
- ...baseConfig,
63
- method: "GET",
64
- ...config
65
- });
66
- },
67
- getBaseUrl({ dev } = { dev: false }) {
68
- return `${config.backendUrl}/${dev ? "dev" : "api"}`;
69
- },
70
- async multipart(url, data, config) {
71
- return await fetch(url, {
72
- ...baseMultiConfig,
73
- body: data,
74
- method: "POST",
75
- ...config
76
- });
77
- },
78
- async post(url, data, config) {
79
- return await fetch(url, {
80
- ...baseConfig,
81
- body: JSON.stringify(data) || "{}",
82
- method: "POST",
83
- ...config
84
- });
85
- },
86
- async put(url, data, config) {
87
- return await fetch(url, {
88
- ...baseConfig,
89
- body: JSON.stringify(data) || "{}",
90
- method: "PUT",
91
- ...config
92
- });
93
- }
94
- };
29
+ // ../shared/dist/types-CvOhRij4.mjs
95
30
  const TypeDate = Type.String({ format: "date-time" });
96
31
  var app_exports$1 = /* @__PURE__ */ __exportAll({
97
32
  app: () => app,
@@ -110,7 +45,7 @@ const appEdits = Type.Array(Type.Object({
110
45
  file: Type.Unknown(),
111
46
  path: Type.String()
112
47
  }));
113
- const project = Type.Object({
48
+ const project$1 = Type.Object({
114
49
  id: Type.String(),
115
50
  app: Type.Object({
116
51
  name: Type.String(),
@@ -127,9 +62,9 @@ const project = Type.Object({
127
62
  starsCount: Type.Number()
128
63
  })
129
64
  });
130
- const publicProject = project;
65
+ const publicProject = project$1;
131
66
  const privateProject = Type.Object({
132
- ...project.properties,
67
+ ...project$1.properties,
133
68
  app: Type.Unknown()
134
69
  });
135
70
  const session = Type.Object({
@@ -188,7 +123,6 @@ const flags = {
188
123
  flags.pro, flags.pro, flags.free;
189
124
  const user = Type.Object({
190
125
  id: Type.Optional(Type.String()),
191
- auth: Type.Optional(Type.Object({})),
192
126
  mail: Type.String(),
193
127
  plan: Type.Object({
194
128
  name: Type.Enum(EPlanKey),
@@ -239,6 +173,81 @@ let EElementType = /* @__PURE__ */ function(EElementType) {
239
173
  EElementType["Media"] = "media";
240
174
  return EElementType;
241
175
  }({});
176
+ const types = {
177
+ ...app_exports$1,
178
+ privateProject,
179
+ project: project$1,
180
+ publicProject,
181
+ session,
182
+ user
183
+ };
184
+ // ../shared/dist/index.mjs
185
+ const config = {
186
+ backendUrl: "https://luna-park.app",
187
+ hostUrl: "https://host.luna-park.app",
188
+ webSocketUrl: "wss://luna-park.app"
189
+ };
190
+ const baseConfig = {
191
+ credentials: "include",
192
+ headers: {
193
+ "Accept": "application/json, text/plain",
194
+ "Content-Type": "application/json"
195
+ },
196
+ mode: "cors"
197
+ };
198
+ const baseMultiConfig = {
199
+ credentials: "include",
200
+ headers: { Accept: "application/json, text/plain" },
201
+ mode: "cors"
202
+ };
203
+ var api_default = {
204
+ async delete(url, config) {
205
+ const init = {
206
+ ...baseConfig,
207
+ method: "DELETE",
208
+ ...config
209
+ };
210
+ if (!init.body) {
211
+ init.headers = { ...init.headers };
212
+ delete init.headers["Content-Type"];
213
+ }
214
+ return fetch(url, init);
215
+ },
216
+ async get(url, config) {
217
+ return await fetch(url, {
218
+ ...baseConfig,
219
+ method: "GET",
220
+ ...config
221
+ });
222
+ },
223
+ getBaseUrl({ dev } = { dev: false }) {
224
+ return `${config.backendUrl}/${dev ? "dev" : "api"}`;
225
+ },
226
+ async multipart(url, data, config) {
227
+ return await fetch(url, {
228
+ ...baseMultiConfig,
229
+ body: data,
230
+ method: "POST",
231
+ ...config
232
+ });
233
+ },
234
+ async post(url, data, config) {
235
+ return await fetch(url, {
236
+ ...baseConfig,
237
+ body: JSON.stringify(data) || "{}",
238
+ method: "POST",
239
+ ...config
240
+ });
241
+ },
242
+ async put(url, data, config) {
243
+ return await fetch(url, {
244
+ ...baseConfig,
245
+ body: JSON.stringify(data) || "{}",
246
+ method: "PUT",
247
+ ...config
248
+ });
249
+ }
250
+ };
242
251
  let EDBOperation = /* @__PURE__ */ function(EDBOperation) {
243
252
  EDBOperation["And"] = "and";
244
253
  EDBOperation["Or"] = "or";
@@ -259,14 +268,6 @@ let EDBCondition = /* @__PURE__ */ function(EDBCondition) {
259
268
  EDBCondition["Contains"] = "contains";
260
269
  return EDBCondition;
261
270
  }({});
262
- const types = {
263
- ...app_exports$1,
264
- privateProject,
265
- project,
266
- publicProject,
267
- session,
268
- user
269
- };
270
271
  var app_exports = /* @__PURE__ */ __exportAll({
271
272
  edit: () => edit$1,
272
273
  get: () => get$3
@@ -395,23 +396,37 @@ const download = {
395
396
  url: "/compiler/download/:id/:target"
396
397
  };
397
398
  var deploy_exports = /* @__PURE__ */ __exportAll({
399
+ addDomain: () => addDomain,
398
400
  addServerMember: () => addServerMember,
401
+ checkManagedDomain: () => checkManagedDomain,
402
+ claimManagedDomain: () => claimManagedDomain,
399
403
  create: () => create$2,
404
+ createDesktop: () => createDesktop,
405
+ destroyApplication: () => destroyApplication,
406
+ destroyEnvironment: () => destroyEnvironment,
407
+ environmentLink: () => environmentLink,
400
408
  environments: () => environments,
401
409
  events: () => events,
402
410
  getVariables: () => getVariables,
411
+ listDomains: () => listDomains,
403
412
  listServerMembers: () => listServerMembers,
404
413
  listServers: () => listServers,
414
+ managedDomainZone: () => managedDomainZone,
405
415
  monitoringLink: () => monitoringLink,
406
416
  promote: () => promote,
407
417
  rebuild: () => rebuild,
418
+ registerDesktop: () => registerDesktop,
419
+ removeDomain: () => removeDomain,
408
420
  removeServerMember: () => removeServerMember,
421
+ revokeEnvironmentLinks: () => revokeEnvironmentLinks,
409
422
  rollback: () => rollback,
410
423
  runtime: () => runtime,
411
424
  serverBackups: () => serverBackups,
412
425
  setAutoUpdate: () => setAutoUpdate,
426
+ setEnvironmentAccess: () => setEnvironmentAccess,
413
427
  setVariables: () => setVariables,
414
- updateServer: () => updateServer
428
+ updateServer: () => updateServer,
429
+ verifyDomain: () => verifyDomain
415
430
  });
416
431
  const create$2 = {
417
432
  type: "post",
@@ -429,6 +444,32 @@ const environmentParams = Type.Object({
429
444
  environment: environmentKind
430
445
  });
431
446
  const messageResponse = Type.Object({ message: Type.String() });
447
+ const registerDesktop = {
448
+ type: "post",
449
+ body: Type.Object({
450
+ name: Type.String({
451
+ maxLength: 200,
452
+ minLength: 1
453
+ }),
454
+ icon: Type.String({ maxLength: 64 })
455
+ }),
456
+ response: { 200: Type.Object({ id: Type.String({ format: "uuid" }) }) },
457
+ url: "/deploy/desktop"
458
+ };
459
+ const createDesktop = {
460
+ type: "post",
461
+ body: Type.Object({
462
+ archive: Type.Object({
463
+ filename: Type.String(),
464
+ mimetype: Type.String()
465
+ }),
466
+ serverId: Type.Object({ value: Type.String({ format: "uuid" }) })
467
+ }),
468
+ multipart: true,
469
+ params: environmentParams,
470
+ response: { 200: Type.Object({ id: Type.String({ format: "uuid" }) }) },
471
+ url: "/deploy/desktop/:appId/:environment"
472
+ };
432
473
  const deploymentSummary = Type.Object({
433
474
  id: Type.String({ format: "uuid" }),
434
475
  baseHash: Type.Union([Type.String(), Type.Null()]),
@@ -503,6 +544,7 @@ const environments = {
503
544
  environments: Type.Array(Type.Object({
504
545
  active: Type.Union([deploymentSummary, Type.Null()]),
505
546
  history: Type.Array(deploymentSummary),
547
+ isPrivate: Type.Boolean(),
506
548
  kind: environmentKind,
507
549
  pending: Type.Union([deploymentSummary, Type.Null()]),
508
550
  status: Type.String(),
@@ -512,6 +554,99 @@ const environments = {
512
554
  }) },
513
555
  url: "/deploy/:appId/environments"
514
556
  };
557
+ const environmentLink = {
558
+ type: "post",
559
+ body: Type.Object({ mode: Type.Union([Type.Literal("open"), Type.Literal("share")]) }),
560
+ params: environmentParams,
561
+ response: { 200: Type.Object({
562
+ expiresAt: Type.Union([Type.String(), Type.Null()]),
563
+ url: Type.String()
564
+ }) },
565
+ url: "/deploy/:appId/:environment/link"
566
+ };
567
+ const environmentDomain = Type.Object({
568
+ id: Type.String({ format: "uuid" }),
569
+ hostname: Type.String(),
570
+ lastError: Type.Union([Type.String(), Type.Null()]),
571
+ managed: Type.Boolean(),
572
+ records: Type.Object({
573
+ a: Type.Union([Type.String(), Type.Null()]),
574
+ aaaa: Type.Union([Type.String(), Type.Null()])
575
+ }),
576
+ routed: Type.Boolean(),
577
+ verifiedAt: Type.Union([Type.String(), Type.Null()])
578
+ });
579
+ const domainParams = Type.Object({
580
+ ...environmentParams.properties,
581
+ domainId: Type.String({ format: "uuid" })
582
+ });
583
+ const listDomains = {
584
+ type: "get",
585
+ params: environmentParams,
586
+ response: { 200: Type.Array(environmentDomain) },
587
+ url: "/deploy/:appId/:environment/domains"
588
+ };
589
+ const addDomain = {
590
+ type: "post",
591
+ body: Type.Object({ hostname: Type.String({
592
+ maxLength: 260,
593
+ minLength: 1
594
+ }) }),
595
+ params: environmentParams,
596
+ response: { 200: environmentDomain },
597
+ url: "/deploy/:appId/:environment/domains"
598
+ };
599
+ const removeDomain = {
600
+ type: "delete",
601
+ params: domainParams,
602
+ response: { 200: messageResponse },
603
+ url: "/deploy/:appId/:environment/domains/:domainId"
604
+ };
605
+ const verifyDomain = {
606
+ type: "post",
607
+ params: domainParams,
608
+ response: { 200: environmentDomain },
609
+ url: "/deploy/:appId/:environment/domains/:domainId/verify"
610
+ };
611
+ const managedDomainZone = {
612
+ type: "get",
613
+ response: { 200: Type.Object({ zone: Type.Union([Type.String(), Type.Null()]) }) },
614
+ url: "/deploy/managed-domain-zone"
615
+ };
616
+ const checkManagedDomain = {
617
+ type: "get",
618
+ params: environmentParams,
619
+ querystring: Type.Object({ label: Type.String({ maxLength: 80 }) }),
620
+ response: { 200: Type.Object({
621
+ available: Type.Boolean(),
622
+ hostname: Type.Union([Type.String(), Type.Null()]),
623
+ reason: Type.Union([Type.String(), Type.Null()])
624
+ }) },
625
+ url: "/deploy/:appId/:environment/managed-domain"
626
+ };
627
+ const claimManagedDomain = {
628
+ type: "post",
629
+ body: Type.Object({ label: Type.String({
630
+ maxLength: 80,
631
+ minLength: 1
632
+ }) }),
633
+ params: environmentParams,
634
+ response: { 200: environmentDomain },
635
+ url: "/deploy/:appId/:environment/managed-domain"
636
+ };
637
+ const setEnvironmentAccess = {
638
+ type: "put",
639
+ body: Type.Object({ isPrivate: Type.Boolean() }),
640
+ params: environmentParams,
641
+ response: { 200: messageResponse },
642
+ url: "/deploy/:appId/:environment/access"
643
+ };
644
+ const revokeEnvironmentLinks = {
645
+ type: "post",
646
+ params: environmentParams,
647
+ response: { 200: messageResponse },
648
+ url: "/deploy/:appId/:environment/revoke-links"
649
+ };
515
650
  const events = {
516
651
  type: "get",
517
652
  params: Type.Object({ deploymentId: Type.String({ format: "uuid" }) }),
@@ -559,6 +694,18 @@ const promote = {
559
694
  response: { 200: Type.Object({ id: Type.String({ format: "uuid" }) }) },
560
695
  url: "/deploy/:appId/promote/:stagingDeploymentId"
561
696
  };
697
+ const destroyEnvironment = {
698
+ type: "delete",
699
+ params: environmentParams,
700
+ response: { 200: messageResponse },
701
+ url: "/deploy/:appId/:environment"
702
+ };
703
+ const destroyApplication = {
704
+ type: "delete",
705
+ params: Type.Object({ appId: Type.String({ format: "uuid" }) }),
706
+ response: { 200: messageResponse },
707
+ url: "/deploy/:appId"
708
+ };
562
709
  const setAutoUpdate = {
563
710
  type: "put",
564
711
  body: Type.Object({ enabled: Type.Boolean() }),
@@ -937,16 +1084,103 @@ const update$1 = {
937
1084
  url: "/script/:id/:script/update"
938
1085
  };
939
1086
  var turnstile_exports = /* @__PURE__ */ __exportAll({ tick: () => tick });
1087
+ const shortText = Type.String({ maxLength: 256 });
1088
+ const longText = Type.String({ maxLength: 5e4 });
1089
+ const desktop = Type.Object({
1090
+ id: Type.String({ format: "uuid" }),
1091
+ os: Type.Optional(Type.Unknown()),
1092
+ version: Type.Optional(Type.String({ maxLength: 32 }))
1093
+ });
1094
+ const project = Type.Object({
1095
+ id: shortText,
1096
+ name: shortText
1097
+ });
1098
+ const reportKind = Type.Union([
1099
+ Type.Literal("bug"),
1100
+ Type.Literal("documentation"),
1101
+ Type.Literal("suggestion")
1102
+ ]);
1103
+ function tickEvent(scope, data) {
1104
+ return Type.Object({
1105
+ data: Type.Object({
1106
+ ...data,
1107
+ desktop: Type.Optional(desktop)
1108
+ }, { additionalProperties: false }),
1109
+ scope: Type.Literal(scope)
1110
+ });
1111
+ }
1112
+ /**
1113
+ * Validated by `scope` only: with the server's `removeAdditional`, a plain union strips the fields of later events while trying earlier ones
1114
+ */
1115
+ const tickEvents = Type.Union([
1116
+ tickEvent("page", {
1117
+ event: Type.Literal("view"),
1118
+ path: Type.String({ maxLength: 2048 }),
1119
+ subject: shortText
1120
+ }),
1121
+ tickEvent("referrer", {
1122
+ event: Type.Literal("arrive"),
1123
+ subject: Type.String({ maxLength: 2048 })
1124
+ }),
1125
+ tickEvent("referral", {
1126
+ event: Type.Literal("arrive"),
1127
+ subject: shortText
1128
+ }),
1129
+ tickEvent("challenge", {
1130
+ attempt: Type.Optional(Type.Integer({
1131
+ maximum: 1e4,
1132
+ minimum: 1
1133
+ })),
1134
+ event: Type.Union([
1135
+ Type.Literal("intro"),
1136
+ Type.Literal("start"),
1137
+ Type.Literal("see"),
1138
+ Type.Literal("step"),
1139
+ Type.Literal("fail"),
1140
+ Type.Literal("done")
1141
+ ]),
1142
+ step: Type.Optional(Type.Integer({
1143
+ maximum: 1e3,
1144
+ minimum: 0
1145
+ })),
1146
+ subject: Type.Optional(shortText)
1147
+ }),
1148
+ tickEvent("editor", {
1149
+ event: Type.Literal("open"),
1150
+ subject: shortText
1151
+ }),
1152
+ tickEvent("desktop", {
1153
+ event: Type.Union([
1154
+ Type.Literal("start"),
1155
+ Type.Literal("create-project"),
1156
+ Type.Literal("open-project")
1157
+ ]),
1158
+ template: Type.Optional(shortText)
1159
+ }),
1160
+ tickEvent("error", {
1161
+ event: Type.Optional(Type.Literal("error")),
1162
+ message: longText,
1163
+ project: Type.Optional(project)
1164
+ }),
1165
+ tickEvent("ai-report", {
1166
+ date: shortText,
1167
+ details: longText,
1168
+ event: Type.Optional(reportKind),
1169
+ example: longText,
1170
+ kind: Type.Optional(reportKind),
1171
+ model: shortText,
1172
+ project: Type.Optional(project),
1173
+ title: longText
1174
+ })
1175
+ ]);
940
1176
  const tick = {
941
1177
  type: "post",
942
- body: Type.Object({
943
- data: Type.Optional(Type.Intersect([Type.Object({ desktop: Type.Optional(Type.Object({
944
- id: Type.String({ minLength: 1 }),
945
- os: Type.Optional(Type.Unknown()),
946
- version: Type.Optional(Type.String())
947
- }, { additionalProperties: true })) }, { additionalProperties: true }), Type.Record(Type.String(), Type.Unknown())])),
948
- scope: Type.String()
1178
+ body: Type.Unsafe({
1179
+ type: "object",
1180
+ discriminator: { propertyName: "scope" },
1181
+ oneOf: tickEvents.anyOf
949
1182
  }),
1183
+ keepalive: true,
950
1184
  response: { 200: Type.Object({}) },
951
1185
  url: "/turnstile/tick"
952
1186
  };
@@ -1060,7 +1294,7 @@ for (const [serviceName, serviceRoutes] of Object.entries(routes)) {
1060
1294
  if (args.querystring) {
1061
1295
  for (const key of Object.keys(args.querystring)) if (args.querystring[key]) url.searchParams.append(key, args.querystring[key].toString());
1062
1296
  }
1063
- const result = await (route.multipart ? api_default.multipart : api_default[route.type])(url.href, args.body);
1297
+ const result = await (route.multipart ? api_default.multipart : api_default[route.type])(url.href, args.body, route.keepalive ? { keepalive: true } : void 0);
1064
1298
  const content = await getContent(result);
1065
1299
  if (result.status >= 400) throw new Error(`Error ${result.status} (${result.statusText}): ${content.message || content}`);
1066
1300
  return content;
@@ -1177,10 +1411,12 @@ LogicType.string(), LogicType.string({
1177
1411
  name: "Source",
1178
1412
  description: "The source"
1179
1413
  });
1414
+ // ../shared/dist/layout.mjs
1180
1415
  const baseEvent = LogicType.object({
1181
1416
  preventDefault: LogicType.function(LogicType.object({}), LogicType.void(), { description: "Prevent the default action of the event" }),
1182
1417
  target: LogicType.interface("HTMLElement")
1183
1418
  });
1419
+ LogicType.object({ ...baseEvent.properties }, { name: "Event" });
1184
1420
  LogicType.object({
1185
1421
  ...baseEvent.properties,
1186
1422
  data: LogicType.string({
package/dist/preview.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { a as getNpmCdnUrl } from "./dist-BBW6rNSm.mjs";
1
2
  import { extname, join } from "path";
2
3
  import { existsSync, readFileSync } from "fs";
3
4
  import fastifyCors from "@fastify/cors";
@@ -7,10 +8,10 @@ import Fastify from "fastify";
7
8
  function transformImports(content, externals) {
8
9
  return content.replace(/\bimport\s+(.*?)\s+from\s+['"]([^.'/][^'"]*)['"];/g, (match, imports, pkg) => {
9
10
  if (externals.includes(pkg)) return match;
10
- return `import ${imports} from 'https://esm.sh/${pkg}';`;
11
+ return `import ${imports} from '${getNpmCdnUrl(pkg)}';`;
11
12
  }).replace(/\bimport\s+['"]([^.'/][^'"]*)['"];/g, (match, pkg) => {
12
13
  if (externals.includes(pkg)) return match;
13
- return `import 'https://esm.sh/${pkg}';`;
14
+ return `import '${getNpmCdnUrl(pkg)}';`;
14
15
  });
15
16
  }
16
17
  // src/preview/server.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luna-park/plugin",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "private": false,
5
5
  "description": "Plugin helper for Luna Park.",
6
6
  "homepage": "https://luna-park.app",