@untestutils/remix 0.5.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 s00d
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,15 @@
1
+ import { type FrameworkBaseOptions } from '@untestutils/core';
2
+ export type RemixRun = 'server' | 'dev';
3
+ export interface RemixOptions extends FrameworkBaseOptions {
4
+ run?: RemixRun;
5
+ /** Server build entry relative to root (default `build/server/index.js`). */
6
+ serverEntry?: string;
7
+ }
8
+ /**
9
+ * Remix (Vite) Recipe factory.
10
+ * `run: 'server'` (default) — vite/remix build + remix-serve
11
+ * `run: 'dev'` — remix vite:dev / vite
12
+ */
13
+ export declare function remix(opts: RemixOptions): import("@untestutils/core").Recipe;
14
+ export default remix;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;AAExC,MAAM,WAAW,YAAa,SAAQ,oBAAoB;IACxD,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAgCD;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,YAAY,sCAiFvC;AAED,eAAe,KAAK,CAAC"}
package/dist/index.mjs ADDED
@@ -0,0 +1,131 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join, resolve } from "pathe";
3
+ import { cliFrameworkRecipe, frameworkRoots, resolveBin } from "@untestutils/core";
4
+ function resolveRemixCli(root) {
5
+ return resolveBin({
6
+ label: "remix",
7
+ roots: frameworkRoots(root),
8
+ directIds: ["@remix-run/dev/dist/cli.js", "@remix-run/dev/cli.js"],
9
+ packageJsonIds: ["@remix-run/dev/package.json"],
10
+ binRelative: ["dist/cli.js", "cli.js"]
11
+ });
12
+ }
13
+ function resolveRemixServe(root) {
14
+ return resolveBin({
15
+ label: "remix",
16
+ roots: frameworkRoots(root),
17
+ directIds: ["@remix-run/serve/dist/cli.js", "remix-serve"],
18
+ packageJsonIds: ["@remix-run/serve/package.json"],
19
+ binRelative: ["dist/cli.js", "bin.js"]
20
+ });
21
+ }
22
+ function resolveViteBin(root) {
23
+ return resolveBin({
24
+ label: "remix",
25
+ roots: frameworkRoots(root),
26
+ directIds: ["vite/bin/vite.js", "vite/bin/vite.mjs"],
27
+ packageJsonIds: ["vite/package.json"],
28
+ binRelative: ["bin/vite.js", "bin/vite.mjs"]
29
+ });
30
+ }
31
+
32
+ export function remix(opts) {
33
+ const root = resolve(opts.root);
34
+ const runMode = opts.run ?? "server";
35
+ const id = opts.id ?? `remix-${runMode}-${root.split("/").pop()}`;
36
+ const serverEntry = opts.serverEntry ?? join("build", "server", "index.js");
37
+ if (runMode === "dev") {
38
+ return cliFrameworkRecipe({
39
+ id,
40
+ root,
41
+ label: "remix",
42
+ share: "never",
43
+ env: opts.env,
44
+ hashInputs: opts.hashInputs ?? [root, "run:dev"],
45
+ readyPath: opts.readyPath,
46
+ readyTimeoutMs: opts.readyTimeoutMs,
47
+ start: ({ port }) => {
48
+
49
+ try {
50
+ const cli = resolveRemixCli(root);
51
+ return {
52
+ command: process.execPath,
53
+ args: [
54
+ cli,
55
+ "vite:dev",
56
+ "--port",
57
+ String(port)
58
+ ],
59
+ cwd: root,
60
+ env: { PORT: String(port) }
61
+ };
62
+ } catch {
63
+ const vite = resolveViteBin(root);
64
+ return {
65
+ command: process.execPath,
66
+ args: [
67
+ vite,
68
+ "--port",
69
+ String(port),
70
+ "--strictPort",
71
+ "--host",
72
+ "127.0.0.1"
73
+ ],
74
+ cwd: root
75
+ };
76
+ }
77
+ }
78
+ });
79
+ }
80
+ return cliFrameworkRecipe({
81
+ id,
82
+ root,
83
+ label: "remix",
84
+ share: "always",
85
+ env: opts.env,
86
+ hashInputs: opts.hashInputs ?? [
87
+ root,
88
+ "run:server",
89
+ serverEntry
90
+ ],
91
+ readyPath: opts.readyPath,
92
+ readyTimeoutMs: opts.readyTimeoutMs,
93
+ prepare: () => {
94
+ try {
95
+ const cli = resolveRemixCli(root);
96
+ return {
97
+ command: process.execPath,
98
+ args: [cli, "vite:build"],
99
+ cwd: root
100
+ };
101
+ } catch {
102
+ const vite = resolveViteBin(root);
103
+ return {
104
+ command: process.execPath,
105
+ args: [vite, "build"],
106
+ cwd: root
107
+ };
108
+ }
109
+ },
110
+ verifyAfterPrepare: () => {
111
+ const entry = join(root, serverEntry);
112
+ if (!existsSync(entry)) {
113
+ throw new Error(`[untestutils/remix] server build missing at ${entry}`);
114
+ }
115
+ return Promise.resolve();
116
+ },
117
+ start: ({ port, host }) => {
118
+ const serve = resolveRemixServe(root);
119
+ return {
120
+ command: process.execPath,
121
+ args: [serve, join(root, serverEntry)],
122
+ cwd: root,
123
+ env: {
124
+ PORT: String(port),
125
+ HOST: host
126
+ }
127
+ };
128
+ }
129
+ });
130
+ }
131
+ export default remix;
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@untestutils/remix",
3
+ "version": "0.5.0",
4
+ "files": [
5
+ "dist"
6
+ ],
7
+ "type": "module",
8
+ "sideEffects": false,
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "default": "./dist/index.mjs"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "dependencies": {
18
+ "pathe": "^2.0.3",
19
+ "@untestutils/core": "0.5.0"
20
+ },
21
+ "devDependencies": {
22
+ "@types/node": "^26.6.1",
23
+ "publint": "^0.3.24",
24
+ "typescript": "^6.0.3",
25
+ "obuild": "^0.4.40"
26
+ },
27
+ "peerDependencies": {
28
+ "@remix-run/dev": "*",
29
+ "@remix-run/node": "*",
30
+ "@remix-run/serve": "*"
31
+ },
32
+ "peerDependenciesMeta": {
33
+ "@remix-run/dev": {
34
+ "optional": true
35
+ },
36
+ "@remix-run/node": {
37
+ "optional": true
38
+ },
39
+ "@remix-run/serve": {
40
+ "optional": true
41
+ },
42
+ "vite": {
43
+ "optional": true
44
+ }
45
+ },
46
+ "engines": {
47
+ "node": ">=20"
48
+ },
49
+ "license": "MIT",
50
+ "homepage": "https://s00d.github.io/untestutils/",
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/s00d/untestutils.git",
54
+ "directory": "packages/remix"
55
+ },
56
+ "main": "./dist/index.mjs",
57
+ "types": "./dist/index.d.ts",
58
+ "publishConfig": {
59
+ "access": "public"
60
+ },
61
+ "scripts": {
62
+ "build": "obuild && tsc -p tsconfig.build.json",
63
+ "publint": "publint --strict"
64
+ }
65
+ }