1.4.3: 修复LEGACY_MODE模式下的语法兼容问题

master 1.4.3
yutent 2024-09-13 18:36:44 +08:00
parent fa84cc0c5d
commit dd8ff91294
2 changed files with 5 additions and 2 deletions

View File

@ -241,6 +241,8 @@ export function parseJs(
` stylesheet.textContent = ${tmp};\n` + ` stylesheet.textContent = ${tmp};\n` +
` document.head.appendChild(stylesheet);\n` + ` document.head.appendChild(stylesheet);\n` +
`}\n` `}\n`
return `let ${tmp};\n!(async function(){\n ${tmp} = await __fite_import('${name}', import.meta.url);\n})()`
} else { } else {
// CSSStyleSheet.replaceSync 需要FF v101, Safari 16.4才支持 // CSSStyleSheet.replaceSync 需要FF v101, Safari 16.4才支持
fixedStyle += fixedStyle +=
@ -251,8 +253,9 @@ export function parseJs(
` __sheets__.push(stylesheet);\n` + ` __sheets__.push(stylesheet);\n` +
` document.adoptedStyleSheets = __sheets__;\n` + ` document.adoptedStyleSheets = __sheets__;\n` +
`}\n` `}\n`
}
return `const ${tmp} = await __fite_import('${name}', import.meta.url)` return `const ${tmp} = await __fite_import('${name}', import.meta.url)`
}
} else { } else {
if (name.startsWith('@/')) { if (name.startsWith('@/')) {
name = name.replace('@/', urlJoin(DEPLOY_PATH, ASSETS_DIR)) name = name.replace('@/', urlJoin(DEPLOY_PATH, ASSETS_DIR))

View File

@ -1,7 +1,7 @@
{ {
"name": "fite", "name": "fite",
"type": "module", "type": "module",
"version": "1.4.2", "version": "1.4.3",
"bin": { "bin": {
"fite": "index.js" "fite": "index.js"
}, },