ignotum 0.0.17 → 0.0.18
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/dist/cli/bin.mjs +10 -4
- package/dist/cli/bin.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cli/command.ts +1 -0
- package/src/cli/path.ts +11 -0
- package/src/cli/route-codegen.ts +2 -1
- package/src/cli/route-static.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ignotum",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "Ignotum is an opinionated TypeScript application cloud.",
|
|
5
5
|
"author": "Johannes Schießl",
|
|
6
6
|
"repository": {
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"redis": "6.2.1",
|
|
113
113
|
"@ignotum/contracts": "1.0.0",
|
|
114
114
|
"@ignotum/platform": "1.0.0",
|
|
115
|
-
"@ignotum/shared": "1.0.0",
|
|
116
115
|
"@ignotum/runtime": "1.0.0",
|
|
116
|
+
"@ignotum/shared": "1.0.0",
|
|
117
117
|
"@ignotum/versions": "1.0.0"
|
|
118
118
|
},
|
|
119
119
|
"engines": {
|
package/src/cli/command.ts
CHANGED
|
@@ -146,6 +146,7 @@ const deploy = Command.make(
|
|
|
146
146
|
{
|
|
147
147
|
resume: Flag.boolean("resume").pipe(
|
|
148
148
|
Flag.withDescription("Resume the saved upload or activation."),
|
|
149
|
+
Flag.withDefault(false),
|
|
149
150
|
),
|
|
150
151
|
app: Flag.string("app").pipe(
|
|
151
152
|
Flag.withDescription("Create or link this app slug on the first deploy."),
|
package/src/cli/path.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Path } from "effect";
|
|
2
|
+
|
|
3
|
+
export const PathContainment = {
|
|
4
|
+
contains(path: Path.Path, directory: string, child: string): boolean {
|
|
5
|
+
const relative = path.relative(directory, child);
|
|
6
|
+
return (
|
|
7
|
+
relative === "" ||
|
|
8
|
+
(!path.isAbsolute(relative) && relative !== ".." && !relative.startsWith(`..${path.sep}`))
|
|
9
|
+
);
|
|
10
|
+
},
|
|
11
|
+
};
|
package/src/cli/route-codegen.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
writeOutput,
|
|
16
16
|
} from "./codegen.js";
|
|
17
17
|
import { createRouteExtractor, InvalidRouteSource, sourceError } from "./route-static.js";
|
|
18
|
+
import { PathContainment } from "./path.js";
|
|
18
19
|
|
|
19
20
|
export interface DiscoveredClientModule {
|
|
20
21
|
readonly path: string;
|
|
@@ -54,7 +55,7 @@ export const discoverClientRoutes = Effect.fn("Routes.discoverClientRoutes")(fun
|
|
|
54
55
|
const real = yield* fs
|
|
55
56
|
.realPath(directory)
|
|
56
57
|
.pipe(Effect.mapError(() => diagnostic(directory, "Cannot read route directory.")));
|
|
57
|
-
if (
|
|
58
|
+
if (!PathContainment.contains(path, clientDirectory, real))
|
|
58
59
|
return yield* diagnostic(directory, "Route trees cannot escape client/ through symlinks.");
|
|
59
60
|
if (seen.has(real)) return yield* diagnostic(directory, "Repeated or cyclic route directory.");
|
|
60
61
|
seen.add(real);
|
package/src/cli/route-static.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
StaticMetadata,
|
|
6
6
|
UrlValueDescriptor,
|
|
7
7
|
} from "@ignotum/contracts/app-definition";
|
|
8
|
+
import { PathContainment } from "./path.js";
|
|
8
9
|
|
|
9
10
|
export class InvalidRouteSource extends Schema.TaggedError<InvalidRouteSource>()(
|
|
10
11
|
"InvalidRouteSource",
|
|
@@ -126,8 +127,8 @@ export const createRouteExtractor = Effect.fn("Routes.createExtractor")(function
|
|
|
126
127
|
.realPath(file)
|
|
127
128
|
.pipe(Effect.mapError(() => fail("Cannot read source module.")));
|
|
128
129
|
if (
|
|
129
|
-
!
|
|
130
|
-
|
|
130
|
+
!PathContainment.contains(path, appDirectory, real) ||
|
|
131
|
+
PathContainment.contains(path, path.join(appDirectory, "server"), real) ||
|
|
131
132
|
!/\.(ts|tsx)$/.test(real) ||
|
|
132
133
|
real.endsWith(".d.ts")
|
|
133
134
|
)
|