@faasjs/load 0.0.2-beta.325 → 0.0.2-beta.329

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 CHANGED
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
6
  var __export = (target, all) => {
@@ -17,9 +15,6 @@ var __reExport = (target, module2, copyDefault, desc) => {
17
15
  }
18
16
  return target;
19
17
  };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
18
  var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
19
  return (module2, temp) => {
25
20
  return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
@@ -85,69 +80,7 @@ var import_deep_merge2 = require("@faasjs/deep_merge");
85
80
  var import_fs2 = require("fs");
86
81
  var import_rollup = require("rollup");
87
82
  var import_path2 = require("path");
88
- var import_plugin_node_resolve = __toESM(require("@rollup/plugin-node-resolve"));
89
83
  var import_ts_transform = require("@faasjs/ts-transform");
90
- var FAAS_PACKAGES = [
91
- "@faasjs/ant-design",
92
- "@faasjs/aws",
93
- "@faasjs/browser",
94
- "@faasjs/cli",
95
- "@faasjs/cloud_function",
96
- "create-faas-app",
97
- "@faasjs/deep_merge",
98
- "@faasjs/deployer",
99
- "@faasjs/eslint-config-recommended",
100
- "@faasjs/eslint-config-vue",
101
- "faasjs",
102
- "@faasjs/func",
103
- "@faasjs/graphql-server",
104
- "@faasjs/http",
105
- "@faasjs/knex",
106
- "@faasjs/load",
107
- "@faasjs/logger",
108
- "@faasjs/react",
109
- "@faasjs/redis",
110
- "@faasjs/request",
111
- "@faasjs/server",
112
- "@faasjs/tencentcloud",
113
- "@faasjs/test",
114
- "@faasjs/vue-plugin"
115
- ];
116
- var NODE_PACKAGES = [
117
- "async_hooks",
118
- "child_process",
119
- "cluster",
120
- "crypto",
121
- "dns",
122
- "events",
123
- "fs",
124
- "http",
125
- "http2",
126
- "https",
127
- "inspector",
128
- "net",
129
- "os",
130
- "path",
131
- "perf_hooks",
132
- "process",
133
- "querystring",
134
- "readline",
135
- "repl",
136
- "stream",
137
- "string_decoder",
138
- "tls",
139
- "trace_events",
140
- "tty",
141
- "dgram",
142
- "udp4",
143
- "url",
144
- "util",
145
- "v8",
146
- "vm",
147
- "wasi",
148
- "worker_threads",
149
- "zlib"
150
- ];
151
84
  function resolveModuleBasePath(moduleName) {
152
85
  const moduleMainFilePath = require.resolve(moduleName);
153
86
  const moduleNameParts = moduleName.split("/");
@@ -205,33 +138,23 @@ function swc(externalModules) {
205
138
  }
206
139
  };
207
140
  }
