@ttoss/cloudformation 0.9.4 → 0.9.5

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/esm/index.js CHANGED
@@ -1,10 +1,4 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- var __require = /* @__PURE__ */(x => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
- }) : x)(function (x) {
5
- if (typeof require !== "undefined") return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
2
 
9
3
  // src/findAndReadCloudFormationTemplate.ts
10
4
  import * as fs3 from "fs";
@@ -168,6 +162,8 @@ var readCloudFormationYamlTemplate = ({
168
162
  };
169
163
 
170
164
  // src/readObjectFile.ts
165
+ import { createRequire } from "node:module";
166
+ import { register } from "ts-node";
171
167
  import fs2 from "fs";
172
168
  import yaml2 from "js-yaml";
173
169
  var readYaml = ({
@@ -182,9 +178,10 @@ var readObjectFile = ({
182
178
  if (!fs2.existsSync(path3)) {
183
179
  return {};
184
180
  }
181
+ const require2 = createRequire(require('url').pathToFileURL(__filename).toString());
185
182
  const extension = path3.split(".").pop();
186
183
  if (extension === "ts") {
187
- __require("ts-node").register({
184
+ register({
188
185
  compilerOptions: {
189
186
  moduleResolution: "node",
190
187
  module: "commonjs"
@@ -194,16 +191,16 @@ var readObjectFile = ({
194
191
  },
195
192
  transpileOnly: true
196
193
  });
197
- const tsObj = __require(path3);
194
+ const tsObj = require2(path3);
198
195
  const obj = tsObj.default || tsObj;
199
196
  return typeof obj === "function" ? obj() : obj;
200
197
  }
201
198
  if (extension === "js") {
202
- const obj = __require(path3);
199
+ const obj = require2(path3);
203
200
  return typeof obj === "function" ? obj() : obj;
204
201
  }
205
202
  if (extension === "json") {
206
- return __require(path3);
203
+ return require2(path3);
207
204
  }
208
205
  if (extension === "yml" || extension === "yaml") {
209
206
  return readYaml({
package/dist/index.js CHANGED
@@ -205,8 +205,11 @@ var readCloudFormationYamlTemplate = ({
205
205
  };
206
206
 
207
207
  // src/readObjectFile.ts
208
+ var import_node_module = require("module");
209
+ var import_ts_node = require("ts-node");
208
210
  var import_fs = __toESM(require("fs"));
209
211
  var import_js_yaml2 = __toESM(require("js-yaml"));
212
+ var import_meta = {};
210
213
  var readYaml = ({
211
214
  path: path3
212
215
  }) => {
@@ -219,9 +222,10 @@ var readObjectFile = ({
219
222
  if (!import_fs.default.existsSync(path3)) {
220
223
  return {};
221
224
  }
225
+ const require2 = (0, import_node_module.createRequire)(import_meta.url);
222
226
  const extension = path3.split(".").pop();
223
227
  if (extension === "ts") {
224
- require("ts-node").register({
228
+ (0, import_ts_node.register)({
225
229
  compilerOptions: {
226
230
  moduleResolution: "node",
227
231
  module: "commonjs"
@@ -231,16 +235,16 @@ var readObjectFile = ({
231
235
  },
232
236
  transpileOnly: true
233
237
  });
234
- const tsObj = require(path3);
238
+ const tsObj = require2(path3);
235
239
  const obj = tsObj.default || tsObj;
236
240
  return typeof obj === "function" ? obj() : obj;
237
241
  }
238
242
  if (extension === "js") {
239
- const obj = require(path3);
243
+ const obj = require2(path3);
240
244
  return typeof obj === "function" ? obj() : obj;
241
245
  }
242
246
  if (extension === "json") {
243
- return require(path3);
247
+ return require2(path3);
244
248
  }
245
249
  if (extension === "yml" || extension === "yaml") {
246
250
  return readYaml({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/cloudformation",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "CloudFormation utils.",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -32,8 +32,8 @@
32
32
  "@types/node": "^20.12.7",
33
33
  "jest": "^29.7.0",
34
34
  "tsup": "^8.0.2",
35
- "@ttoss/config": "^1.32.1",
36
- "@ttoss/test-utils": "^2.1.4"
35
+ "@ttoss/config": "^1.32.2",
36
+ "@ttoss/test-utils": "^2.1.5"
37
37
  },
38
38
  "keywords": [],
39
39
  "publishConfig": {
@@ -1,4 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-var-requires */
2
+ import { createRequire } from 'node:module';
3
+ import { register } from 'ts-node';
2
4
  import fs from 'fs';
3
5
  import yaml from 'js-yaml';
4
6
 
@@ -12,10 +14,12 @@ export const readObjectFile = ({ path }: { path: string }) => {
12
14
  return {};
13
15
  }
14
16
 
17
+ const require = createRequire(import.meta.url);
18
+
15
19
  const extension = path.split('.').pop();
16
20
 
17
21
  if (extension === 'ts') {
18
- require('ts-node').register({
22
+ register({
19
23
  compilerOptions: { moduleResolution: 'node', module: 'commonjs' },
20
24
  moduleTypes: {
21
25
  'carlin.*': 'cjs',