@modern-js/utils 2.22.1-alpha.3 → 2.22.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/cli/constants/index.js +0 -4
  3. package/dist/cjs/cli/prettyInstructions.js +3 -2
  4. package/dist/cjs/runtime/nestedRoutes.js +3 -1
  5. package/dist/cjs/runtime-node/index.js +0 -2
  6. package/dist/cjs/universal/constants.js +0 -4
  7. package/dist/esm/cli/constants/index.js +0 -1
  8. package/dist/esm/cli/prettyInstructions.js +3 -2
  9. package/dist/esm/runtime/nestedRoutes.js +3 -1
  10. package/dist/esm/runtime-node/index.js +0 -1
  11. package/dist/esm/universal/constants.js +0 -1
  12. package/dist/types/cli/constants/index.d.ts +0 -4
  13. package/dist/types/runtime/nestedRoutes.d.ts +6 -2
  14. package/dist/types/runtime-node/index.d.ts +1 -2
  15. package/dist/types/universal/constants.d.ts +1 -5
  16. package/package.json +4 -13
  17. package/dist/FileSizeReporter.d.ts +0 -16
  18. package/dist/FileSizeReporter.js +0 -162
  19. package/dist/alias.d.ts +0 -25
  20. package/dist/alias.js +0 -108
  21. package/dist/analyzeProject.d.ts +0 -2
  22. package/dist/analyzeProject.js +0 -71
  23. package/dist/applyOptionsChain.d.ts +0 -3
  24. package/dist/applyOptionsChain.js +0 -58
  25. package/dist/babel.d.ts +0 -3
  26. package/dist/babel.js +0 -136
  27. package/dist/chainId.d.ts +0 -244
  28. package/dist/chainId.js +0 -196
  29. package/dist/cjs/runtime-node/nestedRoutes.js +0 -28
  30. package/dist/clearConsole.d.ts +0 -1
  31. package/dist/clearConsole.js +0 -31
  32. package/dist/commands.d.ts +0 -4
  33. package/dist/commands.js +0 -48
  34. package/dist/compatRequire.d.ts +0 -13
  35. package/dist/compatRequire.js +0 -82
  36. package/dist/compiled.d.ts +0 -43
  37. package/dist/compiled.js +0 -142
  38. package/dist/constants.d.ts +0 -244
  39. package/dist/constants.js +0 -320
  40. package/dist/debug.d.ts +0 -6
  41. package/dist/debug.js +0 -28
  42. package/dist/emptyDir.d.ts +0 -1
  43. package/dist/emptyDir.js +0 -52
  44. package/dist/ensureAbsolutePath.d.ts +0 -7
  45. package/dist/ensureAbsolutePath.js +0 -38
  46. package/dist/ensureArray.d.ts +0 -1
  47. package/dist/ensureArray.js +0 -32
  48. package/dist/esm/runtime-node/nestedRoutes.js +0 -18
  49. package/dist/findExists.d.ts +0 -6
  50. package/dist/findExists.js +0 -45
  51. package/dist/generateMetaTags.d.ts +0 -16
  52. package/dist/generateMetaTags.js +0 -61
  53. package/dist/getBrowserslist.d.ts +0 -2
  54. package/dist/getBrowserslist.js +0 -31
  55. package/dist/getCoreJsVersion.d.ts +0 -1
  56. package/dist/getCoreJsVersion.js +0 -46
  57. package/dist/getEntryOptions.d.ts +0 -1
  58. package/dist/getEntryOptions.js +0 -54
  59. package/dist/getPackageManager.d.ts +0 -1
  60. package/dist/getPackageManager.js +0 -87
  61. package/dist/getPort.d.ts +0 -14
  62. package/dist/getPort.js +0 -112
  63. package/dist/getServerConfig.d.ts +0 -1
  64. package/dist/getServerConfig.js +0 -67
  65. package/dist/getTargetDir.d.ts +0 -1
  66. package/dist/getTargetDir.js +0 -41
  67. package/dist/import.d.ts +0 -5
  68. package/dist/import.js +0 -33
  69. package/dist/index.d.ts +0 -44
  70. package/dist/index.js +0 -60
  71. package/dist/is/index.d.ts +0 -58
  72. package/dist/is/index.js +0 -114
  73. package/dist/is/nodeEnv.d.ts +0 -8
  74. package/dist/is/nodeEnv.js +0 -39
  75. package/dist/is/platform.d.ts +0 -2
  76. package/dist/is/platform.js +0 -30
  77. package/dist/is/type.d.ts +0 -8
  78. package/dist/is/type.js +0 -64
  79. package/dist/logger.d.ts +0 -65
  80. package/dist/logger.js +0 -145
  81. package/dist/monorepo.d.ts +0 -11
  82. package/dist/monorepo.js +0 -137
  83. package/dist/nodeEnv.d.ts +0 -3
  84. package/dist/nodeEnv.js +0 -81
  85. package/dist/path.d.ts +0 -18
  86. package/dist/path.js +0 -92
  87. package/dist/pathSerializer.d.ts +0 -16
  88. package/dist/pathSerializer.js +0 -76
  89. package/dist/plugin.d.ts +0 -2
  90. package/dist/plugin.js +0 -46
  91. package/dist/prettyInstructions.d.ts +0 -9
  92. package/dist/prettyInstructions.js +0 -112
  93. package/dist/printBuildError.d.ts +0 -8
  94. package/dist/printBuildError.js +0 -57
  95. package/dist/react.d.ts +0 -1
  96. package/dist/react.js +0 -64
  97. package/dist/readTsConfig.d.ts +0 -2
  98. package/dist/readTsConfig.js +0 -47
  99. package/dist/removeSlash.d.ts +0 -3
  100. package/dist/removeSlash.js +0 -33
  101. package/dist/resolve.d.ts +0 -13
  102. package/dist/resolve.js +0 -63
  103. package/dist/routes.d.ts +0 -2
  104. package/dist/routes.js +0 -58
  105. package/dist/runtimeExports.d.ts +0 -4
  106. package/dist/runtimeExports.js +0 -73
  107. package/dist/ssr.d.ts +0 -8
  108. package/dist/ssr.js +0 -30
  109. package/dist/storage.d.ts +0 -5
  110. package/dist/storage.js +0 -75
  111. package/dist/testUtils.d.ts +0 -5
  112. package/dist/testUtils.js +0 -38
  113. package/dist/types/runtime-node/nestedRoutes.d.ts +0 -3
  114. package/dist/types.d.ts +0 -1
  115. package/dist/types.js +0 -15
  116. package/dist/universal/constants.d.ts +0 -9
  117. package/dist/universal/constants.js +0 -30
  118. package/dist/universal/formatWebpack.d.ts +0 -13
  119. package/dist/universal/formatWebpack.js +0 -100
  120. package/dist/universal/nestedRoutes.d.ts +0 -8
  121. package/dist/universal/nestedRoutes.js +0 -131
  122. package/dist/universal/remixRouter.d.ts +0 -1
  123. package/dist/universal/remixRouter.js +0 -17
  124. package/dist/universal/serialize.d.ts +0 -1
  125. package/dist/universal/serialize.js +0 -40
  126. package/dist/version.d.ts +0 -2
  127. package/dist/version.js +0 -92
  128. package/dist/wait.d.ts +0 -2
  129. package/dist/wait.js +0 -29
  130. package/dist/watch.d.ts +0 -8
  131. package/dist/watch.js +0 -90
