提交 424433f5 编写于 作者: fxy060608's avatar fxy060608

feat(app): copy non-static assets

上级 617abeed
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -3,7 +3,7 @@ import { parse as parseUrl } from 'url'
import fs, { promises as fsp } from 'fs'
import { Plugin } from '../plugin'
import { ResolvedConfig } from '../config'
import { cleanUrl } from '../utils'
import { cleanUrl, normalizePath } from '../utils'
import { PluginContext, RenderedChunk } from 'rollup'
import MagicString from 'magic-string'
import { createHash } from 'crypto'
......@@ -176,10 +176,26 @@ function fileToBuiltUrl(
const contentHash = getAssetHash(content)
const { search, hash } = parseUrl(id)
const postfix = (search || '') + (hash || '')
const fileName = path.posix.relative(process.env.UNI_INPUT_DIR, id)
const fileName = normalizePath(
path.posix.relative(process.env.UNI_INPUT_DIR, file)
)
if (!map.has(contentHash)) {
map.set(contentHash, fileName)
}
if (!fileName.includes('/static/')) {
const emittedSet = emittedHashMap.get(config)!
if (!emittedSet.has(contentHash)) {
pluginContext.emitFile({
name: fileName,
fileName,
type: 'asset',
source: content,
})
emittedSet.add(contentHash)
}
}
url = `__VITE_ASSET__${contentHash}__${postfix ? `$_${postfix}__` : ``}`
cache.set(id, url)
return url
......
......@@ -2232,9 +2232,7 @@ var index$z = /* @__PURE__ */ defineBuiltInComponent({
uniLabel.addHandler(_onClick);
}
return () => {
const {
booleanAttrs
} = useBooleanAttr(props2, "disabled");
const booleanAttrs = useBooleanAttr(props2, "disabled");
return vue.createVNode("uni-checkbox", vue.mergeProps(booleanAttrs, {
"onClick": _onClick
}), [vue.createVNode("div", {
......@@ -4796,9 +4794,7 @@ var index$q = /* @__PURE__ */ defineBuiltInComponent({
uniLabel.addHandler(_onClick);
}
return () => {
const {
booleanAttrs
} = useBooleanAttr(props2, "disabled");
const booleanAttrs = useBooleanAttr(props2, "disabled");
return vue.createVNode("uni-radio", vue.mergeProps(booleanAttrs, {
"onClick": _onClick
}), [vue.createVNode("div", {
......@@ -6189,9 +6185,7 @@ var index$k = /* @__PURE__ */ defineBuiltInComponent({
color,
type
} = props2;
const {
booleanAttrs
} = useBooleanAttr(props2, "disabled");
const booleanAttrs = useBooleanAttr(props2, "disabled");
return vue.createVNode("uni-switch", vue.mergeProps({
"ref": rootRef
}, booleanAttrs, {
......
......@@ -6786,9 +6786,7 @@ var index$u = /* @__PURE__ */ defineBuiltInComponent({
"label-click": _onClick
});
return () => {
const {
booleanAttrs
} = useBooleanAttr(props2, "disabled");
const booleanAttrs = useBooleanAttr(props2, "disabled");
return createVNode("uni-checkbox", mergeProps(booleanAttrs, {
"onClick": _onClick
}), [createVNode("div", {
......@@ -11129,9 +11127,7 @@ var index$n = /* @__PURE__ */ defineBuiltInComponent({
"label-click": _onClick
});
return () => {
const {
booleanAttrs
} = useBooleanAttr(props2, "disabled");
const booleanAttrs = useBooleanAttr(props2, "disabled");
return createVNode("uni-radio", mergeProps(booleanAttrs, {
"onClick": _onClick
}), [createVNode("div", {
......@@ -12828,9 +12824,7 @@ var index$k = /* @__PURE__ */ defineBuiltInComponent({
color,
type
} = props2;
const {
booleanAttrs
} = useBooleanAttr(props2, "disabled");
const booleanAttrs = useBooleanAttr(props2, "disabled");
return createVNode("uni-switch", mergeProps({
"ref": rootRef
}, booleanAttrs, {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册