Skip to content

Commit

Permalink
fix: lock file maintenance (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored Jun 12, 2024
1 parent 1335769 commit 794aff0
Show file tree
Hide file tree
Showing 5 changed files with 588 additions and 571 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Copyright &copy; Sebastian Landwehr <info@sebastianlandwehr.com>

and licensed under:

[MIT License](https://opensource.org/licenses/MIT)
[MIT License](https://opensource.org/license/mit/)

## MIT License

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,5 @@ Thanks a lot for your support! ❤️

## License

[MIT License](https://opensource.org/licenses/MIT) © [Sebastian Landwehr](https://sebastianlandwehr.com)
[MIT License](https://opensource.org/license/mit/) © [Sebastian Landwehr](https://sebastianlandwehr.com)
<!-- /LICENSE -->
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,20 @@
},
"dependencies": {
"@babel/core": "^7.10.2",
"@dword-design/functions": "^5.0.22",
"@dword-design/suppress-babel-register-esm-warning": "^1.1.10",
"@dword-design/vite-plugin-vue-babel": "^1.0.0",
"@rollup/plugin-babel": "^6.0.3",
"@vitejs/plugin-vue": "^5.0.3",
"@vue/compiler-sfc": "^3.3.4",
"babel-register-esm": "npm:@dword-design/babel-register-esm@^2",
"depcheck-package-name": "^3.0.1",
"execa": "^8.0.1",
"suppress-experimental-warnings": "^1.1.17",
"vite-plugin-babel": "^1.1.3",
"vue-sfc-descriptor-to-string": "^2.0.0"
"vite-plugin-babel": "^1.1.3"
},
"devDependencies": {
"@babel/plugin-proposal-pipeline-operator": "^7.22.5",
"@dword-design/base": "^11.0.2",
"@dword-design/functions": "^5.0.22",
"@dword-design/puppeteer": "^7.0.0",
"@dword-design/tester": "^2.0.19",
"@dword-design/tester-plugin-puppeteer": "^3.0.0",
Expand Down
50 changes: 2 additions & 48 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { transform } from '@babel/core'
import { endent } from '@dword-design/functions'
import vitePluginVueBabel from '@dword-design/vite-plugin-vue-babel'
import { babel as rollupPluginBabel } from '@rollup/plugin-babel'
import { parseVueRequest } from '@vitejs/plugin-vue'
import { generateCodeFrame } from '@vue/compiler-dom'
import { parse } from '@vue/compiler-sfc'
import { runCommand } from 'nuxi'
import vitePluginBabel from 'vite-plugin-babel'
import vueSfcDescriptorToString from 'vue-sfc-descriptor-to-string'

export default (command, args) =>
runCommand(command, [...args, '--no-fork'], {
Expand All @@ -20,48 +15,7 @@ export default (command, args) =>
plugins: [
{
enforce: 'pre',
transform: async (code, id) => {
const query = parseVueRequest(id)
if (
query.filename.endsWith('.vue') &&
query.query.type !== 'style' &&
!query.filename.split('/').includes('node_modules')
) {
const sfc = parse(code)
for (const section of ['scriptSetup', 'script']) {
if (
sfc.descriptor[section] &&
sfc.descriptor[section].lang === undefined
) {
try {
sfc.descriptor[section].content = (
await transform(sfc.descriptor[section].content, {
filename: query.filename,
})
).code
} catch (error) {
error.message = endent`
[vue/compiler-sfc] ${error.message.split('\n')[0]}
${query.filename}
${generateCodeFrame(
sfc.descriptor.source,
error.pos + sfc.descriptor[section].loc.start.offset,
error.pos +
sfc.descriptor[section].loc.start.offset +
1,
)}
`
throw error
}
}
}

return vueSfcDescriptorToString(sfc.descriptor)
}

return code
},
...vitePluginVueBabel(),
},
vitePluginBabel(),
],
Expand Down
Loading

0 comments on commit 794aff0

Please sign in to comment.