ts-const-value-transformer 0.7.0 → 0.7.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.7.1
4
+
5
+ - Fix to wrap import() with eval to prevent from static analysis
6
+
3
7
  ## v0.7.0
4
8
 
5
9
  - Fix for printing 'minus numeric value' and 'void 0', and remove using `ts.createPrinter`
@@ -133,7 +133,9 @@ export default async function createPortalTransformer(options = {}) {
133
133
  let ts;
134
134
  if (options.typescript != null) {
135
135
  if (typeof options.typescript === 'string') {
136
- ts = (await import(options.typescript));
136
+ // Use eval to avoid webpack warnings
137
+ // eslint-disable-next-line no-eval
138
+ ts = (await eval('import(options.typescript)'));
137
139
  }
138
140
  else {
139
141
  ts = options.typescript;
package/dist/loader.mjs CHANGED
@@ -1,17 +1,17 @@
1
1
  import * as path from 'path';
2
- import { createPortalTransformerSync, } from './createPortalTransformer.mjs';
2
+ import createPortalTransformer, {} from './createPortalTransformer.mjs';
3
3
  const transformerMap = new Map();
4
4
  const loader = function (content, sourceMap) {
5
5
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions, @typescript-eslint/strict-boolean-expressions
6
6
  this.cacheable && this.cacheable();
7
7
  this.async();
8
- void Promise.resolve().then(() => {
8
+ void (async () => {
9
9
  try {
10
10
  const options = this.getOptions() || {};
11
11
  const project = options.project ?? 'tsconfig.json';
12
12
  let transformer = transformerMap.get(project);
13
13
  if (!transformer) {
14
- transformer = createPortalTransformerSync({
14
+ transformer = await createPortalTransformer({
15
15
  cwd: path.dirname(this.resourcePath),
16
16
  ...options,
17
17
  });
@@ -23,6 +23,6 @@ const loader = function (content, sourceMap) {
23
23
  catch (e) {
24
24
  this.callback(e);
25
25
  }
26
- });
26
+ })();
27
27
  };
28
28
  export default loader;
@@ -1,2 +1,2 @@
1
- declare const _default: "0.7.0";
1
+ declare const _default: "0.7.1";
2
2
  export default _default;
package/dist/version.mjs CHANGED
@@ -1 +1 @@
1
- export default '0.7.0';
1
+ export default '0.7.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-const-value-transformer",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "engines": {
5
5
  "node": ">=20.19.3"
6
6
  },