@toddledev/ssr
Advanced tools
Comparing version 0.0.3-alpha.19 to 0.0.3-alpha.20
@@ -1,2 +0,2 @@ | ||
import { FontFamily } from '@toddledev/core/dist/styling/theme'; | ||
import type { FontFamily } from '@toddledev/core/dist/styling/theme'; | ||
export declare const getFontCssUrl: ({ fonts, baseForAbsoluteUrls, basePath, }: { | ||
@@ -3,0 +3,0 @@ fonts: FontFamily[]; |
@@ -0,1 +1,49 @@ | ||
import type { Component } from '@toddledev/core/dist/component/component.types'; | ||
export declare const isCloudflareImagePath: (path?: string | null) => path is string; | ||
/** | ||
* Make all relative 'src' paths in a component absolute | ||
*/ | ||
export declare const transformRelativePaths: (urlOrigin: string) => (component: Component) => { | ||
nodes: {}; | ||
name: string; | ||
version?: 2; | ||
page?: string; | ||
route?: import("@toddledev/core/dist/component/component.types").PageRoute | null; | ||
attributes: Record<string, { | ||
name: string; | ||
testValue: unknown; | ||
}>; | ||
variables: Record<string, { | ||
initialValue: import("@toddledev/core/dist/formula/formula").Formula; | ||
}>; | ||
formulas?: Record<string, { | ||
name: string; | ||
arguments: Array<{ | ||
name: string; | ||
testValue: any; | ||
}>; | ||
memoize?: boolean; | ||
exposeInContext?: boolean; | ||
formula: import("@toddledev/core/dist/formula/formula").Formula; | ||
}>; | ||
contexts?: Record<string, { | ||
formulas: string[]; | ||
workflows: string[]; | ||
componentName?: string; | ||
package?: string; | ||
}>; | ||
workflows?: Record<string, { | ||
name: string; | ||
parameters: Array<{ | ||
name: string; | ||
testValue: any; | ||
}>; | ||
actions: import("@toddledev/core/dist/component/component.types").ActionModel[]; | ||
exposeInContext?: boolean; | ||
}>; | ||
apis: Record<string, import("@toddledev/core/dist/api/apiTypes").ComponentAPI>; | ||
events?: import("@toddledev/core/dist/component/component.types").ComponentEvent[]; | ||
onLoad?: import("@toddledev/core/dist/component/component.types").EventModel; | ||
onAttributeChange?: import("@toddledev/core/dist/component/component.types").EventModel; | ||
exported?: boolean; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isCloudflareImagePath = void 0; | ||
exports.transformRelativePaths = exports.isCloudflareImagePath = void 0; | ||
const isCloudflareImagePath = (path) => typeof path === 'string' && path.startsWith('/cdn-cgi/imagedelivery/'); | ||
exports.isCloudflareImagePath = isCloudflareImagePath; | ||
/** | ||
* Make all relative 'src' paths in a component absolute | ||
*/ | ||
const transformRelativePaths = (urlOrigin) => (component) => ({ | ||
...component, | ||
nodes: Object.entries(component.nodes).reduce((acc, [key, node]) => { | ||
return { | ||
...acc, | ||
[key]: { | ||
...node, | ||
...(node.type === 'element' | ||
? { | ||
attrs: Object.entries(node.attrs).reduce((acc, [key, formula]) => { | ||
if (['src'].includes(key) && | ||
formula?.type === 'value' && | ||
typeof formula.value === 'string') { | ||
return { | ||
...acc, | ||
[key]: { | ||
...formula, | ||
value: new URL(formula.value, urlOrigin).href, | ||
}, | ||
}; | ||
} | ||
return { ...acc, [key]: formula }; | ||
}, {}), | ||
} | ||
: {}), | ||
}, | ||
}; | ||
}, {}), | ||
}); | ||
exports.transformRelativePaths = transformRelativePaths; | ||
//# sourceMappingURL=media.js.map |
@@ -15,7 +15,7 @@ { | ||
"dependencies": { | ||
"@toddledev/core": "0.0.3-alpha.19", | ||
"@toddledev/core": "0.0.3-alpha.20", | ||
"cookie": "1.0.2", | ||
"xss": "1.0.15" | ||
}, | ||
"version": "0.0.3-alpha.19" | ||
"version": "0.0.3-alpha.20" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { FontFamily } from '@toddledev/core/dist/styling/theme' | ||
import type { FontFamily } from '@toddledev/core/dist/styling/theme' | ||
import { easySort } from '@toddledev/core/dist/utils/collections' | ||
@@ -3,0 +3,0 @@ |
@@ -0,2 +1,46 @@ | ||
import type { | ||
Component, | ||
NodeModel, | ||
} from '@toddledev/core/dist/component/component.types' | ||
export const isCloudflareImagePath = (path?: string | null): path is string => | ||
typeof path === 'string' && path.startsWith('/cdn-cgi/imagedelivery/') | ||
/** | ||
* Make all relative 'src' paths in a component absolute | ||
*/ | ||
export const transformRelativePaths = | ||
(urlOrigin: string) => (component: Component) => ({ | ||
...component, | ||
nodes: Object.entries(component.nodes).reduce((acc, [key, node]) => { | ||
return { | ||
...acc, | ||
[key]: { | ||
...node, | ||
...(node.type === 'element' | ||
? { | ||
attrs: Object.entries(node.attrs).reduce( | ||
(acc, [key, formula]) => { | ||
if ( | ||
['src'].includes(key) && | ||
formula?.type === 'value' && | ||
typeof formula.value === 'string' | ||
) { | ||
return { | ||
...acc, | ||
[key]: { | ||
...formula, | ||
value: new URL(formula.value, urlOrigin).href, | ||
}, | ||
} | ||
} | ||
return { ...acc, [key]: formula } | ||
}, | ||
{}, | ||
), | ||
} | ||
: {}), | ||
} as NodeModel, | ||
} | ||
}, {}), | ||
}) |
Sorry, the diff of this file is not supported yet
207511
95
4392
+ Added@toddledev/core@0.0.3-alpha.20(transitive)
- Removed@toddledev/core@0.0.3-alpha.19(transitive)