@granite-js/vitest 1.0.21 → 1.0.22

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.22
4
+
5
+ ### Patch Changes
6
+
7
+ - 3553158: feat(vitest): fast-flow-transform -> flow-remove-types
8
+
3
9
  ## 1.0.21
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import path from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import * as vite from "vitest/node";
7
7
  import { createHash } from "node:crypto";
8
- import transform from "fast-flow-transform";
8
+ import flowRemoveTypes from "flow-remove-types";
9
9
 
10
10
  //#region src/transpile.ts
11
11
  const REACT_NATIVE_TRANSFORM_EXTENSIONS = [
@@ -40,16 +40,12 @@ function shouldInlineReactNativeDependency(filename, packageRoots = []) {
40
40
  if (packageRoots.length > 0) return isWithinPackageRoots(normalized, packageRoots);
41
41
  return REACT_NATIVE_TRANSFORM_ALLOWLIST.some((allowlistEntry) => normalized.includes(`/${allowlistEntry}/`));
42
42
  }
43
- async function transformReactNativeSource(sourcePath, source) {
44
- return (await transform({
45
- filename: sourcePath,
46
- source,
47
- dialect: "flow-detect",
48
- format: "compact",
49
- comments: false,
50
- reactRuntimeTarget: "19",
51
- sourcemap: false
52
- })).code;
43
+ async function transformReactNativeSource(_sourcePath, source) {
44
+ return flowRemoveTypes(source, {
45
+ all: true,
46
+ pretty: true,
47
+ removeEmptyImports: true
48
+ }).toString();
53
49
  }
54
50
 
55
51
  //#endregion
@@ -73,11 +69,9 @@ const DEFAULT_VITEST_CACHE_DIRECTORY = ".vitest";
73
69
  const MIRROR_CACHE_KEY_VERSION = "v1";
74
70
  const currentMirrorModulePath = fs.realpathSync(fileURLToPath(import.meta.url));
75
71
  const currentMirrorModuleDirectory = path.dirname(currentMirrorModulePath);
76
- function getFastFlowTransformVersion() {
77
- const fastFlowTransformEntryPath = createRequire(import.meta.url).resolve("fast-flow-transform");
78
- const fastFlowTransformPackageRoot = path.dirname(path.dirname(fastFlowTransformEntryPath));
79
- const fastFlowTransformPackageJsonPath = path.join(fastFlowTransformPackageRoot, "package.json");
80
- return JSON.parse(fs.readFileSync(fastFlowTransformPackageJsonPath, "utf8")).version ?? "unknown";
72
+ function getFlowRemoveTypesVersion() {
73
+ const flowRemoveTypesPackageJsonPath = createRequire(import.meta.url).resolve("flow-remove-types/package.json");
74
+ return JSON.parse(fs.readFileSync(flowRemoveTypesPackageJsonPath, "utf8")).version ?? "unknown";
81
75
  }
82
76
  function getPackageManifestDependencyNames(packageManifest) {
83
77
  return Object.keys({
@@ -140,10 +134,10 @@ function computeReactNativeMirrorCacheKey(workspaceRoot) {
140
134
  const hasher = createHash("sha256");
141
135
  const packageRoots = resolveReactNativePackageRoots(workspaceRoot).sort();
142
136
  const transformImplementationHash = hashImplementationFiles();
143
- const transformDependencyVersions = { fastFlowTransform: getFastFlowTransformVersion() };
137
+ const transformDependencyVersions = { flowRemoveTypes: getFlowRemoveTypesVersion() };
144
138
  hasher.update(`granite-vitest-rn-cache:${MIRROR_CACHE_KEY_VERSION}`);
145
139
  hasher.update("\0");
146
- hasher.update(`fast-flow-transform:${transformDependencyVersions.fastFlowTransform}`);
140
+ hasher.update(`flow-remove-types:${transformDependencyVersions.flowRemoveTypes}`);
147
141
  hasher.update("\0");
148
142
  hasher.update(`transform:${transformImplementationHash}`);
149
143
  hasher.update("\0");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@granite-js/vitest",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "type": "module",
5
5
  "description": "Vitest helpers for React Native",
6
6
  "types": "./dist/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "build": "tsdown"
27
27
  },
28
28
  "dependencies": {
29
- "fast-flow-transform": "0.0.3"
29
+ "flow-remove-types": "2.291.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "24.10.12",