@dword-design/base-config-nuxt 4.0.8 → 4.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +26 -13
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -76,7 +76,10 @@ export default {
76
76
  import dotenv from '@dword-design/dotenv-json-extended'
77
77
  import jitiBabelTransform from '@dword-design/jiti-babel-transform'
78
78
  import { transform } from '@babel/core'
79
- import { babel } from '${packageName`@rollup/plugin-babel`}'
79
+ import { babel as rollupPluginBabel } from '${packageName`@rollup/plugin-babel`}'
80
+ import { parse } from 'vue/compiler-sfc'
81
+ import vueSfcDescriptorToString from '${packageName`vue-sfc-descriptor-to-string`}'
82
+ import { parseVueRequest } from '@vitejs/plugin-vue'
80
83
 
81
84
  dotenv.config()
82
85
 
@@ -99,7 +102,7 @@ export default {
99
102
  export default {
100
103
  nitro: {
101
104
  rollupConfig: {
102
- plugins: [babel({ babelHelpers: 'bundled' })],
105
+ plugins: [rollupPluginBabel({ babelHelpers: 'bundled' })],
103
106
  },
104
107
  },
105
108
  modules: [
@@ -108,22 +111,32 @@ export default {
108
111
  vite: {
109
112
  plugins: [
110
113
  {
111
- transform: (code, id) => {
112
- if (id.endsWith('.vue')) {
113
- return transform(code, {
114
- plugins: [
115
- ['@babel/proposal-pipeline-operator', { proposal: 'fsharp'}],
116
- ],
117
- })
114
+ enforce: 'pre',
115
+ transform: async (code, id) => {
116
+ const query = parseVueRequest(id)
117
+ if (query.filename.endsWith('.vue')) {
118
+ const sfc = parse(code)
119
+ if (sfc.descriptor.scriptSetup) {
120
+ sfc.descriptor.scriptSetup.content = await transform(sfc.descriptor.scriptSetup.content, {
121
+ plugins: [['@babel/plugin-proposal-pipeline-operator', { proposal: 'fsharp' }]]
122
+ }).code
123
+ }
124
+ if (sfc.descriptor.script) {
125
+ sfc.descriptor.script.content = await transform(sfc.descriptor.script.content, {
126
+ plugins: [['@babel/plugin-proposal-pipeline-operator', { proposal: 'fsharp' }]]
127
+ }).code
128
+ }
129
+ return vueSfcDescriptorToString(sfc.descriptor)
118
130
  }
131
+ return code
119
132
  },
120
133
  }
121
134
  ],
122
135
  vue: {
123
- script: {
124
- babelParserPlugins: [
125
- ['pipelineOperator', { proposal: 'fsharp' }],
126
- ],
136
+ template: {
137
+ transformAssetUrls: {
138
+ includeAbsolute: false,
139
+ },
127
140
  },
128
141
  },
129
142
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dword-design/base-config-nuxt",
3
- "version": "4.0.8",
3
+ "version": "4.0.10",
4
4
  "repository": "dword-design/base-config-nuxt",
5
5
  "funding": "https://github.com/sponsors/dword-design",
6
6
  "license": "MIT",
@@ -46,7 +46,8 @@
46
46
  "output-files": "^2.0.0",
47
47
  "require-package-name": "^2.0.1",
48
48
  "stylelint": "^13.6.0",
49
- "vite-svg-loader": "^4.0.0"
49
+ "vite-svg-loader": "^4.0.0",
50
+ "vue-sfc-descriptor-to-string": "npm:@dword-design/vue-sfc-descriptor-to-string"
50
51
  },
51
52
  "devDependencies": {
52
53
  "@dword-design/base": "^10.0.0",