@waline/vercel 1.26.4 → 1.26.5

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/build/build.js ADDED
@@ -0,0 +1,69 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const blackList = ['think-model-sqlite'];
5
+ const pkg = require(path.join(__dirname, '../package.json'));
6
+
7
+ // pkg.name = '@waline/deta';
8
+
9
+ const dist = path.join(__dirname, '../dist');
10
+
11
+ function readFileRecursive(dir) {
12
+ const files = fs.readdirSync(dir);
13
+ const ret = [];
14
+
15
+ for (let i = 0; i < files.length; i++) {
16
+ const filePath = path.join(dir, files[i]);
17
+ const fileInfo = fs.lstatSync(filePath);
18
+
19
+ if (fileInfo.isDirectory()) {
20
+ ret.push(...readFileRecursive(filePath));
21
+ } else {
22
+ ret.push(fs.readFileSync(filePath, 'utf-8'));
23
+ }
24
+ }
25
+
26
+ return ret;
27
+ }
28
+
29
+ function findDeps(text) {
30
+ const reg = /require\(\'([^.']+)\'\)/g;
31
+ const matches = text.matchAll(reg);
32
+ const deps = Array.from(matches, ([_, moduleName]) => {
33
+ if (moduleName.includes('/') && !moduleName.startsWith('@')) {
34
+ return moduleName.split('/')[0];
35
+ }
36
+
37
+ return moduleName;
38
+ });
39
+
40
+ return deps;
41
+ }
42
+
43
+ function main() {
44
+ const codes = readFileRecursive(path.join(dist, 'src'));
45
+ const deps = [];
46
+
47
+ for (const code of codes) {
48
+ const codeDeps = findDeps(code);
49
+
50
+ deps.push(...codeDeps);
51
+ }
52
+
53
+ for (let dep in pkg.dependencies) {
54
+ const exist = deps.includes(dep);
55
+ const isBlack = blackList.includes(dep);
56
+
57
+ if (!exist || isBlack) {
58
+ delete pkg.dependencies[dep];
59
+ }
60
+ }
61
+
62
+ fs.writeFileSync(
63
+ path.join(dist, 'package.json'),
64
+ JSON.stringify(pkg, null, '\t'),
65
+ 'utf-8'
66
+ );
67
+ }
68
+
69
+ main();
package/build/deta.sh ADDED
File without changes
package/deta.build.sh ADDED
@@ -0,0 +1,3 @@
1
+ ncc build index.js
2
+ node -e "pkg = require('./package.json'); pkg.version += '-deta'; delete pkg.dependencies['think-model-sqlite']; delete pkg.scripts; console.log(JSON.stringify(pkg, null, '\t'));" > ./dist/package.json
3
+ cd dist && npm publish --tag deta
package/dist/index.js CHANGED
@@ -1994,7 +1994,7 @@ function objectToString(o) {
1994
1994
  "use strict";
1995
1995
 
1996
1996
 
1997
- var moment = __nccwpck_require__(4581);
1997
+ var moment = __nccwpck_require__(4907);
1998
1998
 
1999
1999
  CronDate.prototype.addYear = function() {
2000
2000
  this._date.add(1, 'year');
@@ -21050,14 +21050,14 @@ module.exports = merge;
21050
21050
 
21051
21051
  /***/ }),
21052
21052
 
21053
- /***/ 8987:
21053
+ /***/ 1796:
21054
21054
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
21055
21055
 
21056
21056
  /* eslint max-classes-per-file: ["error", 2] */
21057
21057
  /* eslint no-underscore-dangle: ["error", { "allow": ["_getLocationKeys"] }] */
21058
21058
 
21059
21059
  const flatted = __nccwpck_require__(8522);
21060
- const levels = __nccwpck_require__(1801);
21060
+ const levels = __nccwpck_require__(4985);
21061
21061
 
