@waline/vercel 1.18.0 → 1.18.3

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/.eslintrc.yml CHANGED
@@ -1,2 +1,9 @@
1
1
  globals:
2
2
  think: readonly
3
+
4
+ overrides:
5
+ - files:
6
+ - '__tests__/**/*.spec.js'
7
+
8
+ parserOptions:
9
+ sourceType: module
@@ -1,6 +1,6 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Vitest Snapshot v1
2
2
 
3
- exports[`XSS test Should render 1`] = `
3
+ exports[`XSS test > Should render 1`] = `
4
4
  "<p>Waline is a good framework. :money:</p>
5
5
  <h2>特性</h2>
6
6
  <ul>
@@ -1,5 +1,7 @@
1
- const MarkdownIt = require('markdown-it');
2
- const { katexPlugin } = require('../src/service/markdown/katex');
1
+ import { describe, expect, it } from 'vitest';
2
+ import MarkdownIt from 'markdown-it';
3
+ import { katexPlugin } from '../src/service/markdown/katex';
4
+ import { vi } from 'vitest';
3
5
 
4
6
  const markdownIt = MarkdownIt({ linkify: true }).use(katexPlugin, {
5
7
  output: 'mathml',
@@ -46,7 +48,7 @@ describe('inline katex', () => {
46
48
  it('Should render error msg when content is wrong', () => {
47
49
  // eslint-disable-next-line @typescript-eslint/unbound-method
48
50
  const originalWarn = global.console.warn;
49
- global.console.warn = jest.fn();
51
+ global.console.warn = vi.fn();
50
52
 
51
53
  expect(markdownItWithError.render('$\\fra{a}{b}$')).toEqual(
52
54
  "<p><span class='katex-error' title='ParseError: KaTeX parse error: Undefined control sequence: \\fra at position 1: \\̲f̲r̲a̲{a}{b}'>\\fra{a}{b}</span></p>\n"
@@ -117,7 +119,7 @@ $$
117
119
  it('Should render error msg when content is wrong', () => {
118
120
  // eslint-disable-next-line @typescript-eslint/unbound-method
119
121
  const originalWarn = global.console.warn;
120
- global.console.warn = jest.fn();
122
+ global.console.warn = vi.fn();
121
123
  expect(markdownItWithError.render('$$\\fra{a}{b}$$')).toMatch(
122
124
  /<p class='katex-block katex-error' title='[\s\S]*?'>[\s\S]*?<\/p>/
123
125
  );
@@ -1,5 +1,6 @@
1
- const MarkdownIt = require('markdown-it');
2
- const { mathjaxPlugin } = require('../src/service/markdown/mathjax');
1
+ import { describe, expect, it } from 'vitest';
2
+ import MarkdownIt from 'markdown-it';
3
+ import { mathjaxPlugin } from '../src/service/markdown/mathjax';
3
4
 
4
5
  const markdownIt = MarkdownIt({ linkify: true }).use(mathjaxPlugin);
5
6
 
@@ -1,5 +1,7 @@
1
- const MarkdownIt = require('markdown-it');
2
- const { sanitize } = require('../src/service/markdown/xss');
1
+ import { describe, expect, it } from 'vitest';
2
+ import MarkdownIt from 'markdown-it';
3
+ import { sanitize } from '../src/service/markdown/xss';
4
+
3
5
  const parser = (content) =>
4
6
  sanitize(new MarkdownIt({ html: true }).render(content));
5
7
 
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
- const os = require('os');
2
- const path = require('path');
1
+ const os = require('node:os');
2
+ const path = require('node:path');
3
3
  const Application = require('thinkjs');
4
4
  const Loader = require('thinkjs/lib/loader');
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/vercel",
3
- "version": "1.18.0",
3
+ "version": "1.18.3",
4
4
  "description": "vercel server for waline comment system",
5
5
  "keywords": [
6
6
  "waline",
@@ -47,5 +47,8 @@
47
47
  "think-router-rest": "^1.0.5",
48
48
  "thinkjs": "^3.2.14",
49
49
  "ua-parser-js": "^1.0.2"
50
+ },
51
+ "engines": {
52
+ "node": ">=14"
50
53
  }
51
54
  }
@@ -1,5 +1,5 @@
1
- const fs = require('fs');
2
- const util = require('util');
1
+ const fs = require('node:fs');
2
+ const util = require('node:util');
3
3
  const BaseRest = require('./rest');
4
4
 
5
5
  const readFileAsync = util.promisify(fs.readFile);
@@ -1,4 +1,4 @@
1
- const qs = require('querystring');
1
+ const qs = require('node:querystring');
2
2
  const jwt = require('jsonwebtoken');
3
3
  const { PasswordHash } = require('phpass');
4
4
  const request = require('request-promise-native');
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
 
3
3
  module.exports = class extends think.Controller {
4
4
  static get _REST() {
@@ -1,4 +1,4 @@
1
- const qs = require('querystring');
1
+ const qs = require('node:querystring');
2
2
  const { PasswordHash } = require('phpass');
3
3
  const BaseRest = require('./rest');
4
4
 
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
  const { parseString, writeToString } = require('fast-csv');
3
3
  const request = require('request-promise-native');
4
4
  const Base = require('./base');
package/vanilla.js CHANGED
@@ -1,4 +1,4 @@
1
- const path = require('path');
1
+ const path = require('node:path');
2
2
  const Application = require('thinkjs');
3
3
 
4
4
  const instance = new Application({