@faasjs/load 0.0.2-beta.317 → 0.0.2-beta.318
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/index.js +11 -16
- package/dist/index.mjs +13 -22
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -88,6 +88,8 @@ var import_path2 = require("path");
|
|
|
88
88
|
var import_plugin_node_resolve = __toESM(require("@rollup/plugin-node-resolve"));
|
|
89
89
|
var import_core = require("@swc/core");
|
|
90
90
|
var FAAS_PACKAGES = [
|
|
91
|
+
"@faasjs/ant-design",
|
|
92
|
+
"@faasjs/aws",
|
|
91
93
|
"@faasjs/browser",
|
|
92
94
|
"@faasjs/cli",
|
|
93
95
|
"@faasjs/cloud_function",
|
|
@@ -146,25 +148,18 @@ var NODE_PACKAGES = [
|
|
|
146
148
|
"worker_threads",
|
|
147
149
|
"zlib"
|
|
148
150
|
];
|
|
149
|
-
function findModule(list, key,
|
|
151
|
+
function findModule(list, key, options = { excludes: [] }) {
|
|
150
152
|
if (list[key])
|
|
151
153
|
return;
|
|
152
154
|
if (key.startsWith("@types/") || options.excludes.includes(key))
|
|
153
155
|
return;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if ((0, import_fs2.existsSync)(p)) {
|
|
158
|
-
path = p;
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
if (!path)
|
|
162
|
-
return;
|
|
163
|
-
list[key] = path;
|
|
164
|
-
if ((0, import_fs2.existsSync)((0, import_path2.join)(path, "package.json"))) {
|
|
165
|
-
const pkg = JSON.parse((0, import_fs2.readFileSync)((0, import_path2.join)(path, "package.json")).toString());
|
|
156
|
+
try {
|
|
157
|
+
list[key] = (0, import_path2.dirname)(require.resolve((0, import_path2.join)(key, "package.json")));
|
|
158
|
+
const pkg = JSON.parse((0, import_fs2.readFileSync)((0, import_path2.join)(list[key], "package.json")).toString());
|
|
166
159
|
const deps = Object.keys(pkg.dependencies || {}).concat(Object.keys(pkg.peerDependencies || {}));
|
|
167
|
-
deps.map((d) => findModule(list, d,
|
|
160
|
+
deps.map((d) => findModule(list, d, options));
|
|
161
|
+
} catch (error) {
|
|
162
|
+
console.warn(`[FaasJS] Cannot find module path: ${key}`, error);
|
|
168
163
|
}
|
|
169
164
|
}
|
|
170
165
|
function swc(options) {
|
|
@@ -222,9 +217,9 @@ async function loadTs(filename, options = Object.create(null)) {
|
|
|
222
217
|
(0, import_fs2.unlinkSync)(output.file);
|
|
223
218
|
if (options.modules) {
|
|
224
219
|
const modules = Object.create(null);
|
|
225
|
-
Object.keys(dependencies).map((d) => findModule(modules, d,
|
|
220
|
+
Object.keys(dependencies).map((d) => findModule(modules, d, options.modules));
|
|
226
221
|
if (options.modules.additions)
|
|
227
|
-
options.modules.additions.map((d) => findModule(modules, d,
|
|
222
|
+
options.modules.additions.map((d) => findModule(modules, d, options.modules));
|
|
228
223
|
result.modules = modules;
|
|
229
224
|
}
|
|
230
225
|
return result;
|
package/dist/index.mjs
CHANGED
|
@@ -59,16 +59,14 @@ function loadConfig(root, filename) {
|
|
|
59
59
|
|
|
60
60
|
// src/load_ts.ts
|
|
61
61
|
import { deepMerge as deepMerge2 } from "@faasjs/deep_merge";
|
|
62
|
-
import {
|
|
63
|
-
existsSync as existsSync2,
|
|
64
|
-
readFileSync as readFileSync2,
|
|
65
|
-
unlinkSync
|
|
66
|
-
} from "fs";
|
|
62
|
+
import { readFileSync as readFileSync2, unlinkSync } from "fs";
|
|
67
63
|
import { rollup } from "rollup";
|
|
68
|
-
import { join as join2 } from "path";
|
|
64
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
69
65
|
import resolve from "@rollup/plugin-node-resolve";
|
|
70
66
|
import { transform } from "@swc/core";
|
|
71
67
|
var FAAS_PACKAGES = [
|
|
68
|
+
"@faasjs/ant-design",
|
|
69
|
+
"@faasjs/aws",
|
|
72
70
|
"@faasjs/browser",
|
|
73
71
|
"@faasjs/cli",
|
|
74
72
|
"@faasjs/cloud_function",
|
|
@@ -127,25 +125,18 @@ var NODE_PACKAGES = [
|
|
|
127
125
|
"worker_threads",
|
|
128
126
|
"zlib"
|
|
129
127
|
];
|
|
130
|
-
function findModule(list, key,
|
|
128
|
+
function findModule(list, key, options = { excludes: [] }) {
|
|
131
129
|
if (list[key])
|
|
132
130
|
return;
|
|
133
131
|
if (key.startsWith("@types/") || options.excludes.includes(key))
|
|
134
132
|
return;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (existsSync2(p)) {
|
|
139
|
-
path = p;
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
if (!path)
|
|
143
|
-
return;
|
|
144
|
-
list[key] = path;
|
|
145
|
-
if (existsSync2(join2(path, "package.json"))) {
|
|
146
|
-
const pkg = JSON.parse(readFileSync2(join2(path, "package.json")).toString());
|
|
133
|
+
try {
|
|
134
|
+
list[key] = dirname2(__require.resolve(join2(key, "package.json")));
|
|
135
|
+
const pkg = JSON.parse(readFileSync2(join2(list[key], "package.json")).toString());
|
|
147
136
|
const deps = Object.keys(pkg.dependencies || {}).concat(Object.keys(pkg.peerDependencies || {}));
|
|
148
|
-
deps.map((d) => findModule(list, d,
|
|
137
|
+
deps.map((d) => findModule(list, d, options));
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.warn(`[FaasJS] Cannot find module path: ${key}`, error);
|
|
149
140
|
}
|
|
150
141
|
}
|
|
151
142
|
function swc(options) {
|
|
@@ -203,9 +194,9 @@ async function loadTs(filename, options = Object.create(null)) {
|
|
|
203
194
|
unlinkSync(output.file);
|
|
204
195
|
if (options.modules) {
|
|
205
196
|
const modules = Object.create(null);
|
|
206
|
-
Object.keys(dependencies).map((d) => findModule(modules, d,
|
|
197
|
+
Object.keys(dependencies).map((d) => findModule(modules, d, options.modules));
|
|
207
198
|
if (options.modules.additions)
|
|
208
|
-
options.modules.additions.map((d) => findModule(modules, d,
|
|
199
|
+
options.modules.additions.map((d) => findModule(modules, d, options.modules));
|
|
209
200
|
result.modules = modules;
|
|
210
201
|
}
|
|
211
202
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/load",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.318",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"engines": {
|
|
38
38
|
"npm": ">=8.0.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "4a9f699171ad7e20d922e68b74418d1ec5b7d016"
|
|
41
41
|
}
|