package/dist/nodeEnv.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare function canUseNpm(): Promise<boolean>;
2
- export declare function canUseYarn(): Promise<boolean>;
3
- export declare function canUsePnpm(): Promise<boolean>;
package/dist/nodeEnv.js DELETED
@@ -1,81 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var __async = (__this, __arguments, generator) => {
19
- return new Promise((resolve, reject) => {
20
- var fulfilled = (value) => {
21
- try {
22
- step(generator.next(value));
23
- } catch (e) {
24
- reject(e);
25
- }
26
- };
27
- var rejected = (value) => {
28
- try {
29
- step(generator.throw(value));
30
- } catch (e) {
31
- reject(e);
32
- }
33
- };
34
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
35
- step((generator = generator.apply(__this, __arguments)).next());
36
- });
37
- };
38
- var nodeEnv_exports = {};
39
- __export(nodeEnv_exports, {
40
- canUseNpm: () => canUseNpm,
41
- canUsePnpm: () => canUsePnpm,
42
- canUseYarn: () => canUseYarn
43
- });
44
- module.exports = __toCommonJS(nodeEnv_exports);
45
- var import_compiled = require("./compiled");
46
- function canUseNpm() {
47
- return __async(this, null, function* () {
48
- try {
49
- yield (0, import_compiled.execa)("npm", ["--version"], { env: process.env });
50
- return true;
51
- } catch (e) {
52
- return false;
53
- }
54
- });
55
- }
56
- function canUseYarn() {
57
- return __async(this, null, function* () {
58
- try {
59
- yield (0, import_compiled.execa)("yarn", ["--version"], { env: process.env });
60
- return true;
61
- } catch (e) {
62
- return false;
63
- }
64
- });
65
- }
66
- function canUsePnpm() {
67
- return __async(this, null, function* () {
68
- try {
69
- yield (0, import_compiled.execa)("pnpm", ["--version"], { env: process.env });
70
- return true;
71
- } catch (e) {
72
- return false;
73
- }
74
- });
75
- }
76
- // Annotate the CommonJS export names for ESM import in node:
77
- 0 && (module.exports = {
78
- canUseNpm,
79
- canUsePnpm,
80
- canUseYarn
81
- });
package/dist/path.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { lodash as _ } from './compiled';
2
- export declare const isPathString: (test: string) => boolean;
3
- export declare const isRelativePath: (test: string) => boolean;
4
- export declare const normalizeOutputPath: (s: string) => string;
5
- export declare const normalizeToPosixPath: (p: string | undefined) => string;
6
- export declare const getTemplatePath: (prefix?: string) => string;
7
- /**
8
- * Compile path string to RegExp.
9
- * @note Only support posix path.
10
- */
11
-
12
- export declare function compilePathMatcherRegExp(match: string | RegExp): RegExp;
13
- /** @internal @see {@link upwardPaths} */
14
-
15
- export declare const _joinPathParts: (_part: unknown, i: number, parts: _.List<string>) => string;
16
- export declare function upwardPaths(start: string): string[];
17
- export declare function getRealTemporaryDirectory(): string | null;
18
- export declare function splitPathString(str: string): string[];
package/dist/path.js DELETED
@@ -1,92 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var path_exports = {};
29
- __export(path_exports, {
30
- _joinPathParts: () => _joinPathParts,
31
- compilePathMatcherRegExp: () => compilePathMatcherRegExp,
32
- getRealTemporaryDirectory: () => getRealTemporaryDirectory,
33
- getTemplatePath: () => getTemplatePath,
34
- isPathString: () => isPathString,
35
- isRelativePath: () => isRelativePath,
36
- normalizeOutputPath: () => normalizeOutputPath,
37
- normalizeToPosixPath: () => normalizeToPosixPath,
38
- splitPathString: () => splitPathString,
39
- upwardPaths: () => upwardPaths
40
- });
41
- module.exports = __toCommonJS(path_exports);
42
- var import_path = __toESM(require("path"));
43
- var import_os = __toESM(require("os"));
44
- var import_fs = __toESM(require("fs"));
45
- var import_compiled = require("./compiled");
46
- const isPathString = (test) => import_path.default.posix.basename(test) !== test || import_path.default.win32.basename(test) !== test;
47
- const isRelativePath = (test) => /^\.\.?($|[\\/])/.test(test);
48
- const normalizeOutputPath = (s) => s.replace(/\\/g, "\\\\");
49
- const normalizeToPosixPath = (p) => import_compiled.upath.normalizeSafe(import_path.default.normalize(p || "")).replace(/^([a-zA-Z]+):/, (_2, m) => `/${m.toLowerCase()}`);
50
- const getTemplatePath = (prefix) => {
51
- const tmpRoot = import_fs.default.realpathSync(import_os.default.tmpdir());
52
- const parts = [tmpRoot];
53
- prefix && parts.push(prefix);
54
- parts.push((0, import_compiled.nanoid)());
55
- return import_path.default.resolve(...parts);
56
- };
57
- function compilePathMatcherRegExp(match) {
58
- if (typeof match !== "string") {
59
- return match;
60
- }
61
- const escaped = import_compiled.lodash.escapeRegExp(match);
62
- return new RegExp(`(?<=\\W|^)${escaped}(?=\\W|$)`);
63
- }
64
- const _joinPathParts = (_part, i, parts) => (0, import_compiled.lodash)(parts).filter((part) => !["/", "\\"].includes(part)).tap((parts2) => parts2.unshift("")).slice(0, i + 2).join("/");
65
- function upwardPaths(start) {
66
- return (0, import_compiled.lodash)(start).split(/[/\\]/).filter(Boolean).map(_joinPathParts).reverse().push("/").value();
67
- }
68
- function getRealTemporaryDirectory() {
69
- let ret = null;
70
- try {
71
- ret = import_os.default.tmpdir();
72
- ret = import_fs.default.realpathSync(ret);
73
- } catch (e) {
74
- }
75
- return ret;
76
- }
77
- function splitPathString(str) {
78
- return str.split(/[\\/]/);
79
- }
80
- // Annotate the CommonJS export names for ESM import in node:
81
- 0 && (module.exports = {
82
- _joinPathParts,
83
- compilePathMatcherRegExp,
84
- getRealTemporaryDirectory,
85
- getTemplatePath,
86
- isPathString,
87
- isRelativePath,
88
- normalizeOutputPath,
89
- normalizeToPosixPath,
90
- splitPathString,
91
- upwardPaths
92
- });
@@ -1,16 +0,0 @@
1
- /** Different from */
2
- export type PathMatchExpression = string | RegExp;
3
- export interface PathMatcher {
4
- match: PathMatchExpression;
5
- mark: string | ((substring: string, ...args: any[]) => string);
6
- }
7
- export declare const matchUpwardPathsAsUnknown: (p: string) => {
8
- match: string;
9
- mark: string;
10
- }[];
11
- export interface ApplyPathMatcherOptions {
12
- minPartials?: number;
13
- }
14
- export declare function applyPathMatcher(matcher: PathMatcher, str: string, options?: ApplyPathMatcherOptions): string;
15
- export declare function applyMatcherReplacement(matchers: PathMatcher[], str: string, options?: ApplyPathMatcherOptions): string;
16
- export declare const createDefaultPathMatchers: (root: string) => PathMatcher[];
@@ -1,76 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var pathSerializer_exports = {};
29
- __export(pathSerializer_exports, {
30
- applyMatcherReplacement: () => applyMatcherReplacement,
31
- applyPathMatcher: () => applyPathMatcher,
32
- createDefaultPathMatchers: () => createDefaultPathMatchers,
33
- matchUpwardPathsAsUnknown: () => matchUpwardPathsAsUnknown
34
- });
35
- module.exports = __toCommonJS(pathSerializer_exports);
36
- var import_os = __toESM(require("os"));
37
- var import_lodash = __toESM(require("../compiled/lodash"));
38
- var import_path = require("./path");
39
- const matchUpwardPathsAsUnknown = (p) => (0, import_lodash.default)((0, import_path.upwardPaths)((0, import_path.normalizeToPosixPath)(p))).map((match) => ({ match, mark: "unknown" })).slice(1, -1).value();
40
- function applyPathMatcher(matcher, str, options = {}) {
41
- const regex = (0, import_path.compilePathMatcherRegExp)(matcher.match);
42
- const replacer = (substring, ...args) => {
43
- if (options.minPartials && (0, import_path.splitPathString)(substring).length < options.minPartials) {
44
- return substring;
45
- }
46
- const ret = typeof matcher.mark === "string" ? matcher.mark : matcher.mark(substring, ...args);
47
- return `<${import_lodash.default.snakeCase(ret).toUpperCase()}>`;
48
- };
49
- return str.replace(regex, replacer);
50
- }
51
- function applyMatcherReplacement(matchers, str, options = {}) {
52
- return matchers.reduce((ret, matcher) => {
53
- return applyPathMatcher(matcher, ret, options);
54
- }, str);
55
- }
56
- const createDefaultPathMatchers = (root) => {
57
- const ret = [
58
- {
59
- match: new RegExp("(?<=\\/)(\\.pnpm\\/.+?\\/node_modules)(?=\\/)"),
60
- mark: "pnpmInner"
61
- }
62
- ];
63
- const tmpdir = (0, import_path.getRealTemporaryDirectory)();
64
- tmpdir && ret.push({ match: tmpdir, mark: "temp" });
65
- ret.push({ match: import_os.default.tmpdir(), mark: "temp" });
66
- ret.push({ match: import_os.default.homedir(), mark: "home" });
67
- ret.push(...matchUpwardPathsAsUnknown(root));
68
- return ret;
69
- };
70
- // Annotate the CommonJS export names for ESM import in node:
71
- 0 && (module.exports = {
72
- applyMatcherReplacement,
73
- applyPathMatcher,
74
- createDefaultPathMatchers,
75
- matchUpwardPathsAsUnknown
76
- });
package/dist/plugin.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { InternalPlugins } from '@modern-js/types';
2
- export declare function getInternalPlugins(appDirectory: string, internalPlugins?: InternalPlugins): string[];
package/dist/plugin.js DELETED
@@ -1,46 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var plugin_exports = {};
19
- __export(plugin_exports, {
20
- getInternalPlugins: () => getInternalPlugins
21
- });
22
- module.exports = __toCommonJS(plugin_exports);
23
- var import_constants = require("./constants");
24
- var import_is = require("./is");
25
- function getInternalPlugins(appDirectory, internalPlugins = import_constants.INTERNAL_CLI_PLUGINS) {
26
- return [
27
- ...Object.keys(internalPlugins).filter((name) => {
28
- const config = internalPlugins[name];
29
- if (typeof config !== "string" && config.forced === true) {
30
- return true;
31
- }
32
- return (0, import_is.isDepExists)(appDirectory, name);
33
- }).map((name) => {
34
- const config = internalPlugins[name];
35
- if (typeof config !== "string") {
36
- return config.path;
37
- } else {
38
- return config;
39
- }
40
- })
41
- ];
42
- }
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- getInternalPlugins
46
- });
@@ -1,9 +0,0 @@
1
- /// <reference types="node" />
2
- import os from 'os';
3
- export declare const getIpv4Interfaces: () => os.NetworkInterfaceInfo[];
4
- export type AddressUrl = {
5
- label: string;
6
- url: string;
7
- };
8
- export declare const getAddressUrls: (protocol: string | undefined, port: number) => AddressUrl[];
9
- export declare const prettyInstructions: (appContext: any, config: any) => string;
@@ -1,112 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var prettyInstructions_exports = {};
29
- __export(prettyInstructions_exports, {
30
- getAddressUrls: () => getAddressUrls,
31
- getIpv4Interfaces: () => getIpv4Interfaces,
32
- prettyInstructions: () => prettyInstructions
33
- });
34
- module.exports = __toCommonJS(prettyInstructions_exports);
35
- var import_os = __toESM(require("os"));
36
- var import_compiled = require("./compiled");
37
- var import_is = require("./is");
38
- const normalizeUrl = (url) => url.replace(/([^:]\/)\/+/g, "$1");
39
- const getIpv4Interfaces = () => {
40
- const interfaces = import_os.default.networkInterfaces();
41
- const ipv4Interfaces = [];
42
- Object.keys(interfaces).forEach((key) => {
43
- interfaces[key].forEach((detail) => {
44
- const familyV4Value = typeof detail.family === "string" ? "IPv4" : 4;
45
- if (detail.family === familyV4Value) {
46
- ipv4Interfaces.push(detail);
47
- }
48
- });
49
- });
50
- return ipv4Interfaces;
51
- };
52
- const getAddressUrls = (protocol = "http", port) => {
53
- const ipv4Interfaces = getIpv4Interfaces();
54
- return ipv4Interfaces.reduce((memo, detail) => {
55
- let label = "Network: ";
56
- let url = `${protocol}://${detail.address}:${port}`;
57
- if (detail.address.includes(`localhost`) || detail.internal) {
58
- label = "Local: ";
59
- url = `${protocol}://localhost:${port}`;
60
- }
61
- memo.push({ label, url });
62
- return memo;
63
- }, []);
64
- };
65
- const prettyInstructions = (appContext, config) => {
66
- const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
67
- const urls = getAddressUrls(
68
- config.dev.https && (0, import_is.isDev)() ? "https" : "http",
69
- port
70
- );
71
- const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
72
- let message = "App running at:\n\n";
73
- if ((0, import_is.isSingleEntry)(entrypoints) || apiOnly) {
74
- message += urls.map(
75
- ({ label, url }) => ` ${import_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${import_compiled.chalk.cyanBright(
76
- normalizeUrl(`${url}/${routes[0].urlPath}`)
77
- )}
78
- `
79
- ).join("");
80
- } else {
81
- const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
82
- urls.forEach(({ label, url }) => {
83
- message += ` ${import_compiled.chalk.bold(`> ${label}`)}
84
- `;
85
- routes.forEach(({ entryName, urlPath, isSSR }) => {
86
- if (!checkedEntries.includes(entryName)) {
87
- return;
88
- }
89
- message += ` ${import_compiled.chalk.yellowBright(
90
- isSSR ? "λ" : "○"
91
- )} ${import_compiled.chalk.yellowBright(
92
- entryName.padEnd(maxNameLength + 8)
93
- )}${import_compiled.chalk.cyanBright(normalizeUrl(`${url}/${urlPath}`))}
94
- `;
95
- });
96
- });
97
- message += "\n";
98
- message += import_compiled.chalk.cyanBright(
99
- " λ (Server) server-side renders at runtime\n"
100
- );
101
- message += import_compiled.chalk.cyanBright(
102
- " ○ (Static) client-side renders as static HTML\n"
103
- );
104
- }
105
- return message;
106
- };
107
- // Annotate the CommonJS export names for ESM import in node:
108
- 0 && (module.exports = {
109
- getAddressUrls,
110
- getIpv4Interfaces,
111
- prettyInstructions
112
- });
@@ -1,8 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file at
6
- * https://github.com/facebook/create-react-app/blob/master/LICENSE
7
- */
8
- export declare function printBuildError(err: Error): void;
@@ -1,57 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var printBuildError_exports = {};
19
- __export(printBuildError_exports, {
20
- printBuildError: () => printBuildError
21
- });
22
- module.exports = __toCommonJS(printBuildError_exports);
23
- var import_compiled = require("./compiled");
24
- var import_logger = require("./logger");
25
- function printBuildError(err) {
26
- const message = err != null && err.message;
27
- const stack = err != null && err.stack;
28
- if (stack && typeof message === "string" && message.indexOf("from Terser") !== -1) {
29
- try {
30
- const matched = /(.+)\[(.+):(.+),(.+)\]\[.+\]/.exec(stack);
31
- if (!matched) {
32
- throw new Error("Using errors for control flow is bad.");
33
- }
34
- const problemPath = matched[2];
35
- const line = matched[3];
36
- const column = matched[4];
37
- import_logger.logger.error(
38
- `Failed to minify the code from this file:
39
-
40
- ${import_compiled.chalk.yellow(
41
- ` ${problemPath}:${line}${column !== "0" ? ":" + column : ""}`
42
- )}
43
- `
44
- );
45
- } catch (ignored) {
46
- import_logger.logger.error(`Failed to minify the bundle. ${err}
47
- `);
48
- }
49
- } else {
50
- import_logger.logger.error((message || err) + "\n");
51
- }
52
- import_logger.logger.log();
53
- }
54
- // Annotate the CommonJS export names for ESM import in node:
55
- 0 && (module.exports = {
56
- printBuildError
57
- });
package/dist/react.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const isBeyondReact17: (cwd: string) => boolean;
package/dist/react.js DELETED
@@ -1,64 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __export = (target, all) => {
22
- for (var name in all)
23
- __defProp(target, name, { get: all[name], enumerable: true });
24
- };
25
- var __copyProps = (to, from, except, desc) => {
26
- if (from && typeof from === "object" || typeof from === "function") {
27
- for (let key of __getOwnPropNames(from))
28
- if (!__hasOwnProp.call(to, key) && key !== except)
29
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
30
- }
31
- return to;
32
- };
33
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
34
- // If the importer is in node compatibility mode or this is not an ESM
35
- // file that has been converted to a CommonJS file using a Babel-
36
- // compatible transform (i.e. "__esModule" has not been set), then set
37
- // "default" to the CommonJS "module.exports" for node compatibility.
38
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
39
- mod
40
- ));
41
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
42
- var react_exports = {};
43
- __export(react_exports, {
44
- isBeyondReact17: () => isBeyondReact17
45
- });
46
- module.exports = __toCommonJS(react_exports);
47
- var import_path = __toESM(require("path"));
48
- var import__ = require(".");
49
- const isBeyondReact17 = (cwd) => {
50
- const pkgPath = import_path.default.join(cwd, "package.json");
51
- if (!import__.fs.existsSync(pkgPath)) {
52
- return false;
53
- }
54
- const pkgInfo = JSON.parse(import__.fs.readFileSync(pkgPath, "utf8"));
55
- const deps = __spreadValues(__spreadValues({}, pkgInfo.devDependencies), pkgInfo.dependencies);
56
- if (typeof deps.react !== "string") {
57
- return false;
58
- }
59
- return import__.semver.satisfies(import__.semver.minVersion(deps.react), ">=17.0.0");
60
- };
61
- // Annotate the CommonJS export names for ESM import in node:
62
- 0 && (module.exports = {
63
- isBeyondReact17
64
- });
@@ -1,2 +0,0 @@
1
- export declare const readTsConfig: (root: string) => any;
2
- export declare const readTsConfigByFile: (filename: string) => any;
@@ -1,47 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var readTsConfig_exports = {};
29
- __export(readTsConfig_exports, {
30
- readTsConfig: () => readTsConfig,
31
- readTsConfigByFile: () => readTsConfigByFile
32
- });
33
- module.exports = __toCommonJS(readTsConfig_exports);
34
- var import_path = __toESM(require("path"));
35
- var import_compiled = require("./compiled");
36
- const readTsConfig = (root) => {
37
- return readTsConfigByFile(import_path.default.resolve(root, "./tsconfig.json"));
38
- };
39
- const readTsConfigByFile = (filename) => {
40
- const content = import_compiled.fs.readFileSync(import_path.default.resolve(filename), "utf-8");
41
- return import_compiled.json5.parse(content);
42
- };
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- readTsConfig,
46
- readTsConfigByFile
47
- });
@@ -1,3 +0,0 @@
1
- export declare const removeLeadingSlash: (s: string) => string;
2
- export declare const removeTailSlash: (s: string) => string;
3
- export declare const removeSlash: (s: string) => string;