zero-com 1.6.6 → 1.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.
@@ -2,7 +2,8 @@
2
2
  "permissions": {
3
3
  "allow": [
4
4
  "Bash(npm run build:*)",
5
- "Bash(npm test)"
5
+ "Bash(npm test)",
6
+ "Bash(grep:*)"
6
7
  ]
7
8
  }
8
9
  }
@@ -0,0 +1,6 @@
1
+ import type { LoaderContext } from 'webpack';
2
+ export interface TurbopackLoaderOptions {
3
+ development?: boolean;
4
+ rootDir?: string;
5
+ }
6
+ export default function turbopackLoader(this: LoaderContext<TurbopackLoaderOptions>, source: string): void;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = turbopackLoader;
7
+ const path_1 = __importDefault(require("path"));
8
+ const common_1 = require("./common");
9
+ // Module-level cache: registry is built once and reused across invocations
10
+ let cachedRegistry = null;
11
+ let cachedRootDir = null;
12
+ function turbopackLoader(source) {
13
+ var _a;
14
+ const options = this.getOptions();
15
+ const filePath = this.resourcePath;
16
+ const rootDir = options.rootDir || this.rootContext || process.cwd();
17
+ const development = (_a = options.development) !== null && _a !== void 0 ? _a : true;
18
+ // Lazily build and cache the registry on first invocation or if rootDir changes
19
+ if (!cachedRegistry || cachedRootDir !== rootDir) {
20
+ cachedRegistry = new Map();
21
+ cachedRootDir = rootDir;
22
+ (0, common_1.buildRegistry)(rootDir, cachedRegistry);
23
+ console.log(`[TurbopackLoader] Found ${cachedRegistry.size} files with server functions`);
24
+ }
25
+ const result = (0, common_1.transformSourceFile)(filePath, source, cachedRegistry, { development });
26
+ if (!result.transformed) {
27
+ this.callback(null, source);
28
+ return;
29
+ }
30
+ console.log(`[TurbopackLoader] Transformed: ${path_1.default.basename(filePath)}`);
31
+ this.callback(null, result.content, result.map);
32
+ }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "zero-com",
3
- "version": "1.6.6",
3
+ "version": "1.7.1",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/yosbelms/zero-com",
6
6
  "keywords": [
7
7
  "webpack",
8
+ "turbopack",
8
9
  "api",
9
10
  "node",
10
11
  "http",