@elliemae/pui-cli 7.27.0-beta.1 → 8.0.0-next.1
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/dist/cjs/cli.js +14 -12
- package/dist/cjs/commands/build.js +8 -7
- package/dist/cjs/commands/codemod.js +6 -8
- package/dist/cjs/commands/gendoc.js +1 -1
- package/dist/cjs/commands/lint.js +20 -22
- package/dist/cjs/commands/pack.js +24 -19
- package/dist/cjs/commands/start.js +10 -9
- package/dist/cjs/commands/storybook.js +18 -17
- package/dist/cjs/commands/test.js +36 -30
- package/dist/cjs/commands/tscheck.js +8 -7
- package/dist/cjs/commands/utils.js +12 -7
- package/dist/cjs/commands/version.js +20 -18
- package/dist/cjs/commands/vitest.js +31 -27
- package/dist/cjs/index.cjs +0 -2
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/lint-config/eslint/common.cjs +88 -85
- package/dist/cjs/monorepo/delete-merged-tags.js +1 -1
- package/dist/cjs/monorepo/set-registry-version.js +2 -2
- package/dist/cjs/monorepo/set-workspace-version.js +2 -2
- package/dist/cjs/monorepo/utils.js +54 -0
- package/dist/cjs/release.config.cjs +0 -7
- package/dist/cjs/server/appRoutes.js +74 -0
- package/dist/cjs/server/csp.js +3 -4
- package/dist/cjs/server/index.js +13 -11
- package/dist/cjs/server/middlewares.js +7 -4
- package/dist/cjs/server/utils.js +1 -1
- package/dist/cjs/utils.js +50 -0
- package/dist/cjs/webpack/helpers.js +3 -3
- package/dist/cjs/webpack/webpack.base.babel.js +3 -10
- package/dist/cjs/webpack/webpack.dev.babel.js +12 -9
- package/dist/cjs/webpack/webpack.lib.base.babel.js +4 -5
- package/dist/cjs/webpack/webpack.lib.dev.babel.js +1 -0
- package/dist/cjs/webpack/webpack.prod.babel.js +7 -15
- package/dist/cjs/webpack/webpack.storybook.js +27 -20
- package/dist/esm/cli.js +14 -12
- package/dist/esm/commands/build.js +8 -7
- package/dist/esm/commands/codemod.js +6 -8
- package/dist/esm/commands/gendoc.js +1 -1
- package/dist/esm/commands/lint.js +26 -22
- package/dist/esm/commands/pack.js +31 -19
- package/dist/esm/commands/start.js +10 -9
- package/dist/esm/commands/storybook.js +18 -17
- package/dist/esm/commands/test.js +36 -30
- package/dist/esm/commands/tscheck.js +8 -7
- package/dist/esm/commands/utils.js +11 -6
- package/dist/esm/commands/version.js +20 -18
- package/dist/esm/commands/vitest.js +31 -27
- package/dist/esm/index.cjs +0 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/lint-config/eslint/common.cjs +88 -85
- package/dist/esm/monorepo/delete-merged-tags.js +1 -1
- package/dist/esm/monorepo/set-registry-version.js +2 -2
- package/dist/esm/monorepo/set-workspace-version.js +2 -2
- package/dist/esm/monorepo/utils.js +24 -0
- package/dist/esm/release.config.cjs +0 -7
- package/dist/{cjs/server/app-routes.cjs → esm/server/appRoutes.js} +25 -23
- package/dist/esm/server/csp.js +3 -4
- package/dist/esm/server/index.js +13 -11
- package/dist/esm/server/middlewares.js +7 -4
- package/dist/esm/server/utils.js +1 -1
- package/dist/esm/utils.js +20 -0
- package/dist/esm/webpack/helpers.js +3 -3
- package/dist/esm/webpack/webpack.base.babel.js +3 -10
- package/dist/esm/webpack/webpack.dev.babel.js +16 -10
- package/dist/esm/webpack/webpack.lib.base.babel.js +4 -5
- package/dist/esm/webpack/webpack.lib.dev.babel.js +1 -0
- package/dist/esm/webpack/webpack.prod.babel.js +7 -15
- package/dist/esm/webpack/webpack.storybook.js +27 -20
- package/dist/types/commands/build.d.ts +6 -14
- package/dist/types/commands/codemod.d.ts +6 -6
- package/dist/types/commands/gendoc.d.ts +2 -6
- package/dist/types/commands/lint.d.ts +8 -29
- package/dist/types/commands/pack.d.ts +8 -26
- package/dist/types/commands/start.d.ts +6 -13
- package/dist/types/commands/storybook.d.ts +8 -27
- package/dist/types/commands/test.d.ts +11 -39
- package/dist/types/commands/tscheck.d.ts +5 -14
- package/dist/types/commands/utils.d.ts +11 -11
- package/dist/types/commands/version.d.ts +9 -28
- package/dist/types/commands/vitest.d.ts +10 -35
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.ts +11 -11
- package/dist/types/lint-config/eslint/common.d.cts +58 -55
- package/dist/types/lint-config/eslint/non-react.d.cts +34 -31
- package/dist/types/lint-config/eslint/react.d.cts +58 -55
- package/dist/types/lint-config/eslint/typescript/non-react.d.cts +28 -28
- package/dist/types/lint-config/eslint/typescript/react.d.cts +52 -52
- package/dist/types/monorepo/delete-merged-tags.d.ts +1 -1
- package/dist/types/monorepo/set-registry-version.d.ts +1 -1
- package/dist/types/monorepo/set-workspace-version.d.ts +1 -1
- package/dist/types/monorepo/utils.d.ts +1 -0
- package/dist/types/release.config.d.cts +0 -2
- package/dist/types/server/appRoutes.d.ts +2 -0
- package/dist/types/server/csp.d.ts +12 -9
- package/dist/types/server/logger.d.ts +7 -4
- package/dist/types/server/middlewares.d.ts +6 -2
- package/dist/types/server/utils.d.ts +3 -3
- package/dist/types/testing/jest.config.d.cts +10 -10
- package/dist/types/testing/jest.node.config.d.cts +10 -10
- package/dist/types/utils.d.ts +4 -0
- package/dist/types/webpack/helpers.d.ts +19 -18
- package/dist/types/webpack/webpack.base.babel.d.ts +3 -106
- package/dist/types/webpack/webpack.dev.babel.d.ts +2 -1
- package/dist/types/webpack/webpack.lib.base.babel.d.ts +3 -102
- package/dist/types/webpack/webpack.lib.dev.babel.d.ts +3 -101
- package/dist/types/webpack/webpack.lib.prod.babel.d.ts +2 -101
- package/dist/types/webpack/webpack.prod.babel.d.ts +3 -2
- package/dist/types/webpack/webpack.storybook.d.ts +5 -4
- package/package.json +45 -30
- package/dist/cjs/typescript/app.tsconfig.json +0 -23
- package/dist/cjs/typescript/library.tsconfig.json +0 -23
- package/dist/esm/server/app-routes.cjs +0 -42
- package/dist/esm/typescript/app.tsconfig.json +0 -23
- package/dist/esm/typescript/library.tsconfig.json +0 -23
- package/dist/types/server/app-routes.d.cts +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(lib_exports, {
|
|
|
25
25
|
jestConfig: () => import_jest_config.jestConfig,
|
|
26
26
|
jestNodeConfig: () => import_jest_node_config.jestNodeConfig,
|
|
27
27
|
lintStagedConfig: () => import_lint_staged_config.lintStagedConfig,
|
|
28
|
-
loadRoutes: () =>
|
|
28
|
+
loadRoutes: () => import_appRoutes.loadRoutes,
|
|
29
29
|
prettierConfig: () => import_prettier_config.prettierConfig,
|
|
30
30
|
stylelintConfig: () => import_stylelint_config.stylelintConfig,
|
|
31
31
|
vitestConfig: () => import_vitest_config.vitestConfig
|
|
@@ -41,4 +41,4 @@ var import_jest_config = require("./testing/jest.config.cjs");
|
|
|
41
41
|
var import_vitest_config = require("./testing/vitest.config.js");
|
|
42
42
|
var import_jest_node_config = require("./testing/jest.node.config.cjs");
|
|
43
43
|
var import_lint_staged_config = require("./lint-config/lint-staged.config.js");
|
|
44
|
-
var
|
|
44
|
+
var import_appRoutes = require("./server/appRoutes.js");
|
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
|
-
const prettierOptions = require(
|
|
2
|
+
const prettierOptions = require("../prettier.config.cjs");
|
|
3
3
|
// const webpackConfig = require('../../webpack/webpack.prod.babel');
|
|
4
4
|
|
|
5
5
|
exports.baseExtends = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
"plugin:eslint-comments/recommended",
|
|
7
|
+
"plugin:import/recommended",
|
|
8
|
+
"plugin:prettier/recommended",
|
|
9
|
+
"plugin:jest/recommended",
|
|
10
|
+
"plugin:jsdoc/recommended",
|
|
11
|
+
"plugin:wdio/recommended",
|
|
12
|
+
"plugin:testing-library/dom",
|
|
13
|
+
"plugin:storybook/recommended",
|
|
14
14
|
];
|
|
15
15
|
|
|
16
|
-
const basePlugins = [
|
|
16
|
+
const basePlugins = ["testing-library", "jest", "jsdoc", "wdio", "import"];
|
|
17
17
|
exports.basePlugins = basePlugins;
|
|
18
18
|
|
|
19
19
|
exports.baseOverrides = [
|
|
20
20
|
{
|
|
21
|
-
files: [
|
|
21
|
+
files: ["*.func.spec.js", "*.visual.spec.js"],
|
|
22
22
|
rules: {
|
|
23
|
-
|
|
23
|
+
"jest/valid-expect": "off",
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
];
|
|
27
27
|
|
|
28
28
|
const baseRules = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
"prettier/prettier": ["error", prettierOptions],
|
|
30
|
+
"arrow-body-style": [2, "as-needed"],
|
|
31
|
+
"class-methods-use-this": 0,
|
|
32
|
+
"import/imports-first": 0,
|
|
33
|
+
"import/newline-after-import": 0,
|
|
34
|
+
"import/no-dynamic-require": 0,
|
|
35
|
+
"import/no-extraneous-dependencies": 0,
|
|
36
|
+
"import/no-named-as-default": 0,
|
|
37
|
+
"import/no-unresolved": [
|
|
38
38
|
2,
|
|
39
39
|
{ caseSensitive: true, caseSensitiveStrict: true },
|
|
40
40
|
], // Tip: https://github.com/import-js/eslint-plugin-import/issues/1868
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
"import/no-webpack-loader-syntax": 0,
|
|
42
|
+
"import/prefer-default-export": 0,
|
|
43
|
+
"import/extensions": [
|
|
44
44
|
2,
|
|
45
|
-
|
|
45
|
+
"never",
|
|
46
46
|
{
|
|
47
|
-
json:
|
|
48
|
-
js:
|
|
47
|
+
json: "ignorePackages",
|
|
48
|
+
js: "ignorePackages",
|
|
49
49
|
},
|
|
50
50
|
],
|
|
51
51
|
indent: [
|
|
@@ -55,72 +55,72 @@ const baseRules = {
|
|
|
55
55
|
SwitchCase: 1,
|
|
56
56
|
},
|
|
57
57
|
],
|
|
58
|
-
|
|
59
|
-
complexity: [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
58
|
+
"max-lines": ["error", { max: 120, skipComments: true }],
|
|
59
|
+
complexity: ["error", { max: 10 }],
|
|
60
|
+
"max-depth": ["error", { max: 4 }],
|
|
61
|
+
"max-lines-per-function": 0,
|
|
62
|
+
"max-nested-callbacks": ["error", { max: 3 }],
|
|
63
|
+
"max-params": ["error", { max: 3 }],
|
|
64
|
+
"max-statements": ["error", { max: 20 }],
|
|
65
|
+
"max-len": 0,
|
|
66
|
+
"newline-per-chained-call": 0,
|
|
67
|
+
"no-confusing-arrow": 0,
|
|
68
|
+
"no-console": 1,
|
|
69
|
+
"no-param-reassign": ["error", { props: false }],
|
|
70
|
+
"no-unused-vars": 2,
|
|
71
|
+
"no-use-before-define": 0,
|
|
72
|
+
"prefer-template": 2,
|
|
73
|
+
"require-yield": 0,
|
|
74
|
+
"jsdoc/require-jsdoc": 0,
|
|
75
|
+
"eslint-comments/disable-enable-pair": 0,
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
exports.baseRules = baseRules;
|
|
79
79
|
|
|
80
80
|
const reactRules = {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
"jsx-a11y/aria-props": 2,
|
|
82
|
+
"jsx-a11y/heading-has-content": 0,
|
|
83
|
+
"jsx-a11y/label-has-associated-control": [
|
|
84
84
|
2,
|
|
85
85
|
{
|
|
86
86
|
// NOTE: If this error triggers, either disable it or add
|
|
87
87
|
// your custom components, labels and attributes via these options
|
|
88
88
|
// See https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-associated-control.md
|
|
89
|
-
controlComponents: [
|
|
89
|
+
controlComponents: ["Input"],
|
|
90
90
|
},
|
|
91
91
|
],
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
92
|
+
"jsx-a11y/label-has-for": 0,
|
|
93
|
+
"jsx-a11y/mouse-events-have-key-events": 2,
|
|
94
|
+
"jsx-a11y/role-has-required-aria-props": 2,
|
|
95
|
+
"jsx-a11y/role-supports-aria-props": 2,
|
|
96
|
+
"react/destructuring-assignment": 0,
|
|
97
|
+
"react-hooks/rules-of-hooks": "error",
|
|
98
|
+
"react/jsx-closing-tag-location": 0,
|
|
99
|
+
"react/forbid-prop-types": 0,
|
|
100
|
+
"react/jsx-first-prop-new-line": [2, "multiline"],
|
|
101
|
+
"react/jsx-no-target-blank": 0,
|
|
102
|
+
"react/jsx-props-no-spreading": 0,
|
|
103
|
+
"react/jsx-uses-vars": 2,
|
|
104
|
+
"react/require-default-props": 0,
|
|
105
|
+
"react/require-extension": 0,
|
|
106
|
+
"react/self-closing-comp": 0,
|
|
107
|
+
"react/sort-comp": 0,
|
|
108
|
+
"react/react-in-jsx-scope": 0,
|
|
109
|
+
"react/jsx-filename-extension": [
|
|
110
110
|
1,
|
|
111
|
-
{ extensions: [
|
|
111
|
+
{ extensions: [".js", ".jsx", ".tsx", ".mdx"] },
|
|
112
112
|
],
|
|
113
|
-
|
|
113
|
+
"react/function-component-definition": [
|
|
114
114
|
2,
|
|
115
|
-
{ namedComponents:
|
|
115
|
+
{ namedComponents: "arrow-function" },
|
|
116
116
|
],
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
"redux-saga/no-yield-in-race": 2,
|
|
118
|
+
"redux-saga/yield-effects": 2,
|
|
119
119
|
};
|
|
120
120
|
exports.reactRules = reactRules;
|
|
121
121
|
|
|
122
122
|
exports.baseConfig = {
|
|
123
|
-
parser:
|
|
123
|
+
parser: "@babel/eslint-parser",
|
|
124
124
|
plugins: basePlugins,
|
|
125
125
|
env: {
|
|
126
126
|
jest: true,
|
|
@@ -129,32 +129,35 @@ exports.baseConfig = {
|
|
|
129
129
|
es2021: true,
|
|
130
130
|
},
|
|
131
131
|
parserOptions: {
|
|
132
|
-
sourceType:
|
|
132
|
+
sourceType: "module",
|
|
133
133
|
ecmaFeatures: {
|
|
134
134
|
jsx: true,
|
|
135
135
|
},
|
|
136
|
+
babelOptions: {
|
|
137
|
+
plugins: ["@babel/plugin-syntax-import-assertions"],
|
|
138
|
+
},
|
|
136
139
|
},
|
|
137
140
|
settings: {
|
|
138
141
|
react: {
|
|
139
|
-
version:
|
|
142
|
+
version: "detect",
|
|
140
143
|
},
|
|
141
144
|
jest: {
|
|
142
145
|
version: 28,
|
|
143
146
|
},
|
|
144
|
-
|
|
147
|
+
"import/resolver": {
|
|
145
148
|
node: {
|
|
146
|
-
extensions: [
|
|
149
|
+
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
147
150
|
},
|
|
148
151
|
},
|
|
149
152
|
},
|
|
150
153
|
ignorePatterns: [
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
"/build/**/*",
|
|
155
|
+
"/dist/**/*",
|
|
156
|
+
"/reports/**/*",
|
|
157
|
+
"/coverage/**/*",
|
|
158
|
+
"/demo/**/*",
|
|
159
|
+
"/docs/**/*",
|
|
160
|
+
"/temp/**/*",
|
|
161
|
+
"**/vendor/*.js",
|
|
159
162
|
],
|
|
160
163
|
};
|
|
@@ -40,7 +40,7 @@ const deleteTags = (cmd, filter) => {
|
|
|
40
40
|
const tags = result.toString().split("\n").join(" ");
|
|
41
41
|
(0, import_child_process.execSync)(`git tag -d ${filter ? filter(tags) : tags}`, { cwd });
|
|
42
42
|
};
|
|
43
|
-
const tagsFromOtherBranches = (tags
|
|
43
|
+
const tagsFromOtherBranches = (tags) => {
|
|
44
44
|
const regex = branchTags[branchName] || branchTags.master;
|
|
45
45
|
return tags.split(" ").filter((tagName) => isSemVersion(tagName) && !regex.test(tagName)).join(" ");
|
|
46
46
|
};
|
|
@@ -34,7 +34,7 @@ module.exports = __toCommonJS(set_registry_version_exports);
|
|
|
34
34
|
var import_promises = require("node:fs/promises");
|
|
35
35
|
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
36
36
|
var import_normalize_path = __toESM(require("normalize-path"), 1);
|
|
37
|
-
var import_utils = require("./utils.
|
|
37
|
+
var import_utils = require("./utils.js");
|
|
38
38
|
const monorepoRoot = (0, import_normalize_path.default)((0, import_utils.findMonoRepoRoot)() || "");
|
|
39
39
|
const setRegistryVersion = async () => {
|
|
40
40
|
const files = await (0, import_fast_glob.default)([
|
|
@@ -42,7 +42,7 @@ const setRegistryVersion = async () => {
|
|
|
42
42
|
`${monorepoRoot}/apps/*/package.json`,
|
|
43
43
|
`${monorepoRoot}/package.json`
|
|
44
44
|
]);
|
|
45
|
-
Promise.all(
|
|
45
|
+
await Promise.all(
|
|
46
46
|
files.map(async (file) => {
|
|
47
47
|
let pkgJSONData = await (0, import_promises.readFile)(file, "utf8");
|
|
48
48
|
const pkgVersion = JSON.parse(pkgJSONData).version;
|
|
@@ -34,7 +34,7 @@ module.exports = __toCommonJS(set_workspace_version_exports);
|
|
|
34
34
|
var import_promises = require("node:fs/promises");
|
|
35
35
|
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
36
36
|
var import_normalize_path = __toESM(require("normalize-path"), 1);
|
|
37
|
-
var import_utils = require("./utils.
|
|
37
|
+
var import_utils = require("./utils.js");
|
|
38
38
|
const monorepoRoot = (0, import_normalize_path.default)((0, import_utils.findMonoRepoRoot)() || "");
|
|
39
39
|
const setWorkspaceVersion = async () => {
|
|
40
40
|
const files = await (0, import_fast_glob.default)([
|
|
@@ -42,7 +42,7 @@ const setWorkspaceVersion = async () => {
|
|
|
42
42
|
`${monorepoRoot}/apps/*/package.json`,
|
|
43
43
|
`${monorepoRoot}/package.json`
|
|
44
44
|
]);
|
|
45
|
-
Promise.all(
|
|
45
|
+
await Promise.all(
|
|
46
46
|
files.map(async (file) => {
|
|
47
47
|
let pkgJSONData = await (0, import_promises.readFile)(file, "utf8");
|
|
48
48
|
const pkgVersion = JSON.parse(pkgJSONData).version;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var utils_exports = {};
|
|
30
|
+
__export(utils_exports, {
|
|
31
|
+
findMonoRepoRoot: () => findMonoRepoRoot
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(utils_exports);
|
|
34
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
35
|
+
var import_child_process = require("child_process");
|
|
36
|
+
const WORKSPACE_DIR_ENV_VAR = "NPM_CONFIG_WORKSPACE_DIR";
|
|
37
|
+
const WORKSPACE_MANIFEST_FILENAME = "pnpm-workspace.yaml";
|
|
38
|
+
const getPNPMWorkspaceLocation = (cwd) => {
|
|
39
|
+
let location = null;
|
|
40
|
+
for (const fileName of [WORKSPACE_MANIFEST_FILENAME, "pnpm-workspace.yml"]) {
|
|
41
|
+
try {
|
|
42
|
+
const result = (0, import_child_process.execSync)(`npx find-up ${fileName}`, { cwd });
|
|
43
|
+
location = result.toString().trim();
|
|
44
|
+
break;
|
|
45
|
+
} catch (err) {
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return location;
|
|
49
|
+
};
|
|
50
|
+
const findMonoRepoRoot = (cwd = process.cwd()) => {
|
|
51
|
+
const workspaceManifestDirEnvVar = process.env[WORKSPACE_DIR_ENV_VAR] ?? process.env[WORKSPACE_DIR_ENV_VAR.toLowerCase()];
|
|
52
|
+
const workspaceManifestLocation = workspaceManifestDirEnvVar ? import_node_path.default.join(workspaceManifestDirEnvVar, "pnpm-workspace.yaml") : getPNPMWorkspaceLocation(cwd);
|
|
53
|
+
return workspaceManifestLocation && import_node_path.default.dirname(workspaceManifestLocation);
|
|
54
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var appRoutes_exports = {};
|
|
30
|
+
__export(appRoutes_exports, {
|
|
31
|
+
loadRoutes: () => loadRoutes
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(appRoutes_exports);
|
|
34
|
+
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
35
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
36
|
+
const allJS = /\.js$/;
|
|
37
|
+
const serviceEndpoints = /\.endpoint\.js$/;
|
|
38
|
+
const getFilesMatching = (filePattern) => {
|
|
39
|
+
const getFiles = (dir) => {
|
|
40
|
+
let routeFiles = [];
|
|
41
|
+
if (!import_node_fs.default.existsSync(dir))
|
|
42
|
+
return routeFiles;
|
|
43
|
+
import_node_fs.default.readdirSync(dir).forEach((file) => {
|
|
44
|
+
const fullPath = import_node_path.default.join(dir, file);
|
|
45
|
+
if (import_node_fs.default.lstatSync(fullPath).isDirectory()) {
|
|
46
|
+
routeFiles = routeFiles.concat(getFiles(fullPath));
|
|
47
|
+
} else if (filePattern.test(fullPath))
|
|
48
|
+
routeFiles.push(fullPath);
|
|
49
|
+
});
|
|
50
|
+
return routeFiles;
|
|
51
|
+
};
|
|
52
|
+
return getFiles;
|
|
53
|
+
};
|
|
54
|
+
const getServerRouteFiles = getFilesMatching(allJS);
|
|
55
|
+
const getServiceEndpoints = getFilesMatching(serviceEndpoints);
|
|
56
|
+
const loadRoutes = async (app) => {
|
|
57
|
+
const routeFiles = getServerRouteFiles(
|
|
58
|
+
import_node_path.default.join(process.cwd(), "server/routes")
|
|
59
|
+
);
|
|
60
|
+
routeFiles.push(...getServiceEndpoints(import_node_path.default.join(process.cwd(), "app")));
|
|
61
|
+
routeFiles.push(...getServiceEndpoints(import_node_path.default.join(process.cwd(), "lib")));
|
|
62
|
+
await Promise.all(
|
|
63
|
+
routeFiles.map(async (routeFile) => {
|
|
64
|
+
const { default: init } = await import(routeFile);
|
|
65
|
+
try {
|
|
66
|
+
init(app);
|
|
67
|
+
} catch (err) {
|
|
68
|
+
console.error(
|
|
69
|
+
`unable to load routes from ${routeFile}. ${err.message}`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
};
|
package/dist/cjs/server/csp.js
CHANGED
|
@@ -62,14 +62,13 @@ const sendFileWithCSPNonce = ({
|
|
|
62
62
|
res.sendStatus(404);
|
|
63
63
|
} else {
|
|
64
64
|
res.set("Content-Type", "text/html");
|
|
65
|
-
res.send(html.replace(nonceRegex,
|
|
65
|
+
res.send(html.replace(nonceRegex, res.locals.cspNonce));
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
69
|
const getScriptSrc = () => {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
]);
|
|
70
|
+
const source = (req, res) => `'nonce-${res.locals.cspNonce}'`;
|
|
71
|
+
const scriptSrc = sources.concat([source]);
|
|
73
72
|
return true ? scriptSrc.concat(["'unsafe-eval'"]) : scriptSrc;
|
|
74
73
|
};
|
|
75
74
|
const csp = (app) => {
|
package/dist/cjs/server/index.js
CHANGED
|
@@ -25,14 +25,16 @@ var import_express = __toESM(require("express"), 1);
|
|
|
25
25
|
var import_logger = require("./logger.js");
|
|
26
26
|
var import_middlewares = require("./middlewares.js");
|
|
27
27
|
var import_utils = require("./utils.js");
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
(0,
|
|
31
|
-
(0,
|
|
32
|
-
(0,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
var import_appRoutes = require("./appRoutes.js");
|
|
29
|
+
(async function startServer() {
|
|
30
|
+
const app = (0, import_express.default)();
|
|
31
|
+
(0, import_middlewares.setupDefaultMiddlewares)(app);
|
|
32
|
+
await (0, import_appRoutes.loadRoutes)(app);
|
|
33
|
+
(0, import_middlewares.setupAdditionalMiddlewars)(app);
|
|
34
|
+
app.listen(import_utils.port, import_utils.host, () => {
|
|
35
|
+
import_logger.logger.appStarted(import_utils.port.toString(), import_utils.host || "localhost");
|
|
36
|
+
}).on("error", (err) => {
|
|
37
|
+
import_logger.logger.error(err);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
});
|
|
40
|
+
})();
|
|
@@ -36,12 +36,12 @@ var import_express = __toESM(require("express"), 1);
|
|
|
36
36
|
var import_cors = __toESM(require("cors"), 1);
|
|
37
37
|
var import_compression = __toESM(require("compression"), 1);
|
|
38
38
|
var import_express_static_gzip = __toESM(require("express-static-gzip"), 1);
|
|
39
|
-
var
|
|
39
|
+
var import_pino_http = __toESM(require("pino-http"), 1);
|
|
40
40
|
var import_csp = require("./csp.js");
|
|
41
41
|
var import_helpers = require("../webpack/helpers.js");
|
|
42
42
|
const paths = (0, import_helpers.getPaths)();
|
|
43
43
|
const setupDefaultMiddlewares = (app) => {
|
|
44
|
-
const pino = (0,
|
|
44
|
+
const pino = (0, import_pino_http.default)({
|
|
45
45
|
transport: {
|
|
46
46
|
target: "pino-pretty",
|
|
47
47
|
options: {
|
|
@@ -72,7 +72,10 @@ const setupAdditionalMiddlewars = (app, options = {}) => {
|
|
|
72
72
|
orderPreference: ["br"]
|
|
73
73
|
})
|
|
74
74
|
);
|
|
75
|
-
app.use((0, import_express_static_gzip.default)("cdn"));
|
|
76
|
-
app.get(
|
|
75
|
+
app.use((0, import_express_static_gzip.default)("cdn", {}));
|
|
76
|
+
app.get(
|
|
77
|
+
"*",
|
|
78
|
+
(req, res) => (0, import_csp.sendFileWithCSPNonce)({ buildPath, res })
|
|
79
|
+
);
|
|
77
80
|
return app;
|
|
78
81
|
};
|
package/dist/cjs/server/utils.js
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var utils_exports = {};
|
|
30
|
+
__export(utils_exports, {
|
|
31
|
+
basePath: () => basePath,
|
|
32
|
+
getAppConfig: () => getAppConfig,
|
|
33
|
+
isApp: () => isApp
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(utils_exports);
|
|
36
|
+
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
37
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
38
|
+
const basePath = (process.env.BASE_PATH || "/").replace(/\/?$/, "/");
|
|
39
|
+
const isApp = () => import_node_fs.default.existsSync(import_node_path.default.join(process.cwd(), "app"));
|
|
40
|
+
const getAppConfig = () => {
|
|
41
|
+
const appConfigPath = import_node_path.default.join(
|
|
42
|
+
process.cwd(),
|
|
43
|
+
isApp() ? "app" : "lib",
|
|
44
|
+
"app.config.json"
|
|
45
|
+
);
|
|
46
|
+
if (!import_node_fs.default.existsSync(appConfigPath))
|
|
47
|
+
return "{}";
|
|
48
|
+
const appConfig = import_node_fs.default.readFileSync(appConfigPath);
|
|
49
|
+
return appConfig || "{}";
|
|
50
|
+
};
|
|
@@ -51,8 +51,8 @@ var import_node_fs = __toESM(require("node:fs"), 1);
|
|
|
51
51
|
var import_lodash = __toESM(require("lodash"), 1);
|
|
52
52
|
var import_compression_webpack_plugin = __toESM(require("compression-webpack-plugin"), 1);
|
|
53
53
|
var import_zlib = __toESM(require("zlib"), 1);
|
|
54
|
-
var import_utils = require("../monorepo/utils.
|
|
55
|
-
var import_utils2 = require("../utils.
|
|
54
|
+
var import_utils = require("../monorepo/utils.js");
|
|
55
|
+
var import_utils2 = require("../utils.js");
|
|
56
56
|
let pathSep = import_node_path.default.sep;
|
|
57
57
|
if (pathSep === "\\")
|
|
58
58
|
pathSep = "\\\\";
|
|
@@ -74,7 +74,7 @@ const excludeNodeModulesExcept = (modules) => {
|
|
|
74
74
|
};
|
|
75
75
|
const getLibraryName = () => {
|
|
76
76
|
const packageJson = JSON.parse(
|
|
77
|
-
import_node_fs.default.readFileSync(import_node_path.default.join(process.cwd(), "package.json"))
|
|
77
|
+
import_node_fs.default.readFileSync(import_node_path.default.join(process.cwd(), "package.json")).toString()
|
|
78
78
|
);
|
|
79
79
|
const libraryName = packageJson ? packageJson.name : process.env.LIBRARY_NAME || "mylibrary";
|
|
80
80
|
const modifiedLibName = `emui-${libraryName.replace("@elliemae/", "").replace("pui-", "")}`;
|