21062
21062
  class SerDe {
21063
21063
  constructor() {
@@ -21214,7 +21214,7 @@ module.exports = LoggingEvent;
21214
21214
 
21215
21215
  /***/ }),
21216
21216
 
21217
- /***/ 5363:
21217
+ /***/ 3382:
21218
21218
  /***/ ((module) => {
21219
21219
 
21220
21220
  function maxFileSizeUnitTransform(maxLogSize) {
@@ -21267,7 +21267,7 @@ module.exports.modifyConfig = (config) =>
21267
21267
 
21268
21268
  /***/ }),
21269
21269
 
21270
- /***/ 1557:
21270
+ /***/ 1545:
21271
21271
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
21272
21272
 
21273
21273
  const debug = __nccwpck_require__(5299)('log4js:categoryFilter');
@@ -21293,7 +21293,7 @@ module.exports.configure = configure;
21293
21293
 
21294
21294
  /***/ }),
21295
21295
 
21296
- /***/ 5557:
21296
+ /***/ 9863:
21297
21297
  /***/ ((module) => {
21298
21298
 
21299
21299
  // eslint-disable-next-line no-console
@@ -21318,7 +21318,7 @@ module.exports.configure = configure;
21318
21318
 
21319
21319
  /***/ }),
21320
21320
 
21321
- /***/ 6584:
21321
+ /***/ 7672:
21322
21322
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
21323
21323
 
21324
21324
  const streams = __nccwpck_require__(5709);
@@ -21401,7 +21401,7 @@ module.exports.configure = configure;
21401
21401
 
21402
21402
  /***/ }),
21403
21403
 
21404
- /***/ 5059:
21404
+ /***/ 6307:
21405
21405
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
21406
21406
 
21407
21407
  const debug = __nccwpck_require__(5299)('log4js:file');
@@ -21444,10 +21444,10 @@ function fileAppender(
21444
21444
  throw new Error(`Invalid filename: ${file}`);
21445
21445
  } else if (file.endsWith(path.sep)) {
21446
21446
  throw new Error(`Filename is a directory: ${file}`);
21447
- } else {
21447
+ } else if (file.indexOf(`~${path.sep}`) === 0) {
21448
21448
  // handle ~ expansion: https://github.com/nodejs/node/issues/684
21449
21449
  // exclude ~ and ~filename as these can be valid files
21450
- file = file.replace(new RegExp(`^~(?=${path.sep}.+)`), os.homedir());
21450
+ file = file.replace('~', os.homedir());
21451
21451
  }
21452
21452
  file = path.normalize(file);
21453
21453
  numBackups = !numBackups && numBackups !== 0 ? 5 : numBackups;
@@ -21562,7 +21562,7 @@ module.exports.configure = configure;
21562
21562
 
21563
21563
  /***/ }),
21564
21564
 
21565
- /***/ 4362:
21565
+ /***/ 8740:
21566
21566
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
21567
21567
 
21568
21568
  const debug = __nccwpck_require__(5299)('log4js:fileSync');
@@ -21750,10 +21750,10 @@ function fileAppender(
21750
21750
  throw new Error(`Invalid filename: ${file}`);
21751
21751
  } else if (file.endsWith(path.sep)) {
21752
21752
  throw new Error(`Filename is a directory: ${file}`);
21753
- } else {
21753
+ } else if (file.indexOf(`~${path.sep}`) === 0) {
21754
21754
  // handle ~ expansion: https://github.com/nodejs/node/issues/684
21755
21755
  // exclude ~ and ~filename as these can be valid files
21756
- file = file.replace(new RegExp(`^~(?=${path.sep}.+)`), os.homedir());
21756
+ file = file.replace('~', os.homedir());
21757
21757
  }
21758
21758
  file = path.normalize(file);
21759
21759
  numBackups = !numBackups && numBackups !== 0 ? 5 : numBackups;
@@ -21827,29 +21827,29 @@ module.exports.configure = configure;
21827
21827
 
21828
21828
  /***/ }),
21829
21829
 
