@jayfong/x-server 2.89.0 → 2.91.0

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.
File without changes
@@ -25,14 +25,14 @@ class DeployUtil {
25
25
  const appDir = `./${appName}`;
26
26
  await ssh.execCommand((0, _vtils.dedent)`
27
27
  set -ex
28
- mkdir -p ./app_files/${appName}
28
+ mkdir -p ./app_files/${appName}/${options.channel || 'dist'}
29
29
  mkdir -p ${appDir}
30
30
  `, {
31
31
  cwd: options.dir,
32
32
  onStdout: buf => console.log(buf.toString()),
33
33
  onStderr: buf => console.log(buf.toString())
34
34
  });
35
- const remoteAppFile = `${options.dir}/app_files/${appName}/${_path.default.basename(appFile)}`;
35
+ const remoteAppFile = `${options.dir}/app_files/${appName}/${options.channel || 'dist'}/${_path.default.basename(appFile)}`;
36
36
  await ssh.putFile(appFile, remoteAppFile);
37
37
  await ssh.execCommand((0, _vtils.dedent)`
38
38
  set -ex
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.HtmlService = void 0;
5
+ var _fastEscapeHtml = require("fast-escape-html");
6
+ class HtmlService {
7
+ constructor() {
8
+ this.serviceName = 'html';
9
+ }
10
+ escape(html) {
11
+ return (0, _fastEscapeHtml.escapeHTML)(html);
12
+ }
13
+ unescape(html) {
14
+ return (0, _fastEscapeHtml.unescapeHTML)(html);
15
+ }
16
+ }
17
+ exports.HtmlService = HtmlService;
package/lib/_cjs/x.js CHANGED
@@ -11,6 +11,7 @@ var _crypto = require("./services/crypto");
11
11
  var _db_value = require("./services/db_value");
12
12
  var _dispose = require("./services/dispose");
13
13
  var _emoji = require("./services/emoji");
14
+ var _html = require("./services/html");
14
15
  var _log = require("./services/log");
15
16
  const env = JSON.parse(process.env.X_SERVER_ENVS || '{}');
16
17
  const x = exports.x = {
@@ -30,4 +31,4 @@ const x = exports.x = {
30
31
  _fsExtra.default.ensureDirSync(x.dataDir);
31
32
  x.register(new _dispose.DisposeService({
32
33
  disposeOnExit: true
33
- }), new _log.LogService(), new _emoji.EmojiService(), new _db_value.DbValueService(), new _crypto.CryptoService());
34
+ }), new _log.LogService(), new _emoji.EmojiService(), new _db_value.DbValueService(), new _crypto.CryptoService(), new _html.HtmlService());
@@ -20,14 +20,14 @@ export class DeployUtil {
20
20
  const appDir = `./${appName}`;
21
21
  await ssh.execCommand(dedent`
22
22
  set -ex
23
- mkdir -p ./app_files/${appName}
23
+ mkdir -p ./app_files/${appName}/${options.channel || 'dist'}
24
24
  mkdir -p ${appDir}
25
25
  `, {
26
26
  cwd: options.dir,
27
27
  onStdout: buf => console.log(buf.toString()),
28
28
  onStderr: buf => console.log(buf.toString())
29
29
  });
30
- const remoteAppFile = `${options.dir}/app_files/${appName}/${path.basename(appFile)}`;
30
+ const remoteAppFile = `${options.dir}/app_files/${appName}/${options.channel || 'dist'}/${path.basename(appFile)}`;
31
31
  await ssh.putFile(appFile, remoteAppFile);
32
32
  await ssh.execCommand(dedent`
33
33
  set -ex
@@ -0,0 +1,11 @@
1
+ import { BaseService } from './base';
2
+ export declare class HtmlService implements BaseService {
3
+ serviceName: string;
4
+ escape(html: string): string;
5
+ unescape(html: string): string;
6
+ }
7
+ declare module '../x' {
8
+ interface X {
9
+ html: HtmlService;
10
+ }
11
+ }
@@ -0,0 +1,12 @@
1
+ import { escapeHTML, unescapeHTML } from 'fast-escape-html';
2
+ export class HtmlService {
3
+ constructor() {
4
+ this.serviceName = 'html';
5
+ }
6
+ escape(html) {
7
+ return escapeHTML(html);
8
+ }
9
+ unescape(html) {
10
+ return unescapeHTML(html);
11
+ }
12
+ }
package/lib/x.d.ts CHANGED
@@ -4,6 +4,7 @@ import './services/crypto';
4
4
  import './services/db_value';
5
5
  import './services/dispose';
6
6
  import './services/emoji';
7
+ import './services/html';
7
8
  import './services/log';
8
9
  export interface X {
9
10
  readonly appId: string;
package/lib/x.js CHANGED
@@ -6,6 +6,7 @@ import { CryptoService } from "./services/crypto";
6
6
  import { DbValueService } from "./services/db_value";
7
7
  import { DisposeService } from "./services/dispose";
8
8
  import { EmojiService } from "./services/emoji";
9
+ import { HtmlService } from "./services/html";
9
10
  import { LogService } from "./services/log";
10
11
  const env = JSON.parse(process.env.X_SERVER_ENVS || '{}');
11
12
  export const x = {
@@ -25,4 +26,4 @@ export const x = {
25
26
  fs.ensureDirSync(x.dataDir);
26
27
  x.register(new DisposeService({
27
28
  disposeOnExit: true
28
- }), new LogService(), new EmojiService(), new DbValueService(), new CryptoService());
29
+ }), new LogService(), new EmojiService(), new DbValueService(), new CryptoService(), new HtmlService());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.89.0",
3
+ "version": "2.91.0",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",
@@ -9,7 +9,9 @@
9
9
  "bin": {
10
10
  "xs": "lib/_cjs/cli/cli.js"
11
11
  },
12
- "files": ["lib"],
12
+ "files": [
13
+ "lib"
14
+ ],
13
15
  "scripts": {
14
16
  "build": "haoma compile",
15
17
  "build_test_pkg": "tyn build && rm -rf ./lib_test && mkdir -p ./lib_test && cp -r ./lib ./lib_test/lib && cp ./package.json ./lib_test/package.json && cd ./tests/app && tyn add file:../../lib_test",
@@ -44,6 +46,7 @@
44
46
  "esbuild-register": "^3.5.0",
45
47
  "execa": "^5.1.1",
46
48
  "exit-hook": "^2.2.1",
49
+ "fast-escape-html": "^1.1.0",
47
50
  "fast-xml-parser": "^4.2.5",
48
51
  "fastify": "^4.19.2",
49
52
  "fs-extra": "^10.0.1",