Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
yutent | 96b9554574 | |
yutent | dd8ff91294 | |
yutent | fa84cc0c5d | |
yutent | 2b9599781e |
|
@ -64,7 +64,7 @@ function scopeCss(css = '', hash) {
|
||||||
if (last.startsWith(':')) {
|
if (last.startsWith(':')) {
|
||||||
output = parseVDeep(last, output, true)
|
output = parseVDeep(last, output, true)
|
||||||
} else {
|
} else {
|
||||||
output = `${last} ${output}`
|
output = `${last}[data-${hash}] ${output}`
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (last.includes(':')) {
|
if (last.includes(':')) {
|
||||||
|
@ -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))
|
||||||
|
|
14
lib/dev.js
14
lib/dev.js
|
@ -179,7 +179,10 @@ export default async function createServer(root = '', conf = {}) {
|
||||||
currentPage,
|
currentPage,
|
||||||
IS_ENTRY: true,
|
IS_ENTRY: true,
|
||||||
DEPLOY_PATH,
|
DEPLOY_PATH,
|
||||||
LEGACY_MODE
|
LEGACY_MODE,
|
||||||
|
isCustomElement,
|
||||||
|
plugin,
|
||||||
|
define
|
||||||
},
|
},
|
||||||
page.entry
|
page.entry
|
||||||
)
|
)
|
||||||
|
@ -270,10 +273,12 @@ export default async function createServer(root = '', conf = {}) {
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'js':
|
case 'js':
|
||||||
|
case 'wasm':
|
||||||
{
|
{
|
||||||
let rpath = pathname.replace('@/', '')
|
let rpath = pathname.replace('@/', '')
|
||||||
let file
|
let file
|
||||||
let isJson = false
|
let isJson = false
|
||||||
|
let isWasm = rpath.endsWith('.wasm')
|
||||||
|
|
||||||
if (rpath.endsWith('json.js')) {
|
if (rpath.endsWith('json.js')) {
|
||||||
isJson = true
|
isJson = true
|
||||||
|
@ -309,6 +314,8 @@ export default async function createServer(root = '', conf = {}) {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('%s 语法错误: %s', rpath, red(err.message))
|
console.log('%s 语法错误: %s', rpath, red(err.message))
|
||||||
}
|
}
|
||||||
|
} else if (isWasm) {
|
||||||
|
//
|
||||||
} else {
|
} else {
|
||||||
code = parseJs(
|
code = parseJs(
|
||||||
code + '',
|
code + '',
|
||||||
|
@ -317,7 +324,10 @@ export default async function createServer(root = '', conf = {}) {
|
||||||
IS_MPA,
|
IS_MPA,
|
||||||
currentPage,
|
currentPage,
|
||||||
DEPLOY_PATH,
|
DEPLOY_PATH,
|
||||||
LEGACY_MODE
|
LEGACY_MODE,
|
||||||
|
isCustomElement,
|
||||||
|
plugin,
|
||||||
|
define
|
||||||
},
|
},
|
||||||
file
|
file
|
||||||
)
|
)
|
||||||
|
|
|
@ -52,7 +52,12 @@ export default function compile(root = '', dist = '', conf = {}, verbose) {
|
||||||
)
|
)
|
||||||
const INJECT_SCSS = readFile(conf.inject?.scss)
|
const INJECT_SCSS = readFile(conf.inject?.scss)
|
||||||
const LEGACY_MODE = !!conf.legacy
|
const LEGACY_MODE = !!conf.legacy
|
||||||
const { ABS_CONFIG_FILEPATH, compileOptions = {}, define = {} } = conf
|
const {
|
||||||
|
ABS_CONFIG_FILEPATH,
|
||||||
|
compileOptions = {},
|
||||||
|
define = {},
|
||||||
|
plugin = []
|
||||||
|
} = conf
|
||||||
const { isCustomElement = defaultCustomElement } = compileOptions
|
const { isCustomElement = defaultCustomElement } = compileOptions
|
||||||
|
|
||||||
conf.inject = conf.inject || { scss: '' }
|
conf.inject = conf.inject || { scss: '' }
|
||||||
|
@ -203,6 +208,8 @@ export default function compile(root = '', dist = '', conf = {}, verbose) {
|
||||||
doJob()
|
doJob()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
options.plugin = plugin
|
||||||
|
options.isCustomElement = isCustomElement
|
||||||
compileFiles(currentPage, page, list, options, {
|
compileFiles(currentPage, page, list, options, {
|
||||||
verbose,
|
verbose,
|
||||||
dist,
|
dist,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "fite",
|
"name": "fite",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.4.0",
|
"version": "1.4.4",
|
||||||
"bin": {
|
"bin": {
|
||||||
"fite": "index.js"
|
"fite": "index.js"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue