@unrift/core 0.0.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/LICENSE +21 -0
- package/bin/unrift.mjs +5 -0
- package/dist/cjs/index.cjs +31 -0
- package/dist/esm/cli.d.ts +3 -0
- package/dist/esm/cli.d.ts.map +1 -0
- package/dist/esm/cli.js +87 -0
- package/dist/esm/context.d.ts +15 -0
- package/dist/esm/context.d.ts.map +1 -0
- package/dist/esm/context.js +16 -0
- package/dist/esm/expect.d.ts +27 -0
- package/dist/esm/expect.d.ts.map +1 -0
- package/dist/esm/expect.js +43 -0
- package/dist/esm/hooks.d.ts +8 -0
- package/dist/esm/hooks.d.ts.map +1 -0
- package/dist/esm/hooks.js +18 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/injected/globals.d.ts +4 -0
- package/dist/esm/injected/globals.d.ts.map +1 -0
- package/dist/esm/injected/globals.js +6 -0
- package/dist/esm/interface.d.ts +18 -0
- package/dist/esm/interface.d.ts.map +1 -0
- package/dist/esm/interface.js +29 -0
- package/dist/esm/matchers.d.ts +2 -0
- package/dist/esm/matchers.d.ts.map +1 -0
- package/dist/esm/matchers.js +81 -0
- package/dist/esm/run.d.ts +21 -0
- package/dist/esm/run.d.ts.map +1 -0
- package/dist/esm/run.js +57 -0
- package/dist/esm/runner.d.ts +14 -0
- package/dist/esm/runner.d.ts.map +1 -0
- package/dist/esm/runner.js +207 -0
- package/dist/esm/suite.d.ts +58 -0
- package/dist/esm/suite.d.ts.map +1 -0
- package/dist/esm/suite.js +281 -0
- package/dist/esm/test.d.ts +18 -0
- package/dist/esm/test.d.ts.map +1 -0
- package/dist/esm/test.js +52 -0
- package/dist/esm/types.d.ts +24 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +16 -0
- package/dist/esm/utils/colors.d.ts +7 -0
- package/dist/esm/utils/colors.d.ts.map +1 -0
- package/dist/esm/utils/colors.js +12 -0
- package/dist/esm/utils/deepEqual.d.ts +9 -0
- package/dist/esm/utils/deepEqual.d.ts.map +1 -0
- package/dist/esm/utils/deepEqual.js +201 -0
- package/dist/esm/utils/defineConfig.d.ts +12 -0
- package/dist/esm/utils/defineConfig.d.ts.map +1 -0
- package/dist/esm/utils/defineConfig.js +3 -0
- package/dist/esm/utils/discoverTestFiles.d.ts +3 -0
- package/dist/esm/utils/discoverTestFiles.d.ts.map +1 -0
- package/dist/esm/utils/discoverTestFiles.js +22 -0
- package/dist/esm/utils/helpers.d.ts +13 -0
- package/dist/esm/utils/helpers.d.ts.map +1 -0
- package/dist/esm/utils/helpers.js +29 -0
- package/dist/esm/utils/loadConfig.d.ts +9 -0
- package/dist/esm/utils/loadConfig.d.ts.map +1 -0
- package/dist/esm/utils/loadConfig.js +89 -0
- package/dist/esm/utils/looseEqual.d.ts +2 -0
- package/dist/esm/utils/looseEqual.d.ts.map +1 -0
- package/dist/esm/utils/looseEqual.js +205 -0
- package/dist/esm/utils/toThrow.d.ts +11 -0
- package/dist/esm/utils/toThrow.d.ts.map +1 -0
- package/dist/esm/utils/toThrow.js +93 -0
- package/dist/esm/utils/transform.d.ts +10 -0
- package/dist/esm/utils/transform.d.ts.map +1 -0
- package/dist/esm/utils/transform.js +213 -0
- package/package.json +60 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
function isErrorConstructor(err) {
|
|
2
|
+
return typeof err === "function";
|
|
3
|
+
}
|
|
4
|
+
function formatThrown(thrown) {
|
|
5
|
+
if (thrown instanceof Error) {
|
|
6
|
+
const name = thrown.name || "Error";
|
|
7
|
+
const msg = thrown.message ?? "";
|
|
8
|
+
return msg ? `${name}: ${msg}` : name;
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
return typeof thrown === "string" ? thrown : JSON.stringify(thrown);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return String(thrown);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function matchThrown(thrown, expected) {
|
|
18
|
+
if (expected === undefined)
|
|
19
|
+
return true;
|
|
20
|
+
const msg = thrown instanceof Error ? thrown.message : String(thrown);
|
|
21
|
+
// toThrow("substring")
|
|
22
|
+
if (typeof expected === "string") {
|
|
23
|
+
return msg.includes(expected);
|
|
24
|
+
}
|
|
25
|
+
// toThrow(/regex/)
|
|
26
|
+
if (expected instanceof RegExp) {
|
|
27
|
+
return expected.test(msg);
|
|
28
|
+
}
|
|
29
|
+
// toThrow(ErrorClass)
|
|
30
|
+
if (isErrorConstructor(expected)) {
|
|
31
|
+
return thrown instanceof expected;
|
|
32
|
+
}
|
|
33
|
+
// toThrow({ name?, message? })
|
|
34
|
+
if (expected && typeof expected === "object") {
|
|
35
|
+
if (expected.name) {
|
|
36
|
+
const thrownName = thrown instanceof Error ? thrown.name : undefined;
|
|
37
|
+
if (thrownName !== expected.name)
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (expected.message !== undefined) {
|
|
41
|
+
if (typeof expected.message === "string") {
|
|
42
|
+
if (!msg.includes(expected.message))
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
if (!expected.message.test(msg))
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
export function toThrow(received, expected, isNot = false) {
|
|
55
|
+
if (typeof received !== "function") {
|
|
56
|
+
return {
|
|
57
|
+
pass: false,
|
|
58
|
+
message: () => `toThrow() expects a function as the received value, but got ${typeof received}.`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
let threw = false;
|
|
62
|
+
let thrown;
|
|
63
|
+
try {
|
|
64
|
+
received();
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
threw = true;
|
|
68
|
+
thrown = e;
|
|
69
|
+
}
|
|
70
|
+
const matched = threw && matchThrown(thrown, expected);
|
|
71
|
+
const pass = isNot ? !matched : matched;
|
|
72
|
+
return {
|
|
73
|
+
pass,
|
|
74
|
+
message: () => {
|
|
75
|
+
const expectation = isNot ? "not to throw" : "to throw";
|
|
76
|
+
if (!threw) {
|
|
77
|
+
return `Expected function ${expectation}, but it did not throw.`;
|
|
78
|
+
}
|
|
79
|
+
const thrownStr = formatThrown(thrown);
|
|
80
|
+
if (expected === undefined) {
|
|
81
|
+
return `Expected function ${expectation}, but it threw: ${thrownStr}`;
|
|
82
|
+
}
|
|
83
|
+
const expectedStr = typeof expected === "string"
|
|
84
|
+
? `"${expected}"`
|
|
85
|
+
: expected instanceof RegExp
|
|
86
|
+
? expected.toString()
|
|
87
|
+
: isErrorConstructor(expected)
|
|
88
|
+
? expected.name || "[AnonymousErrorConstructor]"
|
|
89
|
+
: JSON.stringify(expected);
|
|
90
|
+
return `Expected function ${expectation} ${expectedStr}, but it threw: ${thrownStr}`;
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function cleanUnriftCaches(projectRoot: string): {
|
|
2
|
+
projectCacheDir: string;
|
|
3
|
+
tempCacheDir: string;
|
|
4
|
+
projectCacheDeleted: boolean;
|
|
5
|
+
tempCacheDeleted: boolean;
|
|
6
|
+
};
|
|
7
|
+
type Mode = "bundle-config" | "bundle-test";
|
|
8
|
+
export declare function toImportUrl(filePath: string, mode?: Mode): string;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/utils/transform.ts"],"names":[],"mappings":"AAuIA,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG;IACtD,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAgBA;AAED,KAAK,IAAI,GAAG,eAAe,GAAG,aAAa,CAAC;AAqE5C,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,IAAoB,GACzB,MAAM,CAyDR"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { buildSync } from "esbuild";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, symlinkSync, lstatSync, realpathSync, rmSync, } from "node:fs";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import { join, basename, extname, resolve, dirname, sep } from "node:path";
|
|
6
|
+
import { pathToFileURL, fileURLToPath } from "node:url";
|
|
7
|
+
const injectedFilename = fileURLToPath(import.meta.url);
|
|
8
|
+
const injectedDirname = dirname(injectedFilename);
|
|
9
|
+
function resolveInjectedGlobals() {
|
|
10
|
+
return resolve(injectedDirname, "../injected/globals.js");
|
|
11
|
+
}
|
|
12
|
+
function ensureDir(dir) {
|
|
13
|
+
mkdirSync(dir, { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
function hashString(input) {
|
|
16
|
+
return createHash("sha256").update(input).digest("hex").slice(0, 16);
|
|
17
|
+
}
|
|
18
|
+
function isTsLike(file) {
|
|
19
|
+
return (file.endsWith(".ts") ||
|
|
20
|
+
file.endsWith(".tsx") ||
|
|
21
|
+
file.endsWith(".mts") ||
|
|
22
|
+
file.endsWith(".cts"));
|
|
23
|
+
}
|
|
24
|
+
// Find the nearest package.json upward from a file’s folder
|
|
25
|
+
function findProjectRoot(startDir) {
|
|
26
|
+
let dir = resolve(startDir);
|
|
27
|
+
while (true) {
|
|
28
|
+
if (existsSync(join(dir, "package.json")))
|
|
29
|
+
return dir;
|
|
30
|
+
const parent = resolve(dir, "..");
|
|
31
|
+
if (parent === dir)
|
|
32
|
+
return resolve(startDir);
|
|
33
|
+
dir = parent;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function readPackageName(projectRoot) {
|
|
37
|
+
try {
|
|
38
|
+
const raw = readFileSync(join(projectRoot, "package.json"), "utf8");
|
|
39
|
+
const json = JSON.parse(raw);
|
|
40
|
+
return typeof json.name === "string" ? json.name : null;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function tryProjectCacheRoot(projectRoot) {
|
|
47
|
+
const nodeModulesCache = projectNodeModulesCacheRoot(projectRoot);
|
|
48
|
+
try {
|
|
49
|
+
ensureDir(nodeModulesCache);
|
|
50
|
+
return nodeModulesCache;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function getTmpCacheRoot(projectRoot) {
|
|
57
|
+
const projectKey = hashString(resolve(projectRoot));
|
|
58
|
+
const tmpCache = join(os.tmpdir(), "unrift", projectKey);
|
|
59
|
+
ensureDir(tmpCache);
|
|
60
|
+
return tmpCache;
|
|
61
|
+
}
|
|
62
|
+
function pathExists(path) {
|
|
63
|
+
try {
|
|
64
|
+
lstatSync(path);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// True if child is inside parent (after resolving symlinks when possible).
|
|
72
|
+
function isSubpath(child, parent) {
|
|
73
|
+
const parentReal = safeRealpath(parent);
|
|
74
|
+
const childReal = safeRealpath(child);
|
|
75
|
+
const p = parentReal.endsWith(sep) ? parentReal : parentReal + sep;
|
|
76
|
+
return childReal === parentReal || childReal.startsWith(p);
|
|
77
|
+
}
|
|
78
|
+
function safeRealpath(p) {
|
|
79
|
+
try {
|
|
80
|
+
return realpathSync(p);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return resolve(p);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function projectNodeModulesCacheRoot(projectRoot) {
|
|
87
|
+
return join(projectRoot, "node_modules", ".unrift", "cache");
|
|
88
|
+
}
|
|
89
|
+
function tempCacheRootForProject(projectRoot) {
|
|
90
|
+
const projectKey = hashString(resolve(projectRoot));
|
|
91
|
+
return getTmpCacheRoot(projectKey);
|
|
92
|
+
}
|
|
93
|
+
function rmDirIfExists(dir) {
|
|
94
|
+
try {
|
|
95
|
+
if (!existsSync(dir))
|
|
96
|
+
return false;
|
|
97
|
+
rmSync(dir, { recursive: true, force: true });
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// Don’t fail test runs because cleanup failed
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export function cleanUnriftCaches(projectRoot) {
|
|
106
|
+
const projectCacheDir = projectNodeModulesCacheRoot(projectRoot);
|
|
107
|
+
const tempCacheDir = tempCacheRootForProject(projectRoot);
|
|
108
|
+
const projectCacheDeleted = rmDirIfExists(projectCacheDir);
|
|
109
|
+
const tempCacheDeleted = rmDirIfExists(tempCacheDir);
|
|
110
|
+
// Clear in-memory cache
|
|
111
|
+
cache.clear();
|
|
112
|
+
return {
|
|
113
|
+
projectCacheDir,
|
|
114
|
+
tempCacheDir,
|
|
115
|
+
projectCacheDeleted,
|
|
116
|
+
tempCacheDeleted,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const cache = new Map();
|
|
120
|
+
function cacheDirForMode(cacheRoot, mode) {
|
|
121
|
+
return join(cacheRoot, mode === "bundle-config" ? "config" : "tests");
|
|
122
|
+
}
|
|
123
|
+
function cacheOutPath(cacheDir, filePath, h) {
|
|
124
|
+
const base = basename(filePath, extname(filePath));
|
|
125
|
+
const pathHash = hashString(resolve(filePath));
|
|
126
|
+
return join(cacheDir, `${base}.${pathHash}.${h}.mjs`);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Create <cacheRoot>/node_modules/@unrift/core -> <projectRoot>
|
|
130
|
+
* so cached bundles can resolve @unrift/core when self-hosting.
|
|
131
|
+
*/
|
|
132
|
+
function ensureSelfLink(cacheRoot, projectRoot) {
|
|
133
|
+
// HARD SAFETY: never allow a self-link inside a cacheRoot that lives in the project
|
|
134
|
+
if (isSubpath(cacheRoot, projectRoot)) {
|
|
135
|
+
throw new Error(`Unrift internal: refusing to create self-host link because cacheRoot is inside projectRoot.\n` +
|
|
136
|
+
`cacheRoot: ${cacheRoot}\nprojectRoot: ${projectRoot}\n` +
|
|
137
|
+
`This would create a recursive directory cycle. Use temp cache for self-hosting.`);
|
|
138
|
+
}
|
|
139
|
+
const nodeModules = join(cacheRoot, "node_modules");
|
|
140
|
+
const scopeDir = join(nodeModules, "@unrift");
|
|
141
|
+
const linkPath = join(scopeDir, "core");
|
|
142
|
+
ensureDir(scopeDir);
|
|
143
|
+
if (pathExists(linkPath))
|
|
144
|
+
return;
|
|
145
|
+
const type = process.platform === "win32" ? "junction" : "dir";
|
|
146
|
+
symlinkSync(projectRoot, linkPath, type);
|
|
147
|
+
}
|
|
148
|
+
function pickCacheRoot(projectRoot, selfHost) {
|
|
149
|
+
const fromEnv = process.env.UNRIFT_CACHE_DIR;
|
|
150
|
+
if (fromEnv) {
|
|
151
|
+
const envPath = resolve(fromEnv);
|
|
152
|
+
// If self-hosting and env points inside project, ignore it to prevent cycles.
|
|
153
|
+
if (selfHost && isSubpath(envPath, projectRoot)) {
|
|
154
|
+
return getTmpCacheRoot(projectRoot);
|
|
155
|
+
}
|
|
156
|
+
return envPath;
|
|
157
|
+
}
|
|
158
|
+
// Normal users: prefer project-local cache
|
|
159
|
+
const projectCache = tryProjectCacheRoot(projectRoot);
|
|
160
|
+
// Self-host: need to avoid project-local cache if we need the self-link bridge
|
|
161
|
+
if (selfHost) {
|
|
162
|
+
return getTmpCacheRoot(projectRoot);
|
|
163
|
+
}
|
|
164
|
+
if (projectCache)
|
|
165
|
+
return projectCache;
|
|
166
|
+
return getTmpCacheRoot(projectRoot);
|
|
167
|
+
}
|
|
168
|
+
export function toImportUrl(filePath, mode = "bundle-test") {
|
|
169
|
+
if (!isTsLike(filePath))
|
|
170
|
+
return pathToFileURL(filePath).href;
|
|
171
|
+
const source = readFileSync(filePath, "utf8");
|
|
172
|
+
const hashStr = hashString(source);
|
|
173
|
+
const key = `${mode}:${filePath}`;
|
|
174
|
+
const existing = cache.get(key);
|
|
175
|
+
if (existing && existing.hash === hashStr)
|
|
176
|
+
return existing.outUrl;
|
|
177
|
+
const projectRoot = findProjectRoot(dirname(filePath));
|
|
178
|
+
const selfHost = readPackageName(projectRoot) === "@unrift/core";
|
|
179
|
+
const cacheRoot = pickCacheRoot(projectRoot, selfHost);
|
|
180
|
+
if (process.env.UNRIFT_DEBUG === "1") {
|
|
181
|
+
console.log("[unrift] cacheRoot:", cacheRoot, "selfHost:", selfHost);
|
|
182
|
+
}
|
|
183
|
+
// Only create the self-link in safe cache roots (temp/env outside project)
|
|
184
|
+
if (selfHost) {
|
|
185
|
+
ensureSelfLink(cacheRoot, projectRoot);
|
|
186
|
+
}
|
|
187
|
+
const outDir = cacheDirForMode(cacheRoot, mode);
|
|
188
|
+
ensureDir(outDir);
|
|
189
|
+
const outFile = cacheOutPath(outDir, filePath, hashStr);
|
|
190
|
+
buildSync({
|
|
191
|
+
entryPoints: [filePath],
|
|
192
|
+
outfile: outFile,
|
|
193
|
+
bundle: true,
|
|
194
|
+
format: "esm",
|
|
195
|
+
platform: "node",
|
|
196
|
+
target: "node18",
|
|
197
|
+
packages: "external",
|
|
198
|
+
external: ["@unrift/*", "@unrift/core", "@unrift/core/*"],
|
|
199
|
+
absWorkingDir: projectRoot,
|
|
200
|
+
inject: [resolveInjectedGlobals()],
|
|
201
|
+
define: {
|
|
202
|
+
__dirname: "injectedDirname",
|
|
203
|
+
__filename: "injectedFilename",
|
|
204
|
+
require: "injectedRequire",
|
|
205
|
+
},
|
|
206
|
+
sourcemap: "inline",
|
|
207
|
+
sourcesContent: true,
|
|
208
|
+
logLevel: "silent",
|
|
209
|
+
});
|
|
210
|
+
const outUrl = pathToFileURL(outFile).href;
|
|
211
|
+
cache.set(key, { hash: hashStr, outUrl });
|
|
212
|
+
return outUrl;
|
|
213
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unrift/core",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "unrift core package",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "./dist/cjs/index.cjs",
|
|
7
|
+
"module": "./dist/esm/index.js",
|
|
8
|
+
"types": "./dist/esm/index.d.ts",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"bin"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./dist/esm/index.js",
|
|
17
|
+
"require": "./dist/cjs/index.cjs",
|
|
18
|
+
"types": "./dist/esm/index.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./cli": {
|
|
21
|
+
"import": "./dist/esm/cli.js",
|
|
22
|
+
"types": "./dist/esm/cli.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./run": {
|
|
25
|
+
"import": "./dist/esm/run.js",
|
|
26
|
+
"types": "./dist/esm/run.d.ts"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"bin": {
|
|
30
|
+
"unrift": "./bin/unrift.mjs"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [],
|
|
33
|
+
"author": "elijah kotyluk <elijah@elijahkotyluk.com>",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/elijahkotyluk/unrift"
|
|
37
|
+
},
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"esbuild": "^0.27.2"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"ts-node": "^10.9.2",
|
|
44
|
+
"typescript": "^5.9.3"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "pnpm build:esm && node scripts/write-cjs-shim.js",
|
|
48
|
+
"build:esm": "tsc -p tsconfig.build.esm.json && node scripts/patch-esm-extensions.js",
|
|
49
|
+
"clean": "rm -rf ./dist",
|
|
50
|
+
"compile": "tsc -p tsconfig.build.json && node scripts/patch-esm-extensions.js",
|
|
51
|
+
"test": "pnpm test:internal && pnpm test:fail && pnpm test:bail && pnpm test:only",
|
|
52
|
+
"test:bail": "node bin/unrift.mjs --config ./test/bail/unrift.outer.config.ts",
|
|
53
|
+
"test:fail": "node bin/unrift.mjs --config ./test/fail/unrift.outer.config.ts",
|
|
54
|
+
"test:hooks": "node bin/unrift.mjs --config ./test/hooks/unrift.outer.config.ts",
|
|
55
|
+
"test:internal": "node bin/unrift.mjs --config ./test/internal/unrift.config.ts",
|
|
56
|
+
"test:only": "node bin/unrift.mjs --config ./test/only/unrift.outer.config.ts",
|
|
57
|
+
"test:publish": "pnpm clean && pnpm build && pnpm pack --pack-destination ./dist-pack",
|
|
58
|
+
"typecheck": "tsc -p tsconfig.build.esm.json --noEmit"
|
|
59
|
+
}
|
|
60
|
+
}
|