21830
- /***/ 8852:
21830
+ /***/ 3447:
21831
21831
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
21832
21832
 
21833
21833
  const path = __nccwpck_require__(1017);
21834
21834
  const debug = __nccwpck_require__(5299)('log4js:appenders');
21835
- const configuration = __nccwpck_require__(601);
21836
- const clustering = __nccwpck_require__(4173);
21837
- const levels = __nccwpck_require__(1801);
21838
- const layouts = __nccwpck_require__(243);
21839
- const adapters = __nccwpck_require__(5363);
21835
+ const configuration = __nccwpck_require__(3845);
21836
+ const clustering = __nccwpck_require__(5422);
21837
+ const levels = __nccwpck_require__(4985);
21838
+ const layouts = __nccwpck_require__(8061);
21839
+ const adapters = __nccwpck_require__(3382);
21840
21840
 
21841
21841
  // pre-load the core appenders so that webpack can find them
21842
21842
  const coreAppenders = new Map();
21843
- coreAppenders.set('console', __nccwpck_require__(5557));
21844
- coreAppenders.set('stdout', __nccwpck_require__(1820));
21845
- coreAppenders.set('stderr', __nccwpck_require__(390));
21846
- coreAppenders.set('logLevelFilter', __nccwpck_require__(1129));
21847
- coreAppenders.set('categoryFilter', __nccwpck_require__(1557));
21848
- coreAppenders.set('noLogFilter', __nccwpck_require__(575));
21849
- coreAppenders.set('file', __nccwpck_require__(5059));
21850
- coreAppenders.set('dateFile', __nccwpck_require__(6584));
21851
- coreAppenders.set('fileSync', __nccwpck_require__(4362));
21852
- coreAppenders.set('tcp', __nccwpck_require__(7082));
21843
+ coreAppenders.set('console', __nccwpck_require__(9863));
21844
+ coreAppenders.set('stdout', __nccwpck_require__(1549));
21845
+ coreAppenders.set('stderr', __nccwpck_require__(3630));
21846
+ coreAppenders.set('logLevelFilter', __nccwpck_require__(3816));
21847
+ coreAppenders.set('categoryFilter', __nccwpck_require__(1545));
21848
+ coreAppenders.set('noLogFilter', __nccwpck_require__(8507));
21849
+ coreAppenders.set('file', __nccwpck_require__(6307));
21850
+ coreAppenders.set('dateFile', __nccwpck_require__(7672));
21851
+ coreAppenders.set('fileSync', __nccwpck_require__(8740));
21852
+ coreAppenders.set('tcp', __nccwpck_require__(9010));
21853
21853
 
21854
21854
  const appenders = new Map();
21855
21855
 
@@ -22016,7 +22016,7 @@ module.exports.init = init;
22016
22016
 
22017
22017
  /***/ }),
22018
22018
 
22019
- /***/ 1129:
22019
+ /***/ 3816:
22020
22020
  /***/ ((module) => {
22021
22021
 
22022
22022
  function logLevelFilter(minLevelString, maxLevelString, appender, levels) {
@@ -22043,7 +22043,7 @@ module.exports.configure = configure;
22043
22043
 
22044
22044
  /***/ }),
22045
22045
 
22046
- /***/ 575:
22046
+ /***/ 8507:
22047
22047
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
22048
22048
 
22049
22049
  const debug = __nccwpck_require__(5299)('log4js:noLogFilter');
@@ -22093,7 +22093,7 @@ module.exports.configure = configure;
22093
22093
 
22094
22094
  /***/ }),
22095
22095
 
22096
- /***/ 36:
22096
+ /***/ 3569:
22097
22097
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
22098
22098
 
22099
22099
  const debug = __nccwpck_require__(5299)('log4js:recording');
@@ -22129,7 +22129,7 @@ module.exports = {
22129
22129
 
22130
22130
  /***/ }),
22131
22131
 
