@marko/run 0.10.0 → 0.11.0-rc.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapter/index.cjs +5 -4
- package/dist/adapter/index.js +7 -4
- package/dist/cli/index.mjs +524 -167
- package/dist/runtime/client.cjs +65 -0
- package/dist/runtime/client.d.ts +1 -0
- package/dist/runtime/client.js +59 -0
- package/dist/runtime/index.d.ts +9 -4
- package/dist/runtime/internal.cjs +279 -27
- package/dist/runtime/internal.d.ts +8 -4
- package/dist/runtime/internal.js +276 -27
- package/dist/runtime/legacy-types.d.ts +60 -0
- package/dist/runtime/namespace.d.ts +2 -1
- package/dist/runtime/router.d.ts +1 -1
- package/dist/runtime/types.d.ts +393 -100
- package/dist/runtime/url-builder.cjs +96 -0
- package/dist/runtime/url-builder.d.ts +6 -0
- package/dist/runtime/url-builder.js +61 -0
- package/dist/vite/codegen/index.d.ts +1 -1
- package/dist/vite/constants.d.ts +3 -3
- package/dist/vite/index.cjs +522 -167
- package/dist/vite/index.js +524 -167
- package/dist/vite/utils/href-replace.d.ts +44 -0
- package/dist/vite/utils/meta-data.d.ts +2 -2
- package/package.json +13 -23
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Program } from "@oxc-project/types";
|
|
2
|
+
interface HrefEdit {
|
|
3
|
+
/** Start offset in the source (from the AST node). */
|
|
4
|
+
start: number;
|
|
5
|
+
/** End offset in the source (from the AST node). */
|
|
6
|
+
end: number;
|
|
7
|
+
/** The replacement source code to insert. */
|
|
8
|
+
code: string;
|
|
9
|
+
}
|
|
10
|
+
export interface HrefReplacement {
|
|
11
|
+
/** Which runtime helper is needed (false = no import needed). */
|
|
12
|
+
helper: false | "href" | "href_path" | "href_values" | "href_keys";
|
|
13
|
+
/** Source edits to apply for this call site. */
|
|
14
|
+
edits: HrefEdit[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Walk an ESTree AST and find `Run.href(pathString, options?)` call
|
|
18
|
+
* expressions that can be optimized.
|
|
19
|
+
*
|
|
20
|
+
* Returns an array of surgical replacements (multiple per call site)
|
|
21
|
+
* that can be applied via magic string.
|
|
22
|
+
*
|
|
23
|
+
* Optimization tiers:
|
|
24
|
+
*
|
|
25
|
+
* - **Tier 0 (fully static):** Both path and options are compile-time constants.
|
|
26
|
+
* Single replacement of the entire call with a string literal.
|
|
27
|
+
*
|
|
28
|
+
* - **Tier 1a (href_path):** Static path, visible params, no other options.
|
|
29
|
+
* Single replacement of the entire call with a tagged template.
|
|
30
|
+
*
|
|
31
|
+
* - **Tier 1b (href_values):** Static path, visible params, plus other options.
|
|
32
|
+
* Three replacements: callee → tagged template, delete first arg, delete
|
|
33
|
+
* params property — preserving the original options object.
|
|
34
|
+
*
|
|
35
|
+
* - **Tier 2 (href_keys):** Static path, opaque options.
|
|
36
|
+
* Two replacements: callee → tagged template, delete first arg.
|
|
37
|
+
*
|
|
38
|
+
* - **Fallback (href):** Dynamic path or unserializable AST.
|
|
39
|
+
* Single replacement of the callee only.
|
|
40
|
+
*
|
|
41
|
+
* @param ast The ESTree AST to walk.
|
|
42
|
+
*/
|
|
43
|
+
export declare function findHrefReplacements(code: string, ast: Program): HrefReplacement[];
|
|
44
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { NormalizedMeta, NormalizedMetaLookup
|
|
2
|
-
export declare function getMetaDataForVerb<T, TVerb extends
|
|
1
|
+
import { HttpVerb, NormalizedMeta, NormalizedMetaLookup } from "../../runtime/types";
|
|
2
|
+
export declare function getMetaDataForVerb<T, TVerb extends HttpVerb>(data: T, verb: TVerb): NormalizedMeta<T, TVerb>;
|
|
3
3
|
export declare function getMetaDataLookup<T>(data: T): NormalizedMetaLookup<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/run",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0-rc.1",
|
|
4
4
|
"description": "The Marko application framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"marko"
|
|
@@ -44,6 +44,16 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"types": "./dist/runtime/index.d.ts",
|
|
47
|
+
"typesVersions": {
|
|
48
|
+
"*": {
|
|
49
|
+
"*": ["./dist/runtime/index.d.ts"],
|
|
50
|
+
"namespace": ["./dist/runtime/namespace.d.ts"],
|
|
51
|
+
"router": ["./dist/runtime/router.d.ts"],
|
|
52
|
+
"vite": ["./dist/vite/index.d.ts"],
|
|
53
|
+
"adapter/middleware": ["./dist/adapter/middleware.d.ts"],
|
|
54
|
+
"adapter": ["./dist/adapter/index.d.ts"]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
47
57
|
"bin": {
|
|
48
58
|
"marko-run": "./dist/cli/index.mjs"
|
|
49
59
|
},
|
|
@@ -56,6 +66,8 @@
|
|
|
56
66
|
"dependencies": {
|
|
57
67
|
"@marko/run-explorer": "^2.0.3",
|
|
58
68
|
"@marko/vite": "^6.0.3",
|
|
69
|
+
"@remix-run/form-data-parser": "^0.17.2",
|
|
70
|
+
"@standard-schema/spec": "^1.1.0",
|
|
59
71
|
"browserslist": "^4.28.2",
|
|
60
72
|
"cli-table3": "^0.6.5",
|
|
61
73
|
"compression": "^1.8.1",
|
|
@@ -78,27 +90,5 @@
|
|
|
78
90
|
},
|
|
79
91
|
"logo": {
|
|
80
92
|
"url": "https://github.com/marko-js/run/raw/main/assets/marko-run.png"
|
|
81
|
-
},
|
|
82
|
-
"typesVersions": {
|
|
83
|
-
"*": {
|
|
84
|
-
"*": [
|
|
85
|
-
"./dist/runtime/index.d.ts"
|
|
86
|
-
],
|
|
87
|
-
"namespace": [
|
|
88
|
-
"./dist/runtime/namespace.d.ts"
|
|
89
|
-
],
|
|
90
|
-
"router": [
|
|
91
|
-
"./dist/runtime/router.d.ts"
|
|
92
|
-
],
|
|
93
|
-
"vite": [
|
|
94
|
-
"./dist/vite/index.d.ts"
|
|
95
|
-
],
|
|
96
|
-
"adapter/middleware": [
|
|
97
|
-
"./dist/adapter/middleware.d.ts"
|
|
98
|
-
],
|
|
99
|
-
"adapter": [
|
|
100
|
-
"./dist/adapter/index.d.ts"
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
93
|
}
|
|
104
94
|
}
|