@modern-js/plugin-server 2.42.2 → 2.43.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/cli.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var cli_exports = {};
30
20
  __export(cli_exports, {
@@ -32,46 +22,9 @@ __export(cli_exports, {
32
22
  serverPlugin: () => serverPlugin
33
23
  });
34
24
  module.exports = __toCommonJS(cli_exports);
35
- var import_fs = __toESM(require("fs"));
36
- var import_path = __toESM(require("path"));
37
- var import_server_utils = require("@modern-js/server-utils");
38
- var import_utils = require("@modern-js/utils");
39
- const TS_CONFIG_FILENAME = "tsconfig.json";
40
25
  const serverPlugin = () => ({
41
26
  name: "@modern-js/plugin-server",
42
- setup: (api) => ({
43
- config() {
44
- return {};
45
- },
46
- async afterBuild() {
47
- const { appDirectory, distDirectory } = api.useAppContext();
48
- const modernConfig = api.useResolvedConfigContext();
49
- const distDir = import_path.default.resolve(distDirectory);
50
- const serverDir = import_path.default.resolve(appDirectory, import_utils.SERVER_DIR);
51
- const sharedDir = import_path.default.resolve(appDirectory, import_utils.SHARED_DIR);
52
- const tsconfigPath = import_path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
53
- const sourceDirs = [];
54
- if (import_fs.default.existsSync(serverDir)) {
55
- sourceDirs.push(serverDir);
56
- }
57
- if (import_fs.default.existsSync(sharedDir)) {
58
- sourceDirs.push(sharedDir);
59
- }
60
- const { server } = modernConfig;
61
- const { alias } = modernConfig.source;
62
- const { babel } = modernConfig.tools;
63
- if (sourceDirs.length > 0) {
64
- await (0, import_server_utils.compile)(appDirectory, {
65
- server,
66
- alias,
67
- babelConfig: babel
68
- }, {
69
- sourceDirs,
70
- distDir,
71
- tsconfigPath
72
- });
73
- }
74
- },
27
+ setup: (_) => ({
75
28
  collectServerPlugins({ plugins }) {
76
29
  plugins.push({
77
30
  "@modern-js/plugin-server": "@modern-js/plugin-server/server"
package/dist/esm/cli.js CHANGED
@@ -1,68 +1,8 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
- import fs from "fs";
4
- import path from "path";
5
- import { compile } from "@modern-js/server-utils";
6
- import { SHARED_DIR, SERVER_DIR } from "@modern-js/utils";
7
- var TS_CONFIG_FILENAME = "tsconfig.json";
8
1
  var serverPlugin = function() {
9
2
  return {
10
3
  name: "@modern-js/plugin-server",
11
- setup: function(api) {
4
+ setup: function(_) {
12
5
  return {
13
- config: function config() {
14
- return {};
15
- },
16
- afterBuild: function afterBuild() {
17
- return _async_to_generator(function() {
18
- var _api_useAppContext, appDirectory, distDirectory, modernConfig, distDir, serverDir, sharedDir, tsconfigPath, sourceDirs, server, alias, babel;
19
- return _ts_generator(this, function(_state) {
20
- switch (_state.label) {
21
- case 0:
22
- _api_useAppContext = api.useAppContext(), appDirectory = _api_useAppContext.appDirectory, distDirectory = _api_useAppContext.distDirectory;
23
- modernConfig = api.useResolvedConfigContext();
24
- distDir = path.resolve(distDirectory);
25
- serverDir = path.resolve(appDirectory, SERVER_DIR);
26
- sharedDir = path.resolve(appDirectory, SHARED_DIR);
27
- tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
28
- sourceDirs = [];
29
- if (fs.existsSync(serverDir)) {
30
- sourceDirs.push(serverDir);
31
- }
32
- if (fs.existsSync(sharedDir)) {
33
- sourceDirs.push(sharedDir);
34
- }
35
- server = modernConfig.server;
36
- alias = modernConfig.source.alias;
37
- babel = modernConfig.tools.babel;
38
- if (!(sourceDirs.length > 0))
39
- return [
40
- 3,
41
- 2
42
- ];
43
- return [
44
- 4,
45
- compile(appDirectory, {
46
- server,
47
- alias,
48
- babelConfig: babel
49
- }, {
50
- sourceDirs,
51
- distDir,
52
- tsconfigPath
53
- })
54
- ];
55
- case 1:
56
- _state.sent();
57
- _state.label = 2;
58
- case 2:
59
- return [
60
- 2
61
- ];
62
- }
63
- });
64
- })();
65
- },
66
6
  collectServerPlugins: function collectServerPlugins(param) {
67
7
  var plugins = param.plugins;
68
8
  plugins.push({
@@ -1,43 +1,6 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import { compile } from "@modern-js/server-utils";
4
- import { SHARED_DIR, SERVER_DIR } from "@modern-js/utils";
5
- const TS_CONFIG_FILENAME = "tsconfig.json";
6
1
  const serverPlugin = () => ({
7
2
  name: "@modern-js/plugin-server",
8
- setup: (api) => ({
9
- config() {
10
- return {};
11
- },
12
- async afterBuild() {
13
- const { appDirectory, distDirectory } = api.useAppContext();
14
- const modernConfig = api.useResolvedConfigContext();
15
- const distDir = path.resolve(distDirectory);
16
- const serverDir = path.resolve(appDirectory, SERVER_DIR);
17
- const sharedDir = path.resolve(appDirectory, SHARED_DIR);
18
- const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
19
- const sourceDirs = [];
20
- if (fs.existsSync(serverDir)) {
21
- sourceDirs.push(serverDir);
22
- }
23
- if (fs.existsSync(sharedDir)) {
24
- sourceDirs.push(sharedDir);
25
- }
26
- const { server } = modernConfig;
27
- const { alias } = modernConfig.source;
28
- const { babel } = modernConfig.tools;
29
- if (sourceDirs.length > 0) {
30
- await compile(appDirectory, {
31
- server,
32
- alias,
33
- babelConfig: babel
34
- }, {
35
- sourceDirs,
36
- distDir,
37
- tsconfigPath
38
- });
39
- }
40
- },
3
+ setup: (_) => ({
41
4
  collectServerPlugins({ plugins }) {
42
5
  plugins.push({
43
6
  "@modern-js/plugin-server": "@modern-js/plugin-server/server"
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.42.2",
18
+ "version": "2.43.0",
19
19
  "types": "./dist/types/cli.d.ts",
20
20
  "jsnext:source": "./src/cli",
21
21
  "main": "./dist/cjs/cli.js",
@@ -51,20 +51,19 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@swc/helpers": "0.5.3",
54
- "@modern-js/server-utils": "2.42.2",
55
- "@modern-js/utils": "2.42.2"
54
+ "@modern-js/utils": "2.43.0"
56
55
  },
57
56
  "devDependencies": {
58
57
  "typescript": "^5",
59
58
  "@types/jest": "^29",
60
59
  "@types/node": "^14",
61
60
  "jest": "^29",
62
- "@modern-js/server-core": "2.42.2",
63
- "@modern-js/app-tools": "2.42.2",
64
- "@modern-js/core": "2.42.2",
65
- "@scripts/build": "2.42.2",
66
- "@modern-js/types": "2.42.2",
67
- "@scripts/jest-config": "2.42.2"
61
+ "@modern-js/app-tools": "2.43.0",
62
+ "@modern-js/core": "2.43.0",
63
+ "@modern-js/server-core": "2.43.0",
64
+ "@scripts/build": "2.43.0",
65
+ "@modern-js/types": "2.43.0",
66
+ "@scripts/jest-config": "2.43.0"
68
67
  },
69
68
  "sideEffects": [
70
69
  "*.css",