22132
- /***/ 390:
22132
+ /***/ 3630:
22133
22133
  /***/ ((module) => {
22134
22134
 
22135
22135
  function stderrAppender(layout, timezoneOffset) {
@@ -22151,7 +22151,7 @@ module.exports.configure = configure;
22151
22151
 
22152
22152
  /***/ }),
22153
22153
 
22154
- /***/ 1820:
22154
+ /***/ 1549:
22155
22155
  /***/ ((__unused_webpack_module, exports) => {
22156
22156
 
22157
22157
  function stdoutAppender(layout, timezoneOffset) {
@@ -22173,7 +22173,7 @@ exports.configure = configure;
22173
22173
 
22174
22174
  /***/ }),
22175
22175
 
22176
- /***/ 7082:
22176
+ /***/ 9010:
22177
22177
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
22178
22178
 
22179
22179
  const debug = __nccwpck_require__(5299)('log4js:tcp');
@@ -22272,13 +22272,13 @@ module.exports.configure = configure;
22272
22272
 
22273
22273
  /***/ }),
22274
22274
 
22275
- /***/ 2826:
22275
+ /***/ 232:
22276
22276
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
22277
22277
 
22278
22278
  const debug = __nccwpck_require__(5299)('log4js:categories');
22279
- const configuration = __nccwpck_require__(601);
22280
- const levels = __nccwpck_require__(1801);
22281
- const appenders = __nccwpck_require__(8852);
22279
+ const configuration = __nccwpck_require__(3845);
22280
+ const levels = __nccwpck_require__(4985);
22281
+ const appenders = __nccwpck_require__(3447);
22282
22282
 
22283
22283
  const categories = new Map();
22284
22284
 
@@ -22498,12 +22498,12 @@ module.exports = Object.assign(module.exports, {
22498
22498
 
22499
22499
  /***/ }),
22500
22500
 
22501
- /***/ 4173:
22501
+ /***/ 5422:
22502
22502
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
22503
22503
 
22504
22504
  const debug = __nccwpck_require__(5299)('log4js:clustering');
22505
- const LoggingEvent = __nccwpck_require__(8987);
22506
- const configuration = __nccwpck_require__(601);
22505
+ const LoggingEvent = __nccwpck_require__(1796);
22506
+ const configuration = __nccwpck_require__(3845);
22507
22507
 
22508
22508
  let disabled = false;
22509
22509
  let cluster = null;
@@ -22610,7 +22610,7 @@ module.exports = {
22610
22610
 
22611
22611
  /***/ }),
22612
22612
 
22613
- /***/ 601:
22613
+ /***/ 3845:
22614
22614
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
22615
22615
 
22616
22616
  const util = __nccwpck_require__(3837);
@@ -22681,12 +22681,12 @@ module.exports = {
22681
22681
 
22682
22682
  /***/ }),
22683
22683
 
22684
- /***/ 5566:
22684
+ /***/ 9435:
22685
22685
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
22686
22686
 
22687
22687
  /* eslint no-underscore-dangle: ["error", { "allow": ["__statusCode", "_remoteAddress", "__headers", "_logging"] }] */
22688
22688
 
22689
- const levels = __nccwpck_require__(1801);
22689
+ const levels = __nccwpck_require__(4985);
22690
22690
 
22691
22691
  const DEFAULT_FORMAT =
22692
22692
  ':remote-addr - -' +
@@ -23011,7 +23011,7 @@ module.exports = function getLogger(logger4js, options) {
23011
23011
 
23012
23012
  /***/ }),
23013
23013
 
23014
- /***/ 243:
23014
+ /***/ 8061:
23015
23015
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
23016
23016
 
23017
23017
  const dateFormat = __nccwpck_require__(2149);
