@faasjs/load 2.3.1 → 2.4.0

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
@@ -10,8 +10,7 @@ var tsTransform = require('@faasjs/ts-transform');
10
10
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
11
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
12
12
  }) : x)(function(x) {
13
- if (typeof require !== "undefined")
14
- return require.apply(this, arguments);
13
+ if (typeof require !== "undefined") return require.apply(this, arguments);
15
14
  throw Error('Dynamic require of "' + x + '" is not supported');
16
15
  });
17
16
  var Config = class {
@@ -23,8 +22,7 @@ var Config = class {
23
22
  */
24
23
  constructor(root, filename) {
25
24
  this.root = root;
26
- if (!this.root.endsWith(path.sep))
27
- this.root += path.sep;
25
+ if (!this.root.endsWith(path.sep)) this.root += path.sep;
28
26
  this.filename = filename;
29
27
  const configs = [];
30
28
  const paths = [this.root, "."].concat(
@@ -32,8 +30,7 @@ var Config = class {
32
30
  );
33
31
  paths.reduce((base, path$1) => {
34
32
  const root2 = path.join(base, path$1);
35
- if (root2 === base)
36
- return base;
33
+ if (root2 === base) return base;
37
34
  const faas = path.join(root2, "faas.yaml");
38
35
  if (fs.existsSync(faas))
39
36
  configs.push(
@@ -106,10 +103,8 @@ function resolveModuleBasePath(moduleName) {
106
103
  return moduleMainFilePath.slice(0, lastIndex + searchForPathSection.length);
107
104
  }
108
105
  function findModule(list, key, options = { excludes: [] }) {
109
- if (list[key])
110
- return;
111
- if (key.startsWith("@types/") || options.excludes.includes(key))
112
- return;
106
+ if (list[key]) return;
107
+ if (key.startsWith("@types/") || options.excludes.includes(key)) return;
113
108
  try {
114
109
  list[key] = path.dirname(__require.resolve(path.join(key, "package.json")));
115
110
  } catch (error) {
@@ -120,8 +115,7 @@ function findModule(list, key, options = { excludes: [] }) {
120
115
  console.warn(error2);
121
116
  }
122
117
  }
123
- if (!list[key])
124
- return;
118
+ if (!list[key]) return;
125
119
  const pkg = JSON.parse(
126
120
  fs.readFileSync(path.join(list[key], "package.json")).toString()
127
121
  );
@@ -132,8 +126,7 @@ function findModule(list, key, options = { excludes: [] }) {
132
126
  for (const key2 of Object.keys(pkg.peerDependenciesMeta)) {
133
127
  if (pkg.peerDependenciesMeta[key2].optional) {
134
128
  const index = deps.indexOf(key2);
135
- if (index >= 0)
136
- deps.splice(index, 1);
129
+ if (index >= 0) deps.splice(index, 1);
137
130
  }
138
131
  }
139
132
  }
@@ -183,8 +176,7 @@ async function loadTs(filename, options = /* @__PURE__ */ Object.create(null)) {
183
176
  const result = /* @__PURE__ */ Object.create(null);
184
177
  result.dependencies = dependencies;
185
178
  result.module = __require(output.file);
186
- if (options.tmp)
187
- fs.unlinkSync(output.file);
179
+ if (options.tmp) fs.unlinkSync(output.file);
188
180
  if (options.modules) {
189
181
  const modules = /* @__PURE__ */ Object.create(null);
190
182
  Object.keys(dependencies).map((d) => findModule(modules, d, options.modules));
package/dist/index.mjs CHANGED
@@ -8,8 +8,7 @@ import { NodeBuiltinModules, bundle } from '@faasjs/ts-transform';
8
8
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
9
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
10
  }) : x)(function(x) {
11
- if (typeof require !== "undefined")
12
- return require.apply(this, arguments);
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
13
12
  throw Error('Dynamic require of "' + x + '" is not supported');
14
13
  });
15
14
  var Config = class {
@@ -21,8 +20,7 @@ var Config = class {
21
20
  */
22
21
  constructor(root, filename) {
23
22
  this.root = root;
24
- if (!this.root.endsWith(sep))
25
- this.root += sep;
23
+ if (!this.root.endsWith(sep)) this.root += sep;
26
24
  this.filename = filename;
27
25
  const configs = [];
28
26
  const paths = [this.root, "."].concat(
@@ -30,8 +28,7 @@ var Config = class {
30
28
  );
31
29
  paths.reduce((base, path) => {
32
30
  const root2 = join(base, path);
33
- if (root2 === base)
34
- return base;
31
+ if (root2 === base) return base;
35
32
  const faas = join(root2, "faas.yaml");
36
33
  if (existsSync(faas))
37
34
  configs.push(
@@ -104,10 +101,8 @@ function resolveModuleBasePath(moduleName) {
104
101
  return moduleMainFilePath.slice(0, lastIndex + searchForPathSection.length);
105
102
  }
106
103
  function findModule(list, key, options = { excludes: [] }) {
107
- if (list[key])
108
- return;
109
- if (key.startsWith("@types/") || options.excludes.includes(key))
110
- return;
104
+ if (list[key]) return;
105
+ if (key.startsWith("@types/") || options.excludes.includes(key)) return;
111
106
  try {
112
107
  list[key] = dirname(__require.resolve(join(key, "package.json")));
113
108
  } catch (error) {
@@ -118,8 +113,7 @@ function findModule(list, key, options = { excludes: [] }) {
118
113
  console.warn(error2);
119
114
  }
120
115
  }
121
- if (!list[key])
122
- return;
116
+ if (!list[key]) return;
123
117
  const pkg = JSON.parse(
124
118
  readFileSync(join(list[key], "package.json")).toString()
125
119
  );
@@ -130,8 +124,7 @@ function findModule(list, key, options = { excludes: [] }) {
130
124
  for (const key2 of Object.keys(pkg.peerDependenciesMeta)) {
131
125
  if (pkg.peerDependenciesMeta[key2].optional) {
132
126
  const index = deps.indexOf(key2);
133
- if (index >= 0)
134
- deps.splice(index, 1);
127
+ if (index >= 0) deps.splice(index, 1);
135
128
  }
136
129
  }
137
130
  }
@@ -181,8 +174,7 @@ async function loadTs(filename, options = /* @__PURE__ */ Object.create(null)) {
181
174
  const result = /* @__PURE__ */ Object.create(null);
182
175
  result.dependencies = dependencies;
183
176
  result.module = __require(output.file);
184
- if (options.tmp)
185
- unlinkSync(output.file);
177
+ if (options.tmp) unlinkSync(output.file);
186
178
  if (options.modules) {
187
179
  const modules = /* @__PURE__ */ Object.create(null);
188
180
  Object.keys(dependencies).map((d) => findModule(modules, d, options.modules));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/load",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,15 +25,15 @@
25
25
  "rollup": "*"
26
26
  },
27
27
  "peerDependencies": {
28
- "@faasjs/deep_merge": "2.3.1",
29
- "@faasjs/func": "2.3.1",
30
- "@faasjs/ts-transform": "2.3.1"
28
+ "@faasjs/deep_merge": "2.4.0",
29
+ "@faasjs/func": "2.4.0",
30
+ "@faasjs/ts-transform": "2.4.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/js-yaml": "*",
34
- "@faasjs/deep_merge": "2.3.1",
35
- "@faasjs/func": "2.3.1",
36
- "@faasjs/ts-transform": "2.3.1"
34
+ "@faasjs/deep_merge": "2.4.0",
35
+ "@faasjs/func": "2.4.0",
36
+ "@faasjs/ts-transform": "2.4.0"
37
37
  },
38
38
  "engines": {
39
39
  "npm": ">=9.0.0",