@infomaximum/package-cli 1.4.0-rc3 → 1.4.0-rc4

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.
@@ -3,11 +3,11 @@ import CopyWebpackPlugin from "copy-webpack-plugin";
3
3
  import { archiveExt, buildWidgetConfigName, widgetArchiveName, } from "./common.js";
4
4
  import path from "path";
5
5
  import { JsonModifyWebpackPlugin } from "@infomaximum/json-modify-webpack-plugin";
6
- import { require } from "../../utils.js";
6
+ import { systemRequire } from "../../utils.js";
7
7
  const packageFilename = "main";
8
8
  export const getPackageConfig = (mode, PATHS) => {
9
- const widgetVersion = require(PATHS.appPackageJson).version;
10
- const manifestPackageName = require(PATHS.packageManifest).name;
9
+ const widgetVersion = systemRequire(PATHS.appPackageJson).version;
10
+ const manifestPackageName = systemRequire(PATHS.packageManifest).name;
11
11
  return {
12
12
  mode,
13
13
  name: "package",
@@ -6,7 +6,7 @@ import TerserWebpackPlugin from "terser-webpack-plugin";
6
6
  import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
7
7
  import { JsonModifyWebpackPlugin } from "@infomaximum/json-modify-webpack-plugin";
8
8
  import webpack, {} from "webpack";
9
- import { require } from "../../utils.js";
9
+ import { systemRequire } from "../../utils.js";
10
10
  const { ProgressPlugin } = webpack;
11
11
  const isProduction = (mode) => mode === "production";
12
12
  const isDevelopment = (mode) => mode === "development";
@@ -22,7 +22,7 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
22
22
  entry: [PATHS.moduleIndex, PATHS.manifestJson],
23
23
  output: {
24
24
  path: PATHS.appBuild,
25
- filename: require(PATHS.manifestJson).entry,
25
+ filename: systemRequire(PATHS.manifestJson).entry,
26
26
  asyncChunks: false,
27
27
  clean: true,
28
28
  },
@@ -60,25 +60,29 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
60
60
  {
61
61
  test: /\.(ts|tsx)$/i,
62
62
  exclude: ["/node_modules/"],
63
- loader: "babel-loader",
63
+ loader: systemRequire.resolve("babel-loader"),
64
64
  options: {
65
65
  plugins: [
66
- "babel-plugin-inline-json-import",
67
- "@babel/plugin-transform-runtime",
68
- !isProduction(mode) && "react-refresh/babel",
66
+ systemRequire.resolve("babel-plugin-inline-json-import"),
67
+ systemRequire.resolve("@babel/plugin-transform-runtime"),
68
+ !isProduction(mode) &&
69
+ systemRequire.resolve("react-refresh/babel"),
69
70
  ].filter(Boolean),
70
71
  },
71
72
  },
72
73
  {
73
74
  test: /\.css$/i,
74
75
  use: [
75
- "style-loader",
76
- "css-loader",
76
+ systemRequire.resolve("style-loader"),
77
+ systemRequire.resolve("css-loader"),
77
78
  {
78
- loader: "postcss-loader",
79
+ loader: systemRequire.resolve("postcss-loader"),
79
80
  options: {
80
81
  postcssOptions: {
81
- plugins: ["postcss-preset-env", "autoprefixer"],
82
+ plugins: [
83
+ systemRequire.resolve("postcss-preset-env"),
84
+ systemRequire.resolve("autoprefixer"),
85
+ ],
82
86
  },
83
87
  },
84
88
  },
@@ -87,20 +91,23 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
87
91
  {
88
92
  test: /\.s[ac]ss$/i,
89
93
  use: [
90
- "style-loader",
91
- "css-loader",
94
+ systemRequire.resolve("style-loader"),
95
+ systemRequire.resolve("css-loader"),
92
96
  {
93
- loader: "postcss-loader",
97
+ loader: systemRequire.resolve("postcss-loader"),
94
98
  options: {
95
99
  postcssOptions: {
96
- plugins: ["postcss-preset-env", "autoprefixer"],
100
+ plugins: [
101
+ systemRequire.resolve("postcss-preset-env"),
102
+ systemRequire.resolve("autoprefixer"),
103
+ ],
97
104
  },
98
105
  },
99
106
  },
100
107
  {
101
- loader: "sass-loader",
108
+ loader: systemRequire.resolve("sass-loader"),
102
109
  options: {
103
- implementation: "sass",
110
+ implementation: systemRequire("sass"),
104
111
  sassOptions: {
105
112
  fiber: false,
106
113
  },
@@ -111,18 +118,21 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
111
118
  {
112
119
  test: /\.less$/i,
113
120
  use: [
114
- "style-loader",
115
- "css-loader",
121
+ systemRequire.resolve("style-loader"),
122
+ systemRequire.resolve("css-loader"),
116
123
  {
117
- loader: "postcss-loader",
124
+ loader: systemRequire.resolve("postcss-loader"),
118
125
  options: {
119
126
  postcssOptions: {
120
- plugins: ["postcss-preset-env", "autoprefixer"],
127
+ plugins: [
128
+ systemRequire.resolve("postcss-preset-env"),
129
+ systemRequire.resolve("autoprefixer"),
130
+ ],
121
131
  },
122
132
  },
123
133
  },
124
134
  {
125
- loader: "less-loader",
135
+ loader: systemRequire.resolve("less-loader"),
126
136
  options: {
127
137
  sourceMap: isDevelopment(mode),
128
138
  lessOptions: {
@@ -160,7 +170,7 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
160
170
  },
161
171
  {
162
172
  issuer: /\.[jt]sx?$/,
163
- loader: "@svgr/webpack",
173
+ loader: systemRequire.resolve("@svgr/webpack"),
164
174
  options: {
165
175
  svgoConfig: {
166
176
  plugins: [
@@ -190,7 +200,7 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
190
200
  }
191
201
  : undefined,
192
202
  resolve: {
193
- extensions: [".tsx", ".ts", ""],
203
+ extensions: [".tsx", ".ts", ".js"],
194
204
  plugins: [new TsconfigPathsPlugin()],
195
205
  },
196
206
  devtool: isProduction(mode) ? false : "cheap-module-source-map",
package/dist/paths.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
- import { require } from "./utils.js";
3
+ import { systemRequire } from "./utils.js";
4
4
  const appDirectory = fs.realpathSync(process.cwd());
5
5
  const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath);
6
6
  const moduleFileExtensions = [
@@ -51,7 +51,7 @@ export const generateIndexPath = (entryPath) => {
51
51
  return entryPath;
52
52
  }
53
53
  try {
54
- const mainIndexPath = path.resolve(process.cwd(), (_a = require(resolveApp("package.json"))) === null || _a === void 0 ? void 0 : _a.main);
54
+ const mainIndexPath = path.resolve(process.cwd(), (_a = systemRequire(resolveApp("package.json"))) === null || _a === void 0 ? void 0 : _a.main);
55
55
  if (mainIndexPath && fs.existsSync(mainIndexPath)) {
56
56
  return mainIndexPath;
57
57
  }
package/dist/utils.js CHANGED
@@ -4,7 +4,7 @@ import path from "node:path";
4
4
  import https from "node:https";
5
5
  import { spawn } from "node:child_process";
6
6
  import Module from "node:module";
7
- export const require = Module.createRequire(import.meta.url);
7
+ export const systemRequire = Module.createRequire(import.meta.url);
8
8
  export function capitalizeFirstLetter(str = "") {
9
9
  return str.charAt(0).toUpperCase() + str.slice(1);
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/package-cli",
3
- "version": "1.4.0-rc3",
3
+ "version": "1.4.0-rc4",
4
4
  "exports": "./dist/index.js",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",