@@ -23117,6 +23117,8 @@ function dummyLayout(loggingEvent) {
23117
23117
  * - %c log category
23118
23118
  * - %h hostname
23119
23119
  * - %m log data
23120
+ * - %m{l} where l is an integer, log data.slice(l)
23121
+ * - %m{l,u} where l and u are integers, log data.slice(l, u)
23120
23122
  * - %d date in constious formats
23121
23123
  * - %% %
23122
23124
  * - %n newline
@@ -23226,8 +23228,13 @@ function patternLayout(pattern, tokens) {
23226
23228
  return os.hostname().toString();
23227
23229
  }
23228
23230
 
23229
- function formatMessage(loggingEvent) {
23230
- return util.format(...loggingEvent.data);
23231
+ function formatMessage(loggingEvent, specifier) {
23232
+ let dataSlice = loggingEvent.data;
23233
+ if (specifier) {
23234
+ const [lowerBound, upperBound] = specifier.split(',');
23235
+ dataSlice = dataSlice.slice(lowerBound, upperBound);
23236
+ }
23237
+ return util.format(...dataSlice);
23231
23238
  }
23232
23239
 
23233
23240
  function endOfLine() {
@@ -23497,10 +23504,10 @@ module.exports = {
23497
23504
 
23498
23505
  /***/ }),
23499
23506
 
23500
- /***/ 1801:
23507
+ /***/ 4985:
23501
23508
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
23502
23509
 
23503
- const configuration = __nccwpck_require__(601);
23510
+ const configuration = __nccwpck_require__(3845);
23504
23511
 
23505
23512
  const validColours = [
23506
23513
  'white',
@@ -23659,7 +23666,7 @@ module.exports = Level;
23659
23666
 
23660
23667
  /***/ }),
23661
23668
 
23662
- /***/ 8152:
23669
+ /***/ 391:
23663
23670
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
23664
23671
 
23665
23672
  /**
@@ -23685,15 +23692,15 @@ module.exports = Level;
23685
23692
  const debug = __nccwpck_require__(5299)('log4js:main');
23686
23693
  const fs = __nccwpck_require__(7147);
23687
23694
  const deepClone = __nccwpck_require__(6121)({ proto: true });
23688
- const configuration = __nccwpck_require__(601);
23689
- const layouts = __nccwpck_require__(243);
23690
- const levels = __nccwpck_require__(1801);
23691
- const appenders = __nccwpck_require__(8852);
23692
- const categories = __nccwpck_require__(2826);
23693
- const Logger = __nccwpck_require__(8170);
23694
- const clustering = __nccwpck_require__(4173);
23695
- const connectLogger = __nccwpck_require__(5566);
23696
- const recordingModule = __nccwpck_require__(36);
23695
+ const configuration = __nccwpck_require__(3845);
23696
+ const layouts = __nccwpck_require__(8061);
23697
+ const levels = __nccwpck_require__(4985);
23698
+ const appenders = __nccwpck_require__(3447);
23699
+ const categories = __nccwpck_require__(232);
23700
+ const Logger = __nccwpck_require__(1847);
23701
+ const clustering = __nccwpck_require__(5422);
23702
+ const connectLogger = __nccwpck_require__(9435);
23703
+ const recordingModule = __nccwpck_require__(3569);
23697
23704
 
23698
23705
  let enabled = false;
23699
23706
 
@@ -23743,6 +23750,10 @@ function configure(configurationFileOrObject) {
23743
23750
  return log4js;
23744
23751
  }
23745
23752
 
23753
+ function isConfigured() {
23754
+ return enabled;
23755
+ }
23756
+
23746
23757
  function recording() {
23747
23758
  return recordingModule;
23748
23759
  }
@@ -23835,6 +23846,7 @@ function getLogger(category) {
23835
23846
  const log4js = {
23836
23847
  getLogger,
23837
23848
  configure,
23849
+ isConfigured,
23838
23850
  shutdown,
23839
23851
  connectLogger,
23840
23852
  levels,
@@ -23847,19 +23859,19 @@ module.exports = log4js;
23847
23859
 
23848
23860
  /***/ }),
23849
23861
 
