yakuza0 2.23.1-beta.4 → 2.23.1-beta.6
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/nuxt/build/index.js +14 -4
- package/nuxt/build/replace.js +146 -1
- package/nuxt/index.js +2 -0
- package/nuxt/plugins/init_client.js +2 -0
- package/package.json +6 -6
- package/pxnpm-lock.yaml +16788 -0
- package/utils/inclusive.js +3 -1
package/nuxt/build/index.js
CHANGED
|
@@ -38,8 +38,6 @@ var _babel = require('./babel');
|
|
|
38
38
|
|
|
39
39
|
var _replace = require('./replace');
|
|
40
40
|
|
|
41
|
-
var _replace2 = _interopRequireDefault(_replace);
|
|
42
|
-
|
|
43
41
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
44
42
|
|
|
45
43
|
var customExtend = function customExtend(_ref) {
|
|
@@ -106,13 +104,13 @@ exports.default = function (config) {
|
|
|
106
104
|
// },
|
|
107
105
|
extractCSS: false,
|
|
108
106
|
corejs: _config2.default.resolve.babelConf.corejs,
|
|
109
|
-
transpile: [_yakuza._.regAnd(['@rdc', 'ant-design-vue']), _yakuza._.regAnd(['.cache', 'yakuza0', 'middleware']), 'nuxt', 'delay', 'node-fetch', 'data-uri-to-buffer', 'fetch-blob', 'quill-image-drop-module', '/ip'].concat((0, _toConsumableArray3.default)(nuxtConf.build && nuxtConf.build.tsl || [])),
|
|
107
|
+
transpile: [_yakuza._.regAnd(['@rdc', 'ant-design-vue']), _yakuza._.regAnd(['.cache', 'yakuza0', 'middleware']), 'nuxt', 'delay', 'node-fetch', 'data-uri-to-buffer', 'fetch-blob', 'quill-image-drop-module', '/ip', /webpack-hot-middleware/, 'ansi-regex', 'strip-ansi'].concat((0, _toConsumableArray3.default)(nuxtConf.build && nuxtConf.build.tsl || [])),
|
|
110
108
|
loaders: (0, _extends3.default)({}, config.build && config.build.loaders, {
|
|
111
109
|
less: (0, _extends3.default)({
|
|
112
110
|
javascriptEnabled: true
|
|
113
111
|
}, config.build && config.build.loaders && config.build.loaders.less)
|
|
114
112
|
}),
|
|
115
|
-
plugins: [new
|
|
113
|
+
plugins: [new _replace.ReplaceInFileWebpackPlugin([].concat((0, _toConsumableArray3.default)(replaceRules), (0, _toConsumableArray3.default)(nuxtConf.build && nuxtConf.build.replace && nuxtConf.build.replace.rules || [])))]
|
|
116
114
|
});
|
|
117
115
|
|
|
118
116
|
// config.build.extractCSS = true;
|
|
@@ -211,6 +209,18 @@ exports.default = function (config) {
|
|
|
211
209
|
}
|
|
212
210
|
});
|
|
213
211
|
|
|
212
|
+
conf.module.rules.push({
|
|
213
|
+
// test: /toPrimitive\.js$/,
|
|
214
|
+
test: /\.js$/,
|
|
215
|
+
loader: 'string-replace-loader',
|
|
216
|
+
options: {
|
|
217
|
+
multiple: [{
|
|
218
|
+
search: 'throw new TypeError("@@toPrimitive must return a primitive value.");',
|
|
219
|
+
replace: ''
|
|
220
|
+
}]
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
214
224
|
// if (!appConf.server.openHmr) {
|
|
215
225
|
// const hmrIndex = conf.plugins.findIndex(p => {
|
|
216
226
|
// return p.constructor.name === 'HotModuleReplacementPlugin';
|
package/nuxt/build/replace.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _keys = require('babel-runtime/core-js/object/keys');
|
|
4
|
+
|
|
5
|
+
var _keys2 = _interopRequireDefault(_keys);
|
|
6
|
+
|
|
7
|
+
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
|
8
|
+
|
|
9
|
+
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
10
|
+
|
|
11
|
+
var _createClass2 = require('babel-runtime/helpers/createClass');
|
|
12
|
+
|
|
13
|
+
var _createClass3 = _interopRequireDefault(_createClass2);
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
3
17
|
var path = require('path');
|
|
4
18
|
var fs = require('fs');
|
|
5
19
|
|
|
@@ -90,7 +104,138 @@ ReplaceInFilePlugin.prototype.apply = function (compiler) {
|
|
|
90
104
|
}
|
|
91
105
|
};
|
|
92
106
|
|
|
93
|
-
|
|
107
|
+
// const replacements = [
|
|
108
|
+
// { searchValue: 'throw new TypeError("@@toPrimitive must return a primitive value.");', replaceValue: '' },
|
|
109
|
+
// ]
|
|
110
|
+
|
|
111
|
+
exports.replaceMultipleStringsPlugin = function (_ref) {
|
|
112
|
+
var t = _ref.types;
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
visitor: {
|
|
116
|
+
StringLiteral: function StringLiteral(path, state) {
|
|
117
|
+
var replacements = state.opts.replacements;
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
if (Array.isArray(replacements)) {
|
|
121
|
+
replacements.forEach(function (_ref2) {
|
|
122
|
+
var searchValue = _ref2.searchValue,
|
|
123
|
+
replaceValue = _ref2.replaceValue;
|
|
124
|
+
|
|
125
|
+
if (typeof searchValue === 'string' && typeof replaceValue === 'string') {
|
|
126
|
+
if (path.node.value.includes(searchValue)) {
|
|
127
|
+
console.log(searchValue, 222);
|
|
128
|
+
path.node.value = path.node.value.replace(new RegExp(searchValue, 'g'), replaceValue);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
TemplateLiteral: function TemplateLiteral(path, state) {
|
|
135
|
+
var replacements = state.opts.replacements;
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
if (Array.isArray(replacements)) {
|
|
139
|
+
path.node.quasis.forEach(function (element) {
|
|
140
|
+
replacements.forEach(function (_ref3) {
|
|
141
|
+
var searchValue = _ref3.searchValue,
|
|
142
|
+
replaceValue = _ref3.replaceValue;
|
|
143
|
+
|
|
144
|
+
if (typeof searchValue === 'string' && typeof replaceValue === 'string') {
|
|
145
|
+
if (element.value.raw.includes(searchValue)) {
|
|
146
|
+
console.log(searchValue, 1111111111);
|
|
147
|
+
element.value.raw = element.value.raw.replace(new RegExp(searchValue, 'g'), replaceValue);
|
|
148
|
+
element.value.cooked = element.value.cooked.replace(new RegExp(searchValue, 'g'), replaceValue);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
// exports.replaceStringPlugin = function ({ types: t }) {
|
|
159
|
+
// return {
|
|
160
|
+
// visitor: {
|
|
161
|
+
// StringLiteral(path, state) {
|
|
162
|
+
// if (Array.isArray(replacements)) {
|
|
163
|
+
// replacements.forEach(({ searchValue, replaceValue }) => {
|
|
164
|
+
// if (typeof searchValue === 'string' && typeof replaceValue === 'string') {
|
|
165
|
+
// if (path.node.value.includes(searchValue)) {
|
|
166
|
+
// path.node.value = path.node.value.replace(new RegExp(searchValue, 'g'), replaceValue);
|
|
167
|
+
// }
|
|
168
|
+
// }
|
|
169
|
+
// });
|
|
170
|
+
// }
|
|
171
|
+
// },
|
|
172
|
+
// TemplateLiteral(path, state) {
|
|
173
|
+
// if (Array.isArray(replacements)) {
|
|
174
|
+
// path.node.quasis.forEach(element => {
|
|
175
|
+
// replacements.forEach(({ searchValue, replaceValue }) => {
|
|
176
|
+
// if (typeof searchValue === 'string' && typeof replaceValue === 'string') {
|
|
177
|
+
// if (element.value.raw.includes(searchValue)) {
|
|
178
|
+
// element.value.raw = element.value.raw.replace(new RegExp(searchValue, 'g'), replaceValue);
|
|
179
|
+
// element.value.cooked = element.value.cooked.replace(new RegExp(searchValue, 'g'), replaceValue);
|
|
180
|
+
// }
|
|
181
|
+
// }
|
|
182
|
+
// });
|
|
183
|
+
// });
|
|
184
|
+
// }
|
|
185
|
+
// }
|
|
186
|
+
// }
|
|
187
|
+
// };
|
|
188
|
+
// };
|
|
189
|
+
|
|
190
|
+
exports.ReplaceInFileWebpackPlugin = ReplaceInFilePlugin;
|
|
191
|
+
|
|
192
|
+
var ReplaceStringsPlugin = function () {
|
|
193
|
+
function ReplaceStringsPlugin(options) {
|
|
194
|
+
(0, _classCallCheck3.default)(this, ReplaceStringsPlugin);
|
|
195
|
+
|
|
196
|
+
this.options = options || {};
|
|
197
|
+
// 从配置项中获取替换规则
|
|
198
|
+
this.replacements = this.options.replacements || [];
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
(0, _createClass3.default)(ReplaceStringsPlugin, [{
|
|
202
|
+
key: 'apply',
|
|
203
|
+
value: function apply(compiler) {
|
|
204
|
+
var _this2 = this;
|
|
205
|
+
|
|
206
|
+
compiler.hooks.emit.tapAsync('ReplaceStringsPlugin', function (compilation, callback) {
|
|
207
|
+
(0, _keys2.default)(compilation.assets).forEach(function (filename) {
|
|
208
|
+
if (filename.endsWith('.js')) {
|
|
209
|
+
var originalSource = compilation.assets[filename].source();
|
|
210
|
+
|
|
211
|
+
// 依次应用每个替换规则
|
|
212
|
+
_this2.replacements.forEach(function (_ref4) {
|
|
213
|
+
var target = _ref4.target,
|
|
214
|
+
replacement = _ref4.replacement;
|
|
215
|
+
|
|
216
|
+
originalSource = originalSource.replace(new RegExp(target, 'g'), replacement);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// 更新资源
|
|
220
|
+
compilation.assets[filename] = {
|
|
221
|
+
source: function source() {
|
|
222
|
+
return originalSource;
|
|
223
|
+
},
|
|
224
|
+
size: function size() {
|
|
225
|
+
return originalSource.length;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
callback();
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}]);
|
|
235
|
+
return ReplaceStringsPlugin;
|
|
236
|
+
}();
|
|
237
|
+
|
|
238
|
+
exports.ReplaceStringsPlugin = ReplaceStringsPlugin;
|
|
94
239
|
|
|
95
240
|
// import {minimatch} from 'yakuza1'
|
|
96
241
|
//
|
package/nuxt/index.js
CHANGED
|
@@ -26,6 +26,8 @@ var _ws = require('yakuza1/lib/ws');
|
|
|
26
26
|
|
|
27
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
28
|
|
|
29
|
+
// import 'url-search-params-polyfill';
|
|
30
|
+
|
|
29
31
|
exports.default = function () {
|
|
30
32
|
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) {
|
|
31
33
|
var store, $yk, $ws, app, route, keys, cs, clientKey, q, ci;
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yakuza0",
|
|
3
|
-
"version": "2.23.1-beta.
|
|
3
|
+
"version": "2.23.1-beta.6",
|
|
4
4
|
"description": "yakuza0 with nuxt",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"base": "babel --no-babelrc src -d /Users/ningfujun/work/repo/web/CLN_BASE_TEST/node_modules/yakuza0 -w --presets=env --plugins=transform-runtime,transform-object-rest-spread,add-module-exports",
|
|
8
7
|
"build": "babel --no-babelrc src -d . --presets=env --plugins=transform-runtime,transform-object-rest-spread,add-module-exports",
|
|
9
8
|
"pub:beta": "npm run build && npm version prerelease --preid=beta && npm publish --tag beta",
|
|
10
9
|
"pub:hotfix": "npm run build && npm version prerelease --preid=hotfix && npm publish --tag hotfix",
|
|
@@ -54,7 +53,7 @@
|
|
|
54
53
|
"compression": "^1.7.4",
|
|
55
54
|
"connection-tester": "^0.2.1",
|
|
56
55
|
"consola": "^2.10.1",
|
|
57
|
-
"core-js": "
|
|
56
|
+
"core-js": "3.10.1",
|
|
58
57
|
"css-loader": "^5.2.7",
|
|
59
58
|
"download": "^7.1.0",
|
|
60
59
|
"eslint": "^7.2.0",
|
|
@@ -96,6 +95,7 @@
|
|
|
96
95
|
"sass-loader": "^10",
|
|
97
96
|
"semver": "^6.3.0",
|
|
98
97
|
"socket.io-client": "^2.2.0",
|
|
98
|
+
"string-replace-loader": "^3.1.0",
|
|
99
99
|
"stylelint": "^14.1.0",
|
|
100
100
|
"stylelint-config-prettier": "^9.0.3",
|
|
101
101
|
"stylelint-config-rational-order": "^0.1.2",
|
|
@@ -113,13 +113,13 @@
|
|
|
113
113
|
"ua-parser-js": "^0.7.20",
|
|
114
114
|
"uglify-js": "^3.17.4",
|
|
115
115
|
"v8-compile-cache": "^2.0.2",
|
|
116
|
-
"yakuza1": "2.6.
|
|
116
|
+
"yakuza1": "^2.6.16"
|
|
117
117
|
},
|
|
118
118
|
"peerDependencies": {
|
|
119
119
|
"@rdc/nuxt": "2.15.8",
|
|
120
|
-
"core-js": "
|
|
120
|
+
"core-js": "3.10.1",
|
|
121
121
|
"eslint": "7.2.0",
|
|
122
|
-
"yakuza1": "2.6.
|
|
122
|
+
"yakuza1": "^2.6.16"
|
|
123
123
|
},
|
|
124
124
|
"__npminstall_done": false
|
|
125
125
|
}
|