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

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
@@ -86,7 +86,7 @@ var import_fs2 = require("fs");
86
86
  var import_rollup = require("rollup");
87
87
  var import_path2 = require("path");
88
88
  var import_plugin_node_resolve = __toESM(require("@rollup/plugin-node-resolve"));
89
- var import_core = require("@swc/core");
89
+ var import_ts_transform = require("@faasjs/ts-transform");
90
90
  var FAAS_PACKAGES = [
91
91
  "@faasjs/ant-design",
92
92
  "@faasjs/aws",
@@ -194,12 +194,14 @@ function findModule(list, key, options = { excludes: [] }) {
194
194
  }
195
195
  deps.map((d) => findModule(list, d, options));
196
196
  }
197
- function swc(options) {
197
+ function swc(externalModules) {
198
198
  return {
199
199
  name: "swc",
200
200
  async transform(code, filename) {
201
- options.filename = filename;
202
- return (0, import_core.transform)(code, options);
201
+ return (0, import_ts_transform.bundle)({
202
+ filename,
203
+ externalModules
204
+ });
203
205
  }
204
206
  };
205
207
  }
@@ -221,18 +223,13 @@ async function loadTs(filename, options = Object.create(null)) {
221
223
  ".jsx"
222
224
  ]
223
225
  }),
224
- swc({
225
- jsc: {
226
- parser: { syntax: "typescript" },
227
- target: "es2021"
228
- }
229
- })
226
+ swc(external)
230
227
  ],
231
228
  onwarn: () => null
232
229
  }, options.input || {});
233
- const bundle = await (0, import_rollup.rollup)(input);
230
+ const bundle2 = await (0, import_rollup.rollup)(input);
234
231
  const dependencies = Object.create(null);
235
- for (const m of ((_a = bundle.cache) == null ? void 0 : _a.modules) || [])
232
+ for (const m of ((_a = bundle2.cache) == null ? void 0 : _a.modules) || [])
236
233
  for (const d of m.dependencies)
237
234
  if (!d.startsWith("/") && !dependencies[d] && !NODE_PACKAGES.includes(d))
238
235
  dependencies[d] = "*";
@@ -241,7 +238,7 @@ async function loadTs(filename, options = Object.create(null)) {
241
238
  format: "cjs",
242
239
  exports: "auto"
243
240
  }, options.output || {});
244
- await bundle.write(output);
241
+ await bundle2.write(output);
245
242
  const result = Object.create(null);
246
243
  result.dependencies = dependencies;
247
244
  result.module = require(output.file);
package/dist/index.mjs CHANGED
@@ -67,7 +67,7 @@ import {
67
67
  dirname as dirname2
68
68
  } from "path";
69
69
  import resolve from "@rollup/plugin-node-resolve";
70
- import { transform } from "@swc/core";
70
+ import { bundle } from "@faasjs/ts-transform";
71
71
  var FAAS_PACKAGES = [
72
72
  "@faasjs/ant-design",
73
73
  "@faasjs/aws",
@@ -175,12 +175,14 @@ function findModule(list, key, options = { excludes: [] }) {
175
175
  }
176
176
  deps.map((d) => findModule(list, d, options));
177
177
  }
178
- function swc(options) {
178
+ function swc(externalModules) {
179
179
  return {
180
180
  name: "swc",
181
181
  async transform(code, filename) {
182
- options.filename = filename;
183
- return transform(code, options);
182
+ return bundle({
183
+ filename,
184
+ externalModules
185
+ });
184
186
  }
185
187
  };
186
188
  }
@@ -202,18 +204,13 @@ async function loadTs(filename, options = Object.create(null)) {
202
204
  ".jsx"
203
205
  ]
204
206
  }),
205
- swc({
206
- jsc: {
207
- parser: { syntax: "typescript" },
208
- target: "es2021"
209
- }
210
- })
207
+ swc(external)
211
208
  ],
212
209
  onwarn: () => null
213
210
  }, options.input || {});
214
- const bundle = await rollup(input);
211
+ const bundle2 = await rollup(input);
215
212
  const dependencies = Object.create(null);
216
- for (const m of ((_a = bundle.cache) == null ? void 0 : _a.modules) || [])
213
+ for (const m of ((_a = bundle2.cache) == null ? void 0 : _a.modules) || [])
217
214
  for (const d of m.dependencies)
218
215
  if (!d.startsWith("/") && !dependencies[d] && !NODE_PACKAGES.includes(d))
219
216
  dependencies[d] = "*";
@@ -222,7 +219,7 @@ async function loadTs(filename, options = Object.create(null)) {
222
219
  format: "cjs",
223
220
  exports: "auto"
224
221
  }, options.output || {});
225
- await bundle.write(output);
222
+ await bundle2.write(output);
226
223
  const result = Object.create(null);
227
224
  result.dependencies = dependencies;
228
225
  result.module = __require(output.file);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/load",
3
- "version": "0.0.2-beta.321",
3
+ "version": "0.0.2-beta.325",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,10 +22,10 @@
22
22
  "dist"
23
23
  ],
24
24
  "peerDependencies": {
25
- "@faasjs/deep_merge": "^0.0.2-beta.321",
26
- "@faasjs/func": "^0.0.2-beta.321",
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",
27
28
  "@rollup/plugin-node-resolve": "*",
28
- "@swc/core": "*",
29
29
  "js-yaml": "*",
30
30
  "rollup": "*"
31
31
  },