23850
- /***/ 8170:
23862
+ /***/ 1847:
23851
23863
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
23852
23864
 
23853
23865
  /* eslint no-underscore-dangle: ["error", { "allow": ["_log"] }] */
23854
23866
 
23855
23867
  const debug = __nccwpck_require__(5299)('log4js:logger');
23856
- const LoggingEvent = __nccwpck_require__(8987);
23857
- const levels = __nccwpck_require__(1801);
23858
- const clustering = __nccwpck_require__(4173);
23859
- const categories = __nccwpck_require__(2826);
23860
- const configuration = __nccwpck_require__(601);
23868
+ const LoggingEvent = __nccwpck_require__(1796);
23869
+ const levels = __nccwpck_require__(4985);
23870
+ const clustering = __nccwpck_require__(5422);
23871
+ const categories = __nccwpck_require__(232);
23872
+ const configuration = __nccwpck_require__(3845);
23861
23873
 
23862
- const stackReg = /at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;
23874
+ const stackReg = /^(?:\s*) at (?:(.+) \()?(?:([^(]+?):(\d+):(\d+))\)?$/;
23863
23875
  /**
23864
23876
  * The top entry is the Error
23865
23877
  */
@@ -23888,7 +23900,7 @@ function defaultParseCallStack(
23888
23900
  }
23889
23901
  const lineMatch = stackReg.exec(stacklines[0]);
23890
23902
  /* istanbul ignore else: failsafe */
23891
- if (lineMatch && lineMatch.length === 6) {
23903
+ if (lineMatch && lineMatch.length === 5) {
23892
23904
  // extract class, function and alias names
23893
23905
  let className = '';
23894
23906
  let functionName = '';
@@ -24699,20 +24711,20 @@ function populateMaps (extensions, types) {
24699
24711
 
24700
24712
  /***/ }),
24701
24713
 
24702
- /***/ 4581:
24714
+ /***/ 4907:
24703
24715
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
24704
24716
 
24705
- var moment = module.exports = __nccwpck_require__(5281);
24706
- moment.tz.load(__nccwpck_require__(5257));
24717
+ var moment = module.exports = __nccwpck_require__(4168);
24718
+ moment.tz.load(__nccwpck_require__(6630));
24707
24719
 
24708
24720
 
24709
24721
  /***/ }),
24710
24722
 
24711
- /***/ 5281:
24723
+ /***/ 4168:
24712
24724
  /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {
24713
24725
 
24714
24726
  //! moment-timezone.js
24715
- //! version : 0.5.40
24727
+ //! version : 0.5.41
24716
24728
  //! Copyright (c) JS Foundation and other contributors
24717
24729
  //! license : MIT
24718
24730
  //! github.com/moment/moment-timezone
@@ -24742,7 +24754,7 @@ moment.tz.load(__nccwpck_require__(5257));
24742
24754
  // return moment;
24743
24755
  // }
24744
24756
 
24745
- var VERSION = "0.5.40",
24757
+ var VERSION = "0.5.41",
24746
24758
  zones = {},
24747
24759
  links = {},
24748
24760
  countries = {},
@@ -34572,7 +34584,7 @@ function pathToRegexp (path, keys, options) {
34572
34584
 
34573
34585
  /***/ }),
34574
34586
 
34575
- /***/ 5077:
34587
+ /***/ 6680:
34576
34588
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
34577
34589
 
34578
34590
  "use strict";
