@shijiu/jsview-vue 0.9.265 → 0.9.272
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.
- package/package.json +1 -1
- package/patches/node_modules/@babel/preset-env/lib/available-plugins.js +219 -0
- package/patches/node_modules/@vue/cli-plugin-typescript/index.js +100 -0
- package/patches/node_modules/@vue/cli-service/lib/commands/serve.js +395 -0
- package/patches/node_modules/@vue/cli-service/lib/config/app.js +272 -0
- package/patches/node_modules/@vue/cli-service/lib/config/assets.js +70 -0
- package/patches/node_modules/@vue/cli-service/lib/config/base.js +212 -0
- package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +2566 -0
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +274 -0
- package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1596 -0
- package/patches/node_modules/postcss-js/objectifier.js +90 -0
- package/patches/node_modules/vue-loader/dist/resolveScript.js +70 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** @type {import('@vue/cli-service').ServicePlugin} */
|
|
2
|
+
module.exports = (api, options) => {
|
|
3
|
+
const getAssetPath = require('../util/getAssetPath')
|
|
4
|
+
const getVueMajor = require('../util/getVueMajor')
|
|
5
|
+
|
|
6
|
+
const inlineLimit = 4096
|
|
7
|
+
|
|
8
|
+
const vueMajor = getVueMajor(api.getCwd())
|
|
9
|
+
const supportsEsModuleAsset = (vueMajor !== 2)
|
|
10
|
+
|
|
11
|
+
const genAssetSubPath = dir => {
|
|
12
|
+
return getAssetPath(
|
|
13
|
+
options,
|
|
14
|
+
`${dir}/[name]${options.filenameHashing ? '.[hash:8]' : ''}.[ext]`
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// TODO: use asset modules for webpack 5
|
|
19
|
+
// <https://webpack.js.org/guides/asset-modules/>
|
|
20
|
+
|
|
21
|
+
const genUrlLoaderOptions = dir => {
|
|
22
|
+
return {
|
|
23
|
+
limit: inlineLimit,
|
|
24
|
+
esModule: supportsEsModuleAsset,
|
|
25
|
+
// use explicit fallback to avoid regression in url-loader>=1.1.0
|
|
26
|
+
fallback: {
|
|
27
|
+
loader: require.resolve('file-loader'),
|
|
28
|
+
options: {
|
|
29
|
+
name: genAssetSubPath(dir),
|
|
30
|
+
esModule: supportsEsModuleAsset
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
api.chainWebpack(webpackConfig => {
|
|
37
|
+
webpackConfig.module
|
|
38
|
+
.rule('images')
|
|
39
|
+
.test(/\.(png|jpe?g|gif|webp|avif|bmp)(\?.*)?$/) // QCode Modified
|
|
40
|
+
.use('url-loader')
|
|
41
|
+
.loader(require.resolve('url-loader'))
|
|
42
|
+
.options(genUrlLoaderOptions('img'))
|
|
43
|
+
|
|
44
|
+
// do not base64-inline SVGs.
|
|
45
|
+
// https://github.com/facebookincubator/create-react-app/pull/1180
|
|
46
|
+
webpackConfig.module
|
|
47
|
+
.rule('svg')
|
|
48
|
+
.test(/\.(svg)(\?.*)?$/)
|
|
49
|
+
.use('file-loader')
|
|
50
|
+
.loader(require.resolve('file-loader'))
|
|
51
|
+
.options({
|
|
52
|
+
name: genAssetSubPath('img'),
|
|
53
|
+
esModule: supportsEsModuleAsset
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
webpackConfig.module
|
|
57
|
+
.rule('media')
|
|
58
|
+
.test(/\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/)
|
|
59
|
+
.use('url-loader')
|
|
60
|
+
.loader(require.resolve('url-loader'))
|
|
61
|
+
.options(genUrlLoaderOptions('media'))
|
|
62
|
+
|
|
63
|
+
webpackConfig.module
|
|
64
|
+
.rule('fonts')
|
|
65
|
+
.test(/\.(woff2?|eot|ttf|otf)(\?.*)?$/i)
|
|
66
|
+
.use('url-loader')
|
|
67
|
+
.loader(require.resolve('url-loader'))
|
|
68
|
+
.options(genUrlLoaderOptions('fonts'))
|
|
69
|
+
})
|
|
70
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const { semver } = require('@vue/cli-shared-utils')
|
|
3
|
+
|
|
4
|
+
/** @type {import('@vue/cli-service').ServicePlugin} */
|
|
5
|
+
module.exports = (api, options) => {
|
|
6
|
+
const cwd = api.getCwd()
|
|
7
|
+
const webpack = require('webpack')
|
|
8
|
+
const webpackMajor = semver.major(webpack.version)
|
|
9
|
+
const vueMajor = require('../util/getVueMajor')(cwd)
|
|
10
|
+
|
|
11
|
+
api.chainWebpack(webpackConfig => {
|
|
12
|
+
const isLegacyBundle = process.env.VUE_CLI_MODERN_MODE && !process.env.VUE_CLI_MODERN_BUILD
|
|
13
|
+
const resolveLocal = require('../util/resolveLocal')
|
|
14
|
+
|
|
15
|
+
// https://github.com/webpack/webpack/issues/11467#issuecomment-691873586
|
|
16
|
+
if (webpackMajor !== 4) {
|
|
17
|
+
webpackConfig.module
|
|
18
|
+
.rule('esm')
|
|
19
|
+
.test(/\.m?jsx?$/)
|
|
20
|
+
.resolve.set('fullySpecified', false)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
webpackConfig
|
|
24
|
+
.mode('development')
|
|
25
|
+
.context(api.service.context)
|
|
26
|
+
// QCode Modified >>>>>
|
|
27
|
+
.entry('main.jsv')
|
|
28
|
+
.add(api.resolve('node_modules/@shijiu/jsview-vue/loader/jsview-main.js'))
|
|
29
|
+
// QCode Modified <<<<<
|
|
30
|
+
.end()
|
|
31
|
+
.output
|
|
32
|
+
.path(api.resolve(options.outputDir))
|
|
33
|
+
.filename(isLegacyBundle ? '[name]-legacy.js' : '[name].js')
|
|
34
|
+
.publicPath(options.publicPath)
|
|
35
|
+
|
|
36
|
+
webpackConfig.resolve
|
|
37
|
+
.extensions
|
|
38
|
+
.merge(['.mjs', '.js', '.jsx', '.vue', '.json', '.wasm'])
|
|
39
|
+
.end()
|
|
40
|
+
.modules
|
|
41
|
+
.add('node_modules')
|
|
42
|
+
.add(api.resolve('node_modules'))
|
|
43
|
+
.add(resolveLocal('node_modules'))
|
|
44
|
+
.end()
|
|
45
|
+
.alias
|
|
46
|
+
.set('@', api.resolve('src'))
|
|
47
|
+
.set('jsview', api.resolve('node_modules/@shijiu/jsview-vue')) // QCode Added
|
|
48
|
+
|
|
49
|
+
webpackConfig.resolveLoader
|
|
50
|
+
.modules
|
|
51
|
+
.add('node_modules')
|
|
52
|
+
.add(api.resolve('node_modules'))
|
|
53
|
+
.add(resolveLocal('node_modules'))
|
|
54
|
+
|
|
55
|
+
webpackConfig.module
|
|
56
|
+
.noParse(/^(vue|vue-router|vuex|vuex-router-sync)$/)
|
|
57
|
+
|
|
58
|
+
// js is handled by cli-plugin-babel ---------------------------------------
|
|
59
|
+
|
|
60
|
+
// vue-loader --------------------------------------------------------------
|
|
61
|
+
if (vueMajor === 2) {
|
|
62
|
+
// for Vue 2 projects
|
|
63
|
+
const vueLoaderCacheConfig = api.genCacheConfig('vue-loader', {
|
|
64
|
+
'vue-loader': require('@vue/vue-loader-v15/package.json').version,
|
|
65
|
+
'@vue/component-compiler-utils': require('@vue/component-compiler-utils/package.json').version,
|
|
66
|
+
'vue-template-compiler': require('vue-template-compiler/package.json').version
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
webpackConfig.resolve
|
|
70
|
+
.alias
|
|
71
|
+
.set(
|
|
72
|
+
'vue$',
|
|
73
|
+
options.runtimeCompiler
|
|
74
|
+
? 'vue/dist/vue.esm.js'
|
|
75
|
+
: 'vue/dist/vue.runtime.esm.js'
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
webpackConfig.module
|
|
79
|
+
.rule('vue')
|
|
80
|
+
.test(/\.vue$/)
|
|
81
|
+
.use('cache-loader')
|
|
82
|
+
.loader(require.resolve('cache-loader'))
|
|
83
|
+
.options(vueLoaderCacheConfig)
|
|
84
|
+
.end()
|
|
85
|
+
.use('vue-loader')
|
|
86
|
+
.loader(require.resolve('@vue/vue-loader-v15'))
|
|
87
|
+
.options(Object.assign({
|
|
88
|
+
compilerOptions: {
|
|
89
|
+
whitespace: 'condense'
|
|
90
|
+
}
|
|
91
|
+
}, vueLoaderCacheConfig))
|
|
92
|
+
|
|
93
|
+
webpackConfig
|
|
94
|
+
.plugin('vue-loader')
|
|
95
|
+
.use(require('@vue/vue-loader-v15').VueLoaderPlugin)
|
|
96
|
+
|
|
97
|
+
// some plugins may implicitly relies on the `vue-loader` dependency path name
|
|
98
|
+
// such as vue-cli-plugin-apollo
|
|
99
|
+
// <https://github.com/Akryum/vue-cli-plugin-apollo/blob/d9fe48c61cc19db88fef4e4aa5e49b31aa0c44b7/index.js#L88>
|
|
100
|
+
// so we need a hotfix for that
|
|
101
|
+
webpackConfig
|
|
102
|
+
.resolveLoader
|
|
103
|
+
.modules
|
|
104
|
+
.prepend(path.resolve(__dirname, './vue-loader-v15-resolve-compat'))
|
|
105
|
+
} else if (vueMajor === 3) {
|
|
106
|
+
// for Vue 3 projects
|
|
107
|
+
const vueLoaderCacheConfig = api.genCacheConfig('vue-loader', {
|
|
108
|
+
'vue-loader': require('vue-loader/package.json').version,
|
|
109
|
+
'@vue/compiler-sfc': require('@vue/compiler-sfc/package.json').version
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
webpackConfig.resolve
|
|
113
|
+
.alias
|
|
114
|
+
.set(
|
|
115
|
+
'vue$',
|
|
116
|
+
options.runtimeCompiler
|
|
117
|
+
? 'vue/dist/vue.esm-bundler.js'
|
|
118
|
+
: 'vue/dist/vue.runtime.esm-bundler.js'
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
webpackConfig.module
|
|
122
|
+
.rule('vue')
|
|
123
|
+
.test(/\.vue$/)
|
|
124
|
+
.use('cache-loader')
|
|
125
|
+
.loader(require.resolve('cache-loader'))
|
|
126
|
+
.options(vueLoaderCacheConfig)
|
|
127
|
+
.end()
|
|
128
|
+
.use('vue-loader')
|
|
129
|
+
.loader(require.resolve('vue-loader'))
|
|
130
|
+
.options({
|
|
131
|
+
...vueLoaderCacheConfig,
|
|
132
|
+
compilerOptions: { isCustomElement: tag => tag === 'fdiv' }, // QCode Added
|
|
133
|
+
babelParserPlugins: ['jsx', 'classProperties', 'decorators-legacy']
|
|
134
|
+
})
|
|
135
|
+
.end()
|
|
136
|
+
.end()
|
|
137
|
+
|
|
138
|
+
webpackConfig
|
|
139
|
+
.plugin('vue-loader')
|
|
140
|
+
.use(require('vue-loader').VueLoaderPlugin)
|
|
141
|
+
|
|
142
|
+
// feature flags <http://link.vuejs.org/feature-flags>
|
|
143
|
+
webpackConfig
|
|
144
|
+
.plugin('feature-flags')
|
|
145
|
+
.use(webpack.DefinePlugin, [{
|
|
146
|
+
__VUE_OPTIONS_API__: 'true',
|
|
147
|
+
__VUE_PROD_DEVTOOLS__: 'false'
|
|
148
|
+
}])
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// https://github.com/vuejs/vue-loader/issues/1435#issuecomment-869074949
|
|
152
|
+
webpackConfig.module
|
|
153
|
+
.rule('vue-style')
|
|
154
|
+
.test(/\.vue$/)
|
|
155
|
+
.resourceQuery(/type=style/)
|
|
156
|
+
.sideEffects(true)
|
|
157
|
+
|
|
158
|
+
// Other common pre-processors ---------------------------------------------
|
|
159
|
+
const maybeResolve = name => {
|
|
160
|
+
try {
|
|
161
|
+
return require.resolve(name)
|
|
162
|
+
} catch (error) {
|
|
163
|
+
return name
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
webpackConfig.module
|
|
168
|
+
.rule('pug')
|
|
169
|
+
.test(/\.pug$/)
|
|
170
|
+
.oneOf('pug-vue')
|
|
171
|
+
.resourceQuery(/vue/)
|
|
172
|
+
.use('pug-plain-loader')
|
|
173
|
+
.loader(maybeResolve('pug-plain-loader'))
|
|
174
|
+
.end()
|
|
175
|
+
.end()
|
|
176
|
+
.oneOf('pug-template')
|
|
177
|
+
.use('raw')
|
|
178
|
+
.loader(maybeResolve('raw-loader'))
|
|
179
|
+
.end()
|
|
180
|
+
.use('pug-plain-loader')
|
|
181
|
+
.loader(maybeResolve('pug-plain-loader'))
|
|
182
|
+
.end()
|
|
183
|
+
.end()
|
|
184
|
+
|
|
185
|
+
const resolveClientEnv = require('../util/resolveClientEnv')
|
|
186
|
+
webpackConfig
|
|
187
|
+
.plugin('define')
|
|
188
|
+
.use(webpack.DefinePlugin, [
|
|
189
|
+
resolveClientEnv(options)
|
|
190
|
+
])
|
|
191
|
+
|
|
192
|
+
webpackConfig
|
|
193
|
+
.plugin('case-sensitive-paths')
|
|
194
|
+
.use(require('case-sensitive-paths-webpack-plugin'))
|
|
195
|
+
|
|
196
|
+
// friendly error plugin displays very confusing errors when webpack
|
|
197
|
+
// fails to resolve a loader, so we provide custom handlers to improve it
|
|
198
|
+
const { transformer, formatter } = require('../util/resolveLoaderError')
|
|
199
|
+
webpackConfig
|
|
200
|
+
.plugin('friendly-errors')
|
|
201
|
+
.use(require('@soda/friendly-errors-webpack-plugin'), [{
|
|
202
|
+
additionalTransformers: [transformer],
|
|
203
|
+
additionalFormatters: [formatter]
|
|
204
|
+
}])
|
|
205
|
+
|
|
206
|
+
const TerserPlugin = require('terser-webpack-plugin')
|
|
207
|
+
const terserOptions = require('./terserOptions')
|
|
208
|
+
webpackConfig.optimization
|
|
209
|
+
.minimizer('terser')
|
|
210
|
+
.use(TerserPlugin, [terserOptions(options)])
|
|
211
|
+
})
|
|
212
|
+
}
|