208
- async function loadTs(filename, options = Object.create(null)) {
141
+ async function loadTs(filename, options = /* @__PURE__ */ Object.create(null)) {
209
142
  var _a;
210
143
  const PackageJSON = require(`${process.cwd()}/package.json`);
211
- const external = PackageJSON.dependencies ? FAAS_PACKAGES.concat(Object.keys(PackageJSON.dependencies)) : FAAS_PACKAGES;
144
+ const external = PackageJSON.dependencies ? Object.keys(PackageJSON.dependencies) : [];
212
145
  if (options.modules && options.modules.excludes == null)
213
146
  options.modules.excludes = [];
214
147
  const input = (0, import_deep_merge2.deepMerge)({
215
148
  input: filename,
216
149
  external,
217
- plugins: [
218
- (0, import_plugin_node_resolve.default)({
219
- extensions: [
220
- ".ts",
221
- ".tsx",
222
- ".js",
223
- ".jsx"
224
- ]
225
- }),
226
- swc(external)
227
- ],
150
+ plugins: [swc(external)],
228
151
  onwarn: () => null
229
152
  }, options.input || {});
230
153
  const bundle2 = await (0, import_rollup.rollup)(input);
231
- const dependencies = Object.create(null);
154
+ const dependencies = /* @__PURE__ */ Object.create(null);
232
155
  for (const m of ((_a = bundle2.cache) == null ? void 0 : _a.modules) || [])
233
156
  for (const d of m.dependencies)
234
- if (!d.startsWith("/") && !dependencies[d] && !NODE_PACKAGES.includes(d))
157
+ if (!d.startsWith("/") && !dependencies[d] && !import_ts_transform.NodeBuiltinModules.includes(d))
235
158
  dependencies[d] = "*";
236
159
  const output = (0, import_deep_merge2.deepMerge)({
237
160
  file: filename + ".tmp.js",
@@ -239,13 +162,13 @@ async function loadTs(filename, options = Object.create(null)) {
239
162
  exports: "auto"
240
163
  }, options.output || {});
241
164
  await bundle2.write(output);
242
- const result = Object.create(null);
165
+ const result = /* @__PURE__ */ Object.create(null);
243
166
  result.dependencies = dependencies;
244
167
  result.module = require(output.file);
245
168
  if (options.tmp)
246
169
  (0, import_fs2.unlinkSync)(output.file);
247
170
  if (options.modules) {
248
- const modules = Object.create(null);
171
+ const modules = /* @__PURE__ */ Object.create(null);
249
172
  Object.keys(dependencies).map((d) => findModule(modules, d, options.modules));
250
173
  if (options.modules.additions)
251
174
  options.modules.additions.map((d) => findModule(modules, d, options.modules));
package/dist/index.mjs CHANGED
@@ -66,69 +66,7 @@ import {
66
66
  sep as sep2,
67
67
  dirname as dirname2
68
68
  } from "path";
69
- import resolve from "@rollup/plugin-node-resolve";
70
- import { bundle } from "@faasjs/ts-transform";
71
- var FAAS_PACKAGES = [
72
- "@faasjs/ant-design",
73
- "@faasjs/aws",
74
- "@faasjs/browser",
75
- "@faasjs/cli",
76
- "@faasjs/cloud_function",
77
- "create-faas-app",
78
- "@faasjs/deep_merge",
79
- "@faasjs/deployer",
80
- "@faasjs/eslint-config-recommended",
81
- "@faasjs/eslint-config-vue",
82
- "faasjs",
83
- "@faasjs/func",
84
- "@faasjs/graphql-server",
85
- "@faasjs/http",
86
- "@faasjs/knex",
87
- "@faasjs/load",
88
- "@faasjs/logger",
89
- "@faasjs/react",
90
- "@faasjs/redis",
91
- "@faasjs/request",
92
- "@faasjs/server",
93
- "@faasjs/tencentcloud",
94
- "@faasjs/test",
95
- "@faasjs/vue-plugin"
96
- ];
97
- var NODE_PACKAGES = [
98
- "async_hooks",
99
- "child_process",
100
- "cluster",
101
- "crypto",
102
- "dns",
103
- "events",
104
- "fs",
105
- "http",
106
- "http2",
107
- "https",
108
- "inspector",
109
- "net",
110
- "os",
111
- "path",
112
- "perf_hooks",
113
- "process",
114
- "querystring",
115
- "readline",
116
- "repl",
117
- "stream",
118
- "string_decoder",
119
- "tls",
120
- "trace_events",
121
- "tty",
122
- "dgram",
123
- "udp4",
124
- "url",
125
- "util",
126
- "v8",
127
- "vm",
128
- "wasi",
129
- "worker_threads",
130
- "zlib"
131
- ];
69
+ import { bundle, NodeBuiltinModules } from "@faasjs/ts-transform";
132
70
  function resolveModuleBasePath(moduleName) {
133
71
  const moduleMainFilePath = __require.resolve(moduleName);
134
72
  const moduleNameParts = moduleName.split("/");
@@ -186,33 +124,23 @@ function swc(externalModules) {
186
124
  }
187
125
  };
188
126
  }
189
- async function loadTs(filename, options = Object.create(null)) {
127
+ async function loadTs(filename, options = /* @__PURE__ */ Object.create(null)) {
190
128
  var _a;
191
129
  const PackageJSON = __require(`${process.cwd()}/package.json`);
192
- const external = PackageJSON.dependencies ? FAAS_PACKAGES.concat(Object.keys(PackageJSON.dependencies)) : FAAS_PACKAGES;
130
+ const external = PackageJSON.dependencies ? Object.keys(PackageJSON.dependencies) : [];
193
131
  if (options.modules && options.modules.excludes == null)
194
132
  options.modules.excludes = [];
195
133
  const input = deepMerge2({
196
134
  input: filename,
197
135
  external,
198
- plugins: [
199
- resolve({
200
- extensions: [
201
- ".ts",
202
- ".tsx",
203
- ".js",
204
- ".jsx"
205
- ]
206
- }),
207
- swc(external)
208
- ],
136
+ plugins: [swc(external)],
209
137
  onwarn: () => null
210
138
  }, options.input || {});
211
139
  const bundle2 = await rollup(input);
212
- const dependencies = Object.create(null);
140
+ const dependencies = /* @__PURE__ */ Object.create(null);
213
141
  for (const m of ((_a = bundle2.cache) == null ? void 0 : _a.modules) || [])
214
142
  for (const d of m.dependencies)
215
- if (!d.startsWith("/") && !dependencies[d] && !NODE_PACKAGES.includes(d))
143
+ if (!d.startsWith("/") && !dependencies[d] && !NodeBuiltinModules.includes(d))
216
144
  dependencies[d] = "*";
217
145
  const output = deepMerge2({
218
146
  file: filename + ".tmp.js",
@@ -220,13 +148,13 @@ async function loadTs(filename, options = Object.create(null)) {
220
148
  exports: "auto"
221
149
  }, options.output || {});
222
150
  await bundle2.write(output);
223
- const result = Object.create(null);
151
+ const result = /* @__PURE__ */ Object.create(null);
224
152
  result.dependencies = dependencies;
225
153
  result.module = __require(output.file);
226
154
  if (options.tmp)
227
155
  unlinkSync(output.file);
228
156
  if (options.modules) {
229
- const modules = Object.create(null);
157
+ const modules = /* @__PURE__ */ Object.create(null);
230
158
  Object.keys(dependencies).map((d) => findModule(modules, d, options.modules));
231
159
  if (options.modules.additions)
232
160
  options.modules.additions.map((d) => findModule(modules, d, options.modules));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/load",
3
- "version": "0.0.2-beta.325",
3
+ "version": "0.0.2-beta.329",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,16 +16,16 @@
16
16
  },
17
17
  "funding": "https://github.com/sponsors/faasjs",
18
18
  "scripts": {
19
- "build": "rm -rf ./dist && tsup-node src/index.ts --format esm,cjs --dts"
19
+ "build": "tsup-node src/index.ts --format esm,cjs",
20
+ "build:types": "tsup-node src/index.ts --dts-only"
20
21
  },
21
22
  "files": [
22
23
  "dist"
23
24
  ],
24
25
  "peerDependencies": {
25
- "@faasjs/deep_merge": "^0.0.2-beta.325",
26
- "@faasjs/func": "^0.0.2-beta.325",
27
- "@faasjs/ts-transform": "^0.0.2-beta.325",
28
- "@rollup/plugin-node-resolve": "*",
26
+ "@faasjs/deep_merge": "^0.0.2-beta.329",
27
+ "@faasjs/func": "^0.0.2-beta.329",
28
+ "@faasjs/ts-transform": "^0.0.2-beta.329",
29
29
  "js-yaml": "*",
30
30
  "rollup": "*"
31
31
  },
@@ -36,6 +36,5 @@
36
36
  },
37
37
  "engines": {
38
38
  "npm": ">=8.0.0"
39
- },
40
- "gitHead": "4a9f699171ad7e20d922e68b74418d1ec5b7d016"
39
+ }
41
40
  }