@@ -34647,6 +34659,13 @@ function getRawBody (stream, options, callback) {
34647
34659
  var done = callback
34648
34660
  var opts = options || {}
34649
34661
 
34662
+ // light validation
34663
+ if (stream === undefined) {
34664
+ throw new TypeError('argument stream is required')
34665
+ } else if (typeof stream !== 'object' || stream === null || typeof stream.on !== 'function') {
34666
+ throw new TypeError('argument stream must be a stream')
34667
+ }
34668
+
34650
34669
  if (options === true || typeof options === 'string') {
34651
34670
  // short cut for encoding
34652
34671
  opts = {
@@ -44414,7 +44433,7 @@ module.exports = function load(appPath, modules) {
44414
44433
  /***/ 8840:
44415
44434
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
44416
44435
 
44417
- const log4js = __nccwpck_require__(8152);
44436
+ const log4js = __nccwpck_require__(391);
44418
44437
  const _logger = Symbol('_logger');
44419
44438
 
44420
44439
  module.exports = class {
@@ -44890,7 +44909,7 @@ module.exports = function(opts = {}) {
44890
44909
  /***/ 776:
44891
44910
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
44892
44911
 
44893
- const raw = __nccwpck_require__(5077);
44912
+ const raw = __nccwpck_require__(6680);
44894
44913
  const inflate = __nccwpck_require__(4027);
44895
44914
  const qs = __nccwpck_require__(3477);
44896
44915
 
@@ -44929,7 +44948,7 @@ exports.xml = __nccwpck_require__(7358);
44929
44948
  /***/ 9711:
44930
44949
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
44931
44950
 
44932
- const raw = __nccwpck_require__(5077);
44951
+ const raw = __nccwpck_require__(6680);
44933
44952
  const inflate = __nccwpck_require__(4027);
44934
44953
 
44935
44954
  module.exports = function(ctx, opts = {}) {
@@ -45006,7 +45025,7 @@ module.exports = (ctx, opts = {}) => {
45006
45025
  /***/ 5667:
45007
45026
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
45008
45027
 
45009
- const raw = __nccwpck_require__(5077);
45028
+ const raw = __nccwpck_require__(6680);
45010
45029
  const inflate = __nccwpck_require__(4027);
45011
45030
 
45012
45031
  module.exports = function(ctx, opts = {}) {
@@ -58408,7 +58427,7 @@ module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"
58408
58427
 
58409
58428
  /***/ }),
58410
58429
 
58411
- /***/ 5257:
58430
+ /***/ 6630:
58412
58431
  /***/ ((module) => {
58413
58432
 
58414
58433
  "use strict";
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/vercel",
3
- "version": "1.26.3-deta-alpha.0",
3
+ "version": "1.26.4-deta",
4
4
  "description": "vercel server for waline comment system",
5
5
  "keywords": [
6
6
  "waline",
@@ -19,7 +19,7 @@
19
19
  "@koa/cors": "4.0.0",
20
20
  "akismet": "2.0.7",
21
21
  "deta": "1.1.0",
22
- "dompurify": "3.0.0",
22
+ "dompurify": "3.0.1",
23
23
  "dy-node-ip2region": "1.0.1",
24
24
  "fast-csv": "4.3.6",
25
25
  "form-data": "4.0.0",
@@ -46,9 +46,10 @@
46
46
  "think-model-postgresql": "1.1.7",
47
47
  "think-mongo": "2.2.1",
48
48
  "think-router-rest": "1.0.5",
49
+ "thinkjs": "3.2.14",
49
50
  "ua-parser-js": "1.0.33"
50
51
  },
51
52
  "engines": {
52
53
  "node": ">=14"
53
54
  }
54
- }
55
+ }
@@ -1,4 +1,3 @@
1
- const parser = require('ua-parser-js');
2
1
  const BaseRest = require('./rest');
3
2
  const akismet = require('../service/akismet');
4
3
  const { getMarkdownParser } = require('../service/markdown');
@@ -11,7 +10,7 @@ async function formatCmt(
11
10
  { avatarProxy },
12
11
  loginUser
13
12
  ) {
14
- ua = parser(ua);
13
+ ua = think.uaParser(ua);
15
14
  if (!think.config('disableUserAgent')) {
16
15
  comment.browser = `${ua.browser.name || ''}${(ua.browser.version || '')
17
16
  .split('.')
@@ -1,9 +1,16 @@
1
+ const parser = require('ua-parser-js');
1
2
  const ip2region = require('dy-node-ip2region');
2
3
  const helper = require('think-helper');
3
4
  const preventMessage = 'PREVENT_NEXT_PROCESS';
4
5
 
5
6
  const regionSearch = ip2region.create(process.env.IP2REGION_DB);
6
7
 
8
+ const OS_VERSION_MAP = {
9
+ 'Windows': {
10
+ 'NT 11.0': '11',
11
+ },
12
+ };
13
+
7
14
  module.exports = {
8
15
  prevent() {
9
16
  throw new Error(preventMessage);
@@ -81,4 +88,16 @@ module.exports = {
81
88
  return '';
82
89
  }
83
90
  },
91
+ uaParser(uaText) {
92
+ const ua = parser(uaText);
93
+
94
+ if (
95
+ OS_VERSION_MAP[ua.os.name] &&
96
+ OS_VERSION_MAP[ua.os.name][ua.os.version]
97
+ ) {
98
+ ua.os.version = OS_VERSION_MAP[ua.os.name][ua.os.version];
99
+ }
100
+
101
+ return ua;
102
+ },
84
103
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/vercel",
3
- "version": "1.26.4",
3
+ "version": "1.26.5",
4
4
  "description": "vercel server for waline comment system",
5
5
  "keywords": [
6
6
  "waline",
@@ -8,6 +8,9 @@
8
8
  "comment",
9
9
  "blog"
10
10
  ],
11
+ "scripts": {
12
+ "postpublish": "sh ./deta.build.sh"
13
+ },
11
14
  "repository": {
12
15
  "url": "https://github.com/walinejs/waline",
13
16
  "directory": "packages/server"
@@ -19,11 +22,11 @@
19
22
  "@koa/cors": "4.0.0",
20
23
  "akismet": "2.0.7",
21
24
  "deta": "1.1.0",
22
- "dompurify": "3.0.0",
25
+ "dompurify": "3.0.1",
23
26
  "dy-node-ip2region": "1.0.1",
24
27
  "fast-csv": "4.3.6",
25
28
  "form-data": "4.0.0",
26
- "jsdom": "21.1.0",
29
+ "jsdom": "21.1.1",
27
30
  "jsonwebtoken": "9.0.0",
28
31
  "katex": "0.16.4",
29
32
  "leancloud-storage": "4.14.0",
@@ -48,7 +51,7 @@
48
51
  "think-mongo": "2.2.1",
49
52
  "think-router-rest": "1.0.5",
50
53
  "thinkjs": "3.2.14",
51
- "ua-parser-js": "1.0.33"
54
+ "ua-parser-js": "1.0.34"
52
55
  },
53
56
  "engines": {
54
57
  "node": ">=14"
@@ -6,7 +6,7 @@ const preventMessage = 'PREVENT_NEXT_PROCESS';
6
6
  const regionSearch = ip2region.create(process.env.IP2REGION_DB);
7
7
 
8
8
  const OS_VERSION_MAP = {
9
- 'Windows': {
9
+ Windows: {
10
10
  'NT 11.0': '11',
11
11
  },
12
12
  };
@@ -5,13 +5,13 @@ const DOMPurify = createDOMPurify(new JSDOM('').window);
5
5
 
6
6
  /**
7
7
  * Add a hook to make all links open a new window
8
- * and force their rel to be 'noreferrer noopener'
8
+ * and force their rel to be 'nofollow noreferrer noopener'
9
9
  */
10
10
  DOMPurify.addHook('afterSanitizeAttributes', function (node) {
11
11
  // set all elements owning target to target=_blank
12
12
  if ('target' in node && node.href && !node.href.startsWith('about:blank#')) {
13
13
  node.setAttribute('target', '_blank');
14
- node.setAttribute('rel', 'noreferrer noopener');
14
+ node.setAttribute('rel', 'nofollow noreferrer noopener');
15
15
  }
16
16
 
17
17
  // set non-HTML/MathML links to xlink:show=new