Skip to content

Commit

Permalink
normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Dec 26, 2024
1 parent c603642 commit ef51b5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions tests/__snapshots__/rollup.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
createElementVNode("h1", null, "Hello World", -1 /* HOISTED */)
])))
}
var basic = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render],['__file',"[CWD]/tests/fixtures/basic.vue"]]);
var basic = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render],['__file',"#FILE#"]]);
export { basic as default };
"
Expand Down Expand Up @@ -111,7 +111,7 @@ return __returned__
}
};
var reactivityTransform = /*#__PURE__*/_export_sfc(_sfc_main, [['__file',"[CWD]/tests/fixtures/reactivity-transform.vue"]]);
var reactivityTransform = /*#__PURE__*/_export_sfc(_sfc_main, [['__file',"#FILE#"]]);
export { reactivityTransform as default };
"
Expand Down Expand Up @@ -174,7 +174,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
createElementVNode("h1", null, "Hello World", -1 /* HOISTED */)
])))
}
var scriptSetup = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render],['__file',"[CWD]/tests/fixtures/script-setup.vue"]]);
var scriptSetup = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render],['__file',"#FILE#"]]);
export { scriptSetup as default };
"
Expand Down Expand Up @@ -245,7 +245,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
)
]));
}
var scriptSetupTs = /* @__PURE__ */ _export_sfc(script_setup_ts_vue_vue_type_script_setup_true_lang_default, [["render", _sfc_render], ["__file", "[CWD]/tests/fixtures/script-setup-ts.vue"]]);
var scriptSetupTs = /* @__PURE__ */ _export_sfc(script_setup_ts_vue_vue_type_script_setup_true_lang_default, [["render", _sfc_render], ["__file", "#FILE#"]]);
export { scriptSetupTs as default };
"
Expand Down Expand Up @@ -322,7 +322,7 @@ var _export_sfc = (sfc, props) => {
return target;
};
var sfcSrc = /*#__PURE__*/_export_sfc(src_script_ts_vue_type_script_src_true_lang_default, [['render',render],['__file',"[CWD]/tests/fixtures/sfc-src.vue"]]);
var sfcSrc = /*#__PURE__*/_export_sfc(src_script_ts_vue_type_script_src_true_lang_default, [['render',render],['__file',"#FILE#"]]);
export { sfcSrc as default };
"
Expand Down Expand Up @@ -416,7 +416,7 @@ var _export_sfc = (sfc, props) => {
return target;
};
var typescript = /* @__PURE__ */ _export_sfc(typescript_vue_vue_type_script_lang_default, [["__file", "[CWD]/tests/fixtures/typescript.vue"]]);
var typescript = /* @__PURE__ */ _export_sfc(typescript_vue_vue_type_script_lang_default, [["__file", "#FILE#"]]);
export { typescript as default };
"
Expand Down
5 changes: 4 additions & 1 deletion tests/rollup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ describe('rollup', async () => {
const unpluginCode = await getCode(id, unplugin)

expect(viteCode).toBe(unpluginCode)
return unpluginCode
return unpluginCode.replaceAll(
/(["']__file["']\s*,\s*['"]).*?(['"])/g,
(_, s1, s2) => `${s1}#FILE#${s2}`,
)
},
{
params: [['isProduction', [true, false]]],
Expand Down

0 comments on commit ef51b5f

Please sign in to comment.