diff --git a/examples/custom-macro-nodes/src/Duplicate/Duplicate.flyde.ts b/examples/custom-macro-nodes/src/Duplicate/Duplicate.flyde.ts index d86f07551..b60477543 100644 --- a/examples/custom-macro-nodes/src/Duplicate/Duplicate.flyde.ts +++ b/examples/custom-macro-nodes/src/Duplicate/Duplicate.flyde.ts @@ -37,7 +37,7 @@ const node: MacroNode = { }, editorConfig: { type: "custom", - editorComponentBundlePath: "../../../dist/Duplicate.js", + editorComponentBundlePath: "../../dist/Duplicate.js", }, defaultData: 2, }; diff --git a/examples/custom-macro-nodes/src/InlineValue/InlineValue.flyde.ts b/examples/custom-macro-nodes/src/InlineValue/InlineValue.flyde.ts index 4cf6a8b8f..8be40b512 100644 --- a/examples/custom-macro-nodes/src/InlineValue/InlineValue.flyde.ts +++ b/examples/custom-macro-nodes/src/InlineValue/InlineValue.flyde.ts @@ -21,7 +21,7 @@ const node: MacroNode = { }, editorConfig: { type: "custom", - editorComponentBundlePath: "../../../dist/InlineValue.js", + editorComponentBundlePath: "../../dist/InlineValue.js", }, defaultData: "", }; diff --git a/examples/dad-jokes-cli/src/macro-node-simple/Duplicate.flyde.ts b/examples/dad-jokes-cli/src/macro-node-simple/Duplicate.flyde.ts index 39b492e6f..a5825a7d1 100644 --- a/examples/dad-jokes-cli/src/macro-node-simple/Duplicate.flyde.ts +++ b/examples/dad-jokes-cli/src/macro-node-simple/Duplicate.flyde.ts @@ -37,7 +37,7 @@ const node: MacroNode = { displayNameBuilder: (times) => `Duplicate x ${times}`, editorConfig: { type: "custom", - editorComponentBundlePath: "../../../dist/Duplicate.js", + editorComponentBundlePath: "../../dist/Duplicate.js", }, defaultData: 2, }; diff --git a/examples/dad-jokes-cli/src/macro-node-simple/InlineValue.flyde.ts b/examples/dad-jokes-cli/src/macro-node-simple/InlineValue.flyde.ts index 8fcb09cf0..e8a982db2 100644 --- a/examples/dad-jokes-cli/src/macro-node-simple/InlineValue.flyde.ts +++ b/examples/dad-jokes-cli/src/macro-node-simple/InlineValue.flyde.ts @@ -21,7 +21,7 @@ const node: MacroNode = { displayNameBuilder: () => `Emit Value`, editorConfig: { type: "custom", - editorComponentBundlePath: "../../../dist/InlineValue.js", + editorComponentBundlePath: "../../dist/InlineValue.js", }, defaultData: "", }; diff --git a/resolver/src/resolver/resolve-dependencies/macro-node-to-definition.ts b/resolver/src/resolver/resolve-dependencies/macro-node-to-definition.ts index 56c2e82c0..1248403c7 100644 --- a/resolver/src/resolver/resolve-dependencies/macro-node-to-definition.ts +++ b/resolver/src/resolver/resolve-dependencies/macro-node-to-definition.ts @@ -3,7 +3,7 @@ import { MacroNode, MacroNodeDefinition, } from "@flyde/core"; -import { readFileSync } from "fs"; +import { readFileSync, existsSync } from "fs"; import { join } from "path"; export function macroNodeToDefinition( @@ -21,10 +21,18 @@ export function macroNodeToDefinition( editorComponentBundleContent: "", } as MacroEditorConfigCustomDefinition, }; - const editorComponentPath = join( + let editorComponentPath = join( importPath, - macro.editorConfig.editorComponentBundlePath + "..", + macro.editorConfig.editorComponentBundlePath, ); + // fallback for backwards compatibility (see issue #120) + if (!existsSync(editorComponentPath)) { + editorComponentPath = join( + importPath, + macro.editorConfig.editorComponentBundlePath, + ) + } try { const content = readFileSync(editorComponentPath, "utf8"); diff --git a/stdlib/src/ControlFlow/Conditional.flyde.ts b/stdlib/src/ControlFlow/Conditional.flyde.ts index 71199c98b..30ba872b6 100644 --- a/stdlib/src/ControlFlow/Conditional.flyde.ts +++ b/stdlib/src/ControlFlow/Conditional.flyde.ts @@ -29,14 +29,14 @@ export interface ConditionalConfig { propertyPath: string; condition: { type: ConditionType; data?: string }; compareTo: - | { mode: "static"; value: any; type: "number" | "string" | "json" } - | { mode: "dynamic"; propertyPath: string }; + | { mode: "static"; value: any; type: "number" | "string" | "json" } + | { mode: "dynamic"; propertyPath: string }; trueValue: - | { type: "value" | "compareTo" } - | { type: "expression"; data: string }; + | { type: "value" | "compareTo" } + | { type: "expression"; data: string }; falseValue: - | { type: "value" | "compareTo" } - | { type: "expression"; data: string }; + | { type: "value" | "compareTo" } + | { type: "expression"; data: string }; } function conditionalConfigToDisplayName(config: ConditionalConfig) { @@ -185,7 +185,7 @@ export const Conditional: MacroNode = { }, editorConfig: { type: "custom", - editorComponentBundlePath: "../../../dist/ui/Conditional.js", + editorComponentBundlePath: "../../dist/ui/Conditional.js", }, }; diff --git a/stdlib/src/ControlFlow/Switch.flyde.ts b/stdlib/src/ControlFlow/Switch.flyde.ts index 06e615838..4f29b1f88 100644 --- a/stdlib/src/ControlFlow/Switch.flyde.ts +++ b/stdlib/src/ControlFlow/Switch.flyde.ts @@ -8,13 +8,13 @@ export interface SwitchConfig { outputExpression: string; }[]; defaultCase: - | { - enabled: true; - outputExpression: string; - } - | { - enabled: false; - }; + | { + enabled: true; + outputExpression: string; + } + | { + enabled: false; + }; } export const Switch: MacroNode = { @@ -108,6 +108,6 @@ export const Switch: MacroNode = { }, editorConfig: { type: "custom", - editorComponentBundlePath: "../../../dist/ui/Switch.js", + editorComponentBundlePath: "../../dist/ui/Switch.js", }, }; diff --git a/stdlib/src/Lists/Collect/Collect.flyde.ts b/stdlib/src/Lists/Collect/Collect.flyde.ts index 63d933fde..bc31a55da 100644 --- a/stdlib/src/Lists/Collect/Collect.flyde.ts +++ b/stdlib/src/Lists/Collect/Collect.flyde.ts @@ -138,6 +138,6 @@ export const Collect: MacroNode = { }, editorConfig: { type: "custom", - editorComponentBundlePath: "../../../../dist/ui/Collect.js", + editorComponentBundlePath: "../../../dist/ui/Collect.js", }, }; diff --git a/stdlib/src/Values/CodeExpression.flyde.ts b/stdlib/src/Values/CodeExpression.flyde.ts index 3de534cdc..5ad620c9b 100644 --- a/stdlib/src/Values/CodeExpression.flyde.ts +++ b/stdlib/src/Values/CodeExpression.flyde.ts @@ -47,6 +47,6 @@ export const CodeExpression: MacroNode = { }, editorConfig: { type: "custom", - editorComponentBundlePath: "../../../dist/ui/CodeExpression.js", + editorComponentBundlePath: "../../dist/ui/CodeExpression.js", }, }; diff --git a/stdlib/src/Values/InlineValue.flyde.ts b/stdlib/src/Values/InlineValue.flyde.ts index eb9ea3618..101eeb391 100644 --- a/stdlib/src/Values/InlineValue.flyde.ts +++ b/stdlib/src/Values/InlineValue.flyde.ts @@ -42,6 +42,6 @@ export const InlineValue: MacroNode = { }, editorConfig: { type: "custom", - editorComponentBundlePath: "../../../dist/ui/InlineValue.js", + editorComponentBundlePath: "../../dist/ui/InlineValue.js", }, };