@modern-js/utils 2.22.1-alpha.2 → 2.22.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +10 -0
- package/dist/cjs/cli/constants/index.js +0 -4
- package/dist/cjs/cli/prettyInstructions.js +3 -2
- package/dist/cjs/runtime/nestedRoutes.js +3 -1
- package/dist/cjs/runtime-node/index.js +0 -2
- package/dist/cjs/universal/constants.js +0 -4
- package/dist/esm/cli/constants/index.js +0 -1
- package/dist/esm/cli/prettyInstructions.js +3 -2
- package/dist/esm/runtime/nestedRoutes.js +3 -1
- package/dist/esm/runtime-node/index.js +0 -1
- package/dist/esm/universal/constants.js +0 -1
- package/dist/types/cli/constants/index.d.ts +0 -4
- package/dist/types/runtime/nestedRoutes.d.ts +6 -2
- package/dist/types/runtime-node/index.d.ts +1 -2
- package/dist/types/universal/constants.d.ts +1 -5
- package/package.json +4 -13
- package/dist/FileSizeReporter.d.ts +0 -16
- package/dist/FileSizeReporter.js +0 -162
- package/dist/alias.d.ts +0 -25
- package/dist/alias.js +0 -108
- package/dist/analyzeProject.d.ts +0 -2
- package/dist/analyzeProject.js +0 -71
- package/dist/applyOptionsChain.d.ts +0 -3
- package/dist/applyOptionsChain.js +0 -58
- package/dist/babel.d.ts +0 -3
- package/dist/babel.js +0 -136
- package/dist/chainId.d.ts +0 -244
- package/dist/chainId.js +0 -196
- package/dist/cjs/runtime-node/nestedRoutes.js +0 -28
- package/dist/clearConsole.d.ts +0 -1
- package/dist/clearConsole.js +0 -31
- package/dist/commands.d.ts +0 -4
- package/dist/commands.js +0 -48
- package/dist/compatRequire.d.ts +0 -13
- package/dist/compatRequire.js +0 -82
- package/dist/compiled.d.ts +0 -43
- package/dist/compiled.js +0 -142
- package/dist/constants.d.ts +0 -244
- package/dist/constants.js +0 -320
- package/dist/debug.d.ts +0 -6
- package/dist/debug.js +0 -28
- package/dist/emptyDir.d.ts +0 -1
- package/dist/emptyDir.js +0 -52
- package/dist/ensureAbsolutePath.d.ts +0 -7
- package/dist/ensureAbsolutePath.js +0 -38
- package/dist/ensureArray.d.ts +0 -1
- package/dist/ensureArray.js +0 -32
- package/dist/esm/runtime-node/nestedRoutes.js +0 -18
- package/dist/findExists.d.ts +0 -6
- package/dist/findExists.js +0 -45
- package/dist/generateMetaTags.d.ts +0 -16
- package/dist/generateMetaTags.js +0 -61
- package/dist/getBrowserslist.d.ts +0 -2
- package/dist/getBrowserslist.js +0 -31
- package/dist/getCoreJsVersion.d.ts +0 -1
- package/dist/getCoreJsVersion.js +0 -46
- package/dist/getEntryOptions.d.ts +0 -1
- package/dist/getEntryOptions.js +0 -54
- package/dist/getPackageManager.d.ts +0 -1
- package/dist/getPackageManager.js +0 -87
- package/dist/getPort.d.ts +0 -14
- package/dist/getPort.js +0 -112
- package/dist/getServerConfig.d.ts +0 -1
- package/dist/getServerConfig.js +0 -67
- package/dist/getTargetDir.d.ts +0 -1
- package/dist/getTargetDir.js +0 -41
- package/dist/import.d.ts +0 -5
- package/dist/import.js +0 -33
- package/dist/index.d.ts +0 -44
- package/dist/index.js +0 -60
- package/dist/is/index.d.ts +0 -58
- package/dist/is/index.js +0 -114
- package/dist/is/nodeEnv.d.ts +0 -8
- package/dist/is/nodeEnv.js +0 -39
- package/dist/is/platform.d.ts +0 -2
- package/dist/is/platform.js +0 -30
- package/dist/is/type.d.ts +0 -8
- package/dist/is/type.js +0 -64
- package/dist/logger.d.ts +0 -65
- package/dist/logger.js +0 -145
- package/dist/monorepo.d.ts +0 -11
- package/dist/monorepo.js +0 -137
- package/dist/nodeEnv.d.ts +0 -3
- package/dist/nodeEnv.js +0 -81
- package/dist/path.d.ts +0 -18
- package/dist/path.js +0 -92
- package/dist/pathSerializer.d.ts +0 -16
- package/dist/pathSerializer.js +0 -76
- package/dist/plugin.d.ts +0 -2
- package/dist/plugin.js +0 -46
- package/dist/prettyInstructions.d.ts +0 -9
- package/dist/prettyInstructions.js +0 -112
- package/dist/printBuildError.d.ts +0 -8
- package/dist/printBuildError.js +0 -57
- package/dist/react.d.ts +0 -1
- package/dist/react.js +0 -64
- package/dist/readTsConfig.d.ts +0 -2
- package/dist/readTsConfig.js +0 -47
- package/dist/removeSlash.d.ts +0 -3
- package/dist/removeSlash.js +0 -33
- package/dist/resolve.d.ts +0 -13
- package/dist/resolve.js +0 -63
- package/dist/routes.d.ts +0 -2
- package/dist/routes.js +0 -58
- package/dist/runtimeExports.d.ts +0 -4
- package/dist/runtimeExports.js +0 -73
- package/dist/ssr.d.ts +0 -8
- package/dist/ssr.js +0 -30
- package/dist/storage.d.ts +0 -5
- package/dist/storage.js +0 -75
- package/dist/testUtils.d.ts +0 -5
- package/dist/testUtils.js +0 -38
- package/dist/types/runtime-node/nestedRoutes.d.ts +0 -3
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -15
- package/dist/universal/constants.d.ts +0 -9
- package/dist/universal/constants.js +0 -30
- package/dist/universal/formatWebpack.d.ts +0 -13
- package/dist/universal/formatWebpack.js +0 -100
- package/dist/universal/nestedRoutes.d.ts +0 -8
- package/dist/universal/nestedRoutes.js +0 -131
- package/dist/universal/remixRouter.d.ts +0 -1
- package/dist/universal/remixRouter.js +0 -17
- package/dist/universal/serialize.d.ts +0 -1
- package/dist/universal/serialize.js +0 -40
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -92
- package/dist/wait.d.ts +0 -2
- package/dist/wait.js +0 -29
- package/dist/watch.d.ts +0 -8
- package/dist/watch.js +0 -90
@@ -1,131 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __defProps = Object.defineProperties;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
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 __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
22
|
-
var __export = (target, all) => {
|
23
|
-
for (var name in all)
|
24
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
25
|
-
};
|
26
|
-
var __copyProps = (to, from, except, desc) => {
|
27
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
28
|
-
for (let key of __getOwnPropNames(from))
|
29
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
30
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
31
|
-
}
|
32
|
-
return to;
|
33
|
-
};
|
34
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
35
|
-
var nestedRoutes_exports = {};
|
36
|
-
__export(nestedRoutes_exports, {
|
37
|
-
renderNestedRoute: () => renderNestedRoute,
|
38
|
-
transformNestedRoutes: () => transformNestedRoutes
|
39
|
-
});
|
40
|
-
module.exports = __toCommonJS(nestedRoutes_exports);
|
41
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
42
|
-
var import_react = require("react");
|
43
|
-
var import_react_router_dom = require("react-router-dom");
|
44
|
-
const transformNestedRoutes = (routes) => {
|
45
|
-
const routeElements = [];
|
46
|
-
for (const route of routes) {
|
47
|
-
const routeElement = renderNestedRoute(route);
|
48
|
-
routeElements.push(routeElement);
|
49
|
-
}
|
50
|
-
return (0, import_react_router_dom.createRoutesFromElements)(routeElements);
|
51
|
-
};
|
52
|
-
const renderNestedRoute = (nestedRoute, options = {}) => {
|
53
|
-
const { children, index, id, component, isRoot, lazyImport } = nestedRoute;
|
54
|
-
const Component = component;
|
55
|
-
const { parent, DeferredDataComponent, props = {} } = options;
|
56
|
-
const routeProps = {
|
57
|
-
caseSensitive: nestedRoute.caseSensitive,
|
58
|
-
path: nestedRoute.path,
|
59
|
-
id: nestedRoute.id,
|
60
|
-
loader: createLoader(nestedRoute),
|
61
|
-
action: nestedRoute.action,
|
62
|
-
hasErrorBoundary: nestedRoute.hasErrorBoundary,
|
63
|
-
shouldRevalidate: nestedRoute.shouldRevalidate,
|
64
|
-
handle: nestedRoute.handle,
|
65
|
-
index: nestedRoute.index,
|
66
|
-
element: nestedRoute.element,
|
67
|
-
errorElement: nestedRoute.errorElement
|
68
|
-
};
|
69
|
-
if (nestedRoute.error) {
|
70
|
-
const errorElement = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(nestedRoute.error, {});
|
71
|
-
routeProps.errorElement = errorElement;
|
72
|
-
}
|
73
|
-
let element;
|
74
|
-
if (Component) {
|
75
|
-
if ((parent == null ? void 0 : parent.loading) && lazyImport) {
|
76
|
-
const Loading = parent.loading;
|
77
|
-
if (isLoadableComponent(Component)) {
|
78
|
-
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {}) });
|
79
|
-
} else {
|
80
|
-
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) });
|
81
|
-
}
|
82
|
-
} else if (isLoadableComponent(Component) && lazyImport) {
|
83
|
-
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {});
|
84
|
-
} else if (isRoot) {
|
85
|
-
element = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
86
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, __spreadValues({}, props)),
|
87
|
-
typeof document === "undefined" && DeferredDataComponent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeferredDataComponent, {})
|
88
|
-
] });
|
89
|
-
} else if (lazyImport) {
|
90
|
-
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) });
|
91
|
-
} else {
|
92
|
-
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {});
|
93
|
-
}
|
94
|
-
} else {
|
95
|
-
nestedRoute.loading = parent == null ? void 0 : parent.loading;
|
96
|
-
}
|
97
|
-
if (element) {
|
98
|
-
routeProps.element = element;
|
99
|
-
}
|
100
|
-
const childElements = children == null ? void 0 : children.map((childRoute) => {
|
101
|
-
return renderNestedRoute(childRoute, { parent: nestedRoute });
|
102
|
-
});
|
103
|
-
const routeElement = index ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, __spreadProps(__spreadValues({}, routeProps), { index: true }), id) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, __spreadProps(__spreadValues({}, routeProps), { index: false, children: childElements }), id);
|
104
|
-
return routeElement;
|
105
|
-
};
|
106
|
-
function createLoader(route) {
|
107
|
-
const { loader } = route;
|
108
|
-
if (loader) {
|
109
|
-
return (args) => {
|
110
|
-
if (typeof route.lazyImport === "function") {
|
111
|
-
route.lazyImport();
|
112
|
-
}
|
113
|
-
return loader(args);
|
114
|
-
};
|
115
|
-
} else {
|
116
|
-
return () => {
|
117
|
-
if (typeof route.lazyImport === "function") {
|
118
|
-
route.lazyImport();
|
119
|
-
}
|
120
|
-
return null;
|
121
|
-
};
|
122
|
-
}
|
123
|
-
}
|
124
|
-
function isLoadableComponent(component) {
|
125
|
-
return component && component.displayName === "Loadable" && component.preload && typeof component.preload === "function";
|
126
|
-
}
|
127
|
-
// Annotate the CommonJS export names for ESM import in node:
|
128
|
-
0 && (module.exports = {
|
129
|
-
renderNestedRoute,
|
130
|
-
transformNestedRoutes
|
131
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export * from '@remix-run/router';
|
@@ -1,17 +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 __copyProps = (to, from, except, desc) => {
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
7
|
-
for (let key of __getOwnPropNames(from))
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
10
|
-
}
|
11
|
-
return to;
|
12
|
-
};
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
15
|
-
var remixRouter_exports = {};
|
16
|
-
module.exports = __toCommonJS(remixRouter_exports);
|
17
|
-
__reExport(remixRouter_exports, require("@remix-run/router"), module.exports);
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const serializeJson: (data: any) => string;
|
@@ -1,40 +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 serialize_exports = {};
|
29
|
-
__export(serialize_exports, {
|
30
|
-
serializeJson: () => serializeJson
|
31
|
-
});
|
32
|
-
module.exports = __toCommonJS(serialize_exports);
|
33
|
-
var import_serialize_javascript = __toESM(require("serialize-javascript"));
|
34
|
-
const serializeJson = (data) => {
|
35
|
-
return (0, import_serialize_javascript.default)(data, { isJSON: true });
|
36
|
-
};
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
38
|
-
0 && (module.exports = {
|
39
|
-
serializeJson
|
40
|
-
});
|
package/dist/version.d.ts
DELETED
package/dist/version.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 __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 __async = (__this, __arguments, generator) => {
|
43
|
-
return new Promise((resolve, reject) => {
|
44
|
-
var fulfilled = (value) => {
|
45
|
-
try {
|
46
|
-
step(generator.next(value));
|
47
|
-
} catch (e) {
|
48
|
-
reject(e);
|
49
|
-
}
|
50
|
-
};
|
51
|
-
var rejected = (value) => {
|
52
|
-
try {
|
53
|
-
step(generator.throw(value));
|
54
|
-
} catch (e) {
|
55
|
-
reject(e);
|
56
|
-
}
|
57
|
-
};
|
58
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
59
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
60
|
-
});
|
61
|
-
};
|
62
|
-
var version_exports = {};
|
63
|
-
__export(version_exports, {
|
64
|
-
getPnpmVersion: () => getPnpmVersion,
|
65
|
-
isReact18: () => isReact18
|
66
|
-
});
|
67
|
-
module.exports = __toCommonJS(version_exports);
|
68
|
-
var import_path = __toESM(require("path"));
|
69
|
-
var import_compiled = require("./compiled");
|
70
|
-
function getPnpmVersion() {
|
71
|
-
return __async(this, null, function* () {
|
72
|
-
const { stdout } = yield (0, import_compiled.execa)("pnpm", ["--version"]);
|
73
|
-
return stdout;
|
74
|
-
});
|
75
|
-
}
|
76
|
-
const isReact18 = (cwd) => {
|
77
|
-
const pkgPath = import_path.default.join(cwd, "package.json");
|
78
|
-
if (!import_compiled.fs.existsSync(pkgPath)) {
|
79
|
-
return false;
|
80
|
-
}
|
81
|
-
const pkgInfo = JSON.parse(import_compiled.fs.readFileSync(pkgPath, "utf8"));
|
82
|
-
const deps = __spreadValues(__spreadValues({}, pkgInfo.devDependencies), pkgInfo.dependencies);
|
83
|
-
if (typeof deps.react !== "string") {
|
84
|
-
return false;
|
85
|
-
}
|
86
|
-
return import_compiled.semver.satisfies(import_compiled.semver.minVersion(deps.react), ">=18.0.0");
|
87
|
-
};
|
88
|
-
// Annotate the CommonJS export names for ESM import in node:
|
89
|
-
0 && (module.exports = {
|
90
|
-
getPnpmVersion,
|
91
|
-
isReact18
|
92
|
-
});
|
package/dist/wait.d.ts
DELETED
package/dist/wait.js
DELETED
@@ -1,29 +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 wait_exports = {};
|
19
|
-
__export(wait_exports, {
|
20
|
-
wait: () => wait
|
21
|
-
});
|
22
|
-
module.exports = __toCommonJS(wait_exports);
|
23
|
-
const wait = (time = 0) => new Promise((resolve) => {
|
24
|
-
setTimeout(resolve, time);
|
25
|
-
});
|
26
|
-
// Annotate the CommonJS export names for ESM import in node:
|
27
|
-
0 && (module.exports = {
|
28
|
-
wait
|
29
|
-
});
|
package/dist/watch.d.ts
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
export type WatchChangeTypeValueT = 'add' | 'unlink' | 'change';
|
2
|
-
export declare const WatchChangeType: Record<'ADD' | 'UNLINK' | 'CHANGE', WatchChangeTypeValueT>;
|
3
|
-
type RunTaskType = (option: {
|
4
|
-
changedFilePath: string;
|
5
|
-
changeType: WatchChangeTypeValueT;
|
6
|
-
}) => void | Promise<void>;
|
7
|
-
export declare const watch: (watchDir: string | string[], runTask: RunTaskType, ignored?: string[]) => import("./compiled").FSWatcher;
|
8
|
-
export {};
|
package/dist/watch.js
DELETED
@@ -1,90 +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 __async = (__this, __arguments, generator) => {
|
29
|
-
return new Promise((resolve, reject) => {
|
30
|
-
var fulfilled = (value) => {
|
31
|
-
try {
|
32
|
-
step(generator.next(value));
|
33
|
-
} catch (e) {
|
34
|
-
reject(e);
|
35
|
-
}
|
36
|
-
};
|
37
|
-
var rejected = (value) => {
|
38
|
-
try {
|
39
|
-
step(generator.throw(value));
|
40
|
-
} catch (e) {
|
41
|
-
reject(e);
|
42
|
-
}
|
43
|
-
};
|
44
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
45
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
46
|
-
});
|
47
|
-
};
|
48
|
-
var watch_exports = {};
|
49
|
-
__export(watch_exports, {
|
50
|
-
WatchChangeType: () => WatchChangeType,
|
51
|
-
watch: () => watch
|
52
|
-
});
|
53
|
-
module.exports = __toCommonJS(watch_exports);
|
54
|
-
var path = __toESM(require("path"));
|
55
|
-
var import_compiled = require("./compiled");
|
56
|
-
const WatchChangeType = {
|
57
|
-
ADD: "add",
|
58
|
-
UNLINK: "unlink",
|
59
|
-
CHANGE: "change"
|
60
|
-
};
|
61
|
-
const watch = (watchDir, runTask, ignored = []) => {
|
62
|
-
let ready = false;
|
63
|
-
const watcher = import_compiled.chokidar.watch(watchDir, {
|
64
|
-
ignored
|
65
|
-
});
|
66
|
-
watcher.on("ready", () => ready = true);
|
67
|
-
watcher.on("change", (filePath) => __async(void 0, null, function* () {
|
68
|
-
const changedFilePath = path.resolve(filePath);
|
69
|
-
yield runTask({ changedFilePath, changeType: WatchChangeType.CHANGE });
|
70
|
-
}));
|
71
|
-
watcher.on("add", (filePath) => __async(void 0, null, function* () {
|
72
|
-
const changedFilePath = path.resolve(filePath);
|
73
|
-
if (ready) {
|
74
|
-
yield runTask({ changedFilePath, changeType: WatchChangeType.ADD });
|
75
|
-
}
|
76
|
-
}));
|
77
|
-
watcher.on("unlink", (filePath) => __async(void 0, null, function* () {
|
78
|
-
const changedFilePath = path.resolve(filePath);
|
79
|
-
yield runTask({ changedFilePath, changeType: WatchChangeType.UNLINK });
|
80
|
-
}));
|
81
|
-
watcher.on("error", (err) => {
|
82
|
-
throw err;
|
83
|
-
});
|
84
|
-
return watcher;
|
85
|
-
};
|
86
|
-
// Annotate the CommonJS export names for ESM import in node:
|
87
|
-
0 && (module.exports = {
|
88
|
-
WatchChangeType,
|
89
|
-
watch
|
90
|
-
});
|