@melt-js/libs-core 2026.11.14 → 2026.11.15
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.
- package/README.md +19 -2
- package/demo/index.js +1 -0
- package/dist/browser.mjs +50 -0
- package/dist/hel-deployment.json +8 -0
- package/package.json +16 -4
- package/scripts/build-browser.mjs +13 -0
- package/scripts/component-events.mjs +57 -0
- package/scripts/hel-build-paths.cjs +48 -0
- package/scripts/package-env.cjs +15 -2
- package/src/browser.d.mts +2 -0
- package/src/browser.mjs +3 -0
- package/src/demo/docs.d.mts +25 -0
- package/src/demo/docs.mjs +75 -0
- package/src/demo/download.d.mts +33 -0
- package/src/demo/download.mjs +118 -0
- package/src/demo/fullscreen.d.mts +8 -0
- package/src/demo/fullscreen.mjs +80 -0
- package/src/demo/index.d.mts +4 -0
- package/src/demo/index.mjs +4 -0
- package/src/demo/model.d.mts +12 -0
- package/src/demo/model.mjs +203 -0
- package/src/demo/runtime.mjs +104 -0
- package/src/remote.d.mts +1 -0
- package/src/remote.mjs +37 -0
package/src/remote.mjs
CHANGED
|
@@ -104,9 +104,46 @@ export function assertHelExports(moduleName, host, lib, requiredExports = []) {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
/** Relative builds must resolve against the remote package, including file:// hosts. */
|
|
108
|
+
function resolveMetaAssets(meta, host) {
|
|
109
|
+
const srcMap = meta && meta.version && meta.version.src_map
|
|
110
|
+
if (!srcMap || !isHelMetaHost(host)) return
|
|
111
|
+
const base = new URL('.', host).href
|
|
112
|
+
const webDir = String(srcMap.webDirPath || '').replace(/\/+$/, '')
|
|
113
|
+
const absolute = value => {
|
|
114
|
+
if (typeof value !== 'string' || !value || /^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(value)) return value
|
|
115
|
+
const resolved = webDir && value.startsWith(webDir + '/')
|
|
116
|
+
? new URL(value.slice(webDir.length + 1), base).href
|
|
117
|
+
: new URL(!webDir ? value.replace(/^\/+/, '') : value, base).href
|
|
118
|
+
// Webpack chunks retain their original publicPath inside the runtime. Use
|
|
119
|
+
// HEL's existing append hook for those dynamic requests as well as metadata.
|
|
120
|
+
if (typeof document !== 'undefined' && document.baseURI) {
|
|
121
|
+
const core = helMicro.core
|
|
122
|
+
const browserUrl = new URL(value, document.baseURI).href
|
|
123
|
+
core.setCommonData(core.helConsts.KEY_ASSET_CTX, browserUrl, {
|
|
124
|
+
marked: true,
|
|
125
|
+
beforeAppend: ({ setAssetUrl }) => { setAssetUrl(resolved) },
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
return resolved
|
|
129
|
+
}
|
|
130
|
+
for (const [key, value] of Object.entries(srcMap)) {
|
|
131
|
+
if (key === 'headAssetList' || key === 'bodyAssetList') {
|
|
132
|
+
for (const asset of value || []) {
|
|
133
|
+
for (const attr of ['src', 'href']) {
|
|
134
|
+
if (asset.attrs && asset.attrs[attr]) asset.attrs[attr] = absolute(asset.attrs[attr])
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
} else if (key.endsWith('List') && Array.isArray(value)) srcMap[key] = value.map(absolute)
|
|
138
|
+
else if (key !== 'webDirPath' && /(?:Path|Src|Index)$/.test(key)) srcMap[key] = absolute(value)
|
|
139
|
+
}
|
|
140
|
+
if (!/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(webDir)) srcMap.webDirPath = base.replace(/\/$/, '')
|
|
141
|
+
}
|
|
142
|
+
|
|
107
143
|
function fetchOptions(spec) {
|
|
108
144
|
return {
|
|
109
145
|
...(spec.platform ? { platform: spec.platform } : {}),
|
|
146
|
+
hook: { onFetchMetaSuccess: meta => resolveMetaAssets(meta, spec.host) },
|
|
110
147
|
custom: {
|
|
111
148
|
skipFetchHelMeta: !isHelMetaHost(spec.host), enable: true, trust: true,
|
|
112
149
|
...(spec.custom || {}),
|