提交 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' ...@@ -3,7 +3,7 @@ import { parse as parseUrl } from 'url'
import fs, { promises as fsp } from 'fs' import fs, { promises as fsp } from 'fs'
import { Plugin } from '../plugin' import { Plugin } from '../plugin'
import { ResolvedConfig } from '../config' import { ResolvedConfig } from '../config'
import { cleanUrl } from '../utils' import { cleanUrl, normalizePath } from '../utils'
import { PluginContext, RenderedChunk } from 'rollup' import { PluginContext, RenderedChunk } from 'rollup'
import MagicString from 'magic-string' import MagicString from 'magic-string'
import { createHash } from 'crypto' import { createHash } from 'crypto'
...@@ -176,10 +176,26 @@ function fileToBuiltUrl( ...@@ -176,10 +176,26 @@ function fileToBuiltUrl(
const contentHash = getAssetHash(content) const contentHash = getAssetHash(content)
const { search, hash } = parseUrl(id) const { search, hash } = parseUrl(id)
const postfix = (search || '') + (hash || '') 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)) { if (!map.has(contentHash)) {
map.set(contentHash, fileName) 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}__` : ``}` url = `__VITE_ASSET__${contentHash}__${postfix ? `$_${postfix}__` : ``}`
cache.set(id, url) cache.set(id, url)
return url return url
......
...@@ -2232,9 +2232,7 @@ var index$z = /* @__PURE__ */ defineBuiltInComponent({ ...@@ -2232,9 +2232,7 @@ var index$z = /* @__PURE__ */ defineBuiltInComponent({
uniLabel.addHandler(_onClick); uniLabel.addHandler(_onClick);
} }
return () => { return () => {
const { const booleanAttrs = useBooleanAttr(props2, "disabled");
booleanAttrs
} = useBooleanAttr(props2, "disabled");
return vue.createVNode("uni-checkbox", vue.mergeProps(booleanAttrs, { return vue.createVNode("uni-checkbox", vue.mergeProps(booleanAttrs, {
"onClick": _onClick "onClick": _onClick
}), [vue.createVNode("div", { }), [vue.createVNode("div", {
...@@ -4796,9 +4794,7 @@ var index$q = /* @__PURE__ */ defineBuiltInComponent({ ...@@ -4796,9 +4794,7 @@ var index$q = /* @__PURE__ */ defineBuiltInComponent({
uniLabel.addHandler(_onClick); uniLabel.addHandler(_onClick);
} }
return () => { return () => {
const { const booleanAttrs = useBooleanAttr(props2, "disabled");
booleanAttrs
} = useBooleanAttr(props2, "disabled");
return vue.createVNode("uni-radio", vue.mergeProps(booleanAttrs, { return vue.createVNode("uni-radio", vue.mergeProps(booleanAttrs, {
"onClick": _onClick "onClick": _onClick
}), [vue.createVNode("div", { }), [vue.createVNode("div", {
...@@ -6189,9 +6185,7 @@ var index$k = /* @__PURE__ */ defineBuiltInComponent({ ...@@ -6189,9 +6185,7 @@ var index$k = /* @__PURE__ */ defineBuiltInComponent({
color, color,
type type
} = props2; } = props2;
const { const booleanAttrs = useBooleanAttr(props2, "disabled");
booleanAttrs
} = useBooleanAttr(props2, "disabled");
return vue.createVNode("uni-switch", vue.mergeProps({ return vue.createVNode("uni-switch", vue.mergeProps({
"ref": rootRef "ref": rootRef
}, booleanAttrs, { }, booleanAttrs, {
......
...@@ -6786,9 +6786,7 @@ var index$u = /* @__PURE__ */ defineBuiltInComponent({ ...@@ -6786,9 +6786,7 @@ var index$u = /* @__PURE__ */ defineBuiltInComponent({
"label-click": _onClick "label-click": _onClick
}); });
return () => { return () => {
const { const booleanAttrs = useBooleanAttr(props2, "disabled");
booleanAttrs
} = useBooleanAttr(props2, "disabled");
return createVNode("uni-checkbox", mergeProps(booleanAttrs, { return createVNode("uni-checkbox", mergeProps(booleanAttrs, {
"onClick": _onClick "onClick": _onClick
}), [createVNode("div", { }), [createVNode("div", {
...@@ -11129,9 +11127,7 @@ var index$n = /* @__PURE__ */ defineBuiltInComponent({ ...@@ -11129,9 +11127,7 @@ var index$n = /* @__PURE__ */ defineBuiltInComponent({
"label-click": _onClick "label-click": _onClick
}); });
return () => { return () => {
const { const booleanAttrs = useBooleanAttr(props2, "disabled");
booleanAttrs
} = useBooleanAttr(props2, "disabled");
return createVNode("uni-radio", mergeProps(booleanAttrs, { return createVNode("uni-radio", mergeProps(booleanAttrs, {
"onClick": _onClick "onClick": _onClick
}), [createVNode("div", { }), [createVNode("div", {
...@@ -12828,9 +12824,7 @@ var index$k = /* @__PURE__ */ defineBuiltInComponent({ ...@@ -12828,9 +12824,7 @@ var index$k = /* @__PURE__ */ defineBuiltInComponent({
color, color,
type type
} = props2; } = props2;
const { const booleanAttrs = useBooleanAttr(props2, "disabled");
booleanAttrs
} = useBooleanAttr(props2, "disabled");
return createVNode("uni-switch", mergeProps({ return createVNode("uni-switch", mergeProps({
"ref": rootRef "ref": rootRef
}, booleanAttrs, { }, booleanAttrs, {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册