@marko/run 0.4.4 → 0.4.6
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/dev-server.d.ts +2 -2
- package/dist/adapter/index.cjs +183 -142
- package/dist/adapter/index.d.ts +1 -1
- package/dist/adapter/index.js +186 -143
- package/dist/adapter/middleware.cjs +16 -10
- package/dist/adapter/middleware.d.ts +0 -1
- package/dist/adapter/middleware.js +16 -10
- package/dist/adapter/polyfill.d.ts +0 -1
- package/dist/adapter/utils.d.ts +16 -0
- package/dist/cli/index.mjs +227 -220
- package/dist/runtime/internal.cjs +7 -5
- package/dist/runtime/internal.d.ts +1 -0
- package/dist/runtime/internal.js +5 -4
- package/dist/runtime/router.d.ts +2 -2
- package/dist/vite/index.cjs +226 -219
- package/dist/vite/index.js +227 -220
- package/dist/vite/utils/ast.d.ts +1 -0
- package/dist/vite/utils/server.d.ts +0 -3
- package/package.json +30 -30
- package/dist/components/src-attributes-transformer.cjs +0 -122
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/run",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "The Marko application framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/marko-js/run/tree/main/packages/run",
|
|
@@ -88,51 +88,51 @@
|
|
|
88
88
|
"marko": "^5"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
|
-
"@babel/types": "^7.
|
|
91
|
+
"@babel/types": "^7.25.6",
|
|
92
92
|
"@marko/fixture-snapshots": "^2.2.1",
|
|
93
|
-
"@marko/testing-library": "^6.
|
|
93
|
+
"@marko/testing-library": "^6.2.0",
|
|
94
94
|
"@types/glob": "^8.1.0",
|
|
95
95
|
"@types/human-format": "^1.0.3",
|
|
96
|
-
"@types/jsdom": "^21.1.
|
|
97
|
-
"@types/mocha": "^10.0.
|
|
98
|
-
"@types/node": "^
|
|
99
|
-
"acorn": "^8.
|
|
100
|
-
"body-parser": "^1.20.
|
|
96
|
+
"@types/jsdom": "^21.1.7",
|
|
97
|
+
"@types/mocha": "^10.0.8",
|
|
98
|
+
"@types/node": "^22.7.0",
|
|
99
|
+
"acorn": "^8.12.1",
|
|
100
|
+
"body-parser": "^1.20.3",
|
|
101
101
|
"cross-env": "^7.0.3",
|
|
102
|
-
"esbuild": "^0.
|
|
103
|
-
"express": "^4.
|
|
104
|
-
"jsdom": "^
|
|
105
|
-
"mocha": "^10.
|
|
102
|
+
"esbuild": "^0.24.0",
|
|
103
|
+
"express": "^4.21.0",
|
|
104
|
+
"jsdom": "^25.0.1",
|
|
105
|
+
"mocha": "^10.7.3",
|
|
106
106
|
"mocha-snap": "^5.0.0",
|
|
107
|
-
"playwright": "^1.
|
|
108
|
-
"prettier": "^3.
|
|
107
|
+
"playwright": "^1.47.2",
|
|
108
|
+
"prettier": "^3.3.3",
|
|
109
109
|
"ts-mocha": "^10.0.0",
|
|
110
|
-
"ts-node": "^10.9.
|
|
111
|
-
"tslib": "^2.
|
|
112
|
-
"tsx": "^4.
|
|
113
|
-
"typescript": "^5.
|
|
110
|
+
"ts-node": "^10.9.2",
|
|
111
|
+
"tslib": "^2.7.0",
|
|
112
|
+
"tsx": "^4.19.1",
|
|
113
|
+
"typescript": "^5.6.2"
|
|
114
114
|
},
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@marko/compiler": "^5.
|
|
117
|
-
"@marko/run-explorer": "^0.1.
|
|
118
|
-
"@marko/vite": "^4.1.
|
|
119
|
-
"browserslist": "^4.
|
|
120
|
-
"cli-table3": "^0.6.
|
|
116
|
+
"@marko/compiler": "^5.37.13",
|
|
117
|
+
"@marko/run-explorer": "^0.1.2",
|
|
118
|
+
"@marko/vite": "^4.1.19",
|
|
119
|
+
"browserslist": "^4.24.0",
|
|
120
|
+
"cli-table3": "^0.6.5",
|
|
121
121
|
"compression": "^1.7.4",
|
|
122
|
-
"debug": "^4.3.
|
|
123
|
-
"dotenv": "^16.
|
|
122
|
+
"debug": "^4.3.7",
|
|
123
|
+
"dotenv": "^16.4.5",
|
|
124
124
|
"draftlog": "^1.0.13",
|
|
125
|
-
"esbuild-plugin-browserslist": "^0.
|
|
126
|
-
"glob": "^
|
|
125
|
+
"esbuild-plugin-browserslist": "^0.14.0",
|
|
126
|
+
"glob": "^11.0.0",
|
|
127
127
|
"human-format": "^1.2.0",
|
|
128
128
|
"kleur": "^4.1.5",
|
|
129
129
|
"marko": "^5",
|
|
130
130
|
"parse-node-args": "^1.1.2",
|
|
131
131
|
"sade": "^1.8.1",
|
|
132
|
-
"serve-static": "^1.
|
|
132
|
+
"serve-static": "^1.16.2",
|
|
133
133
|
"supports-color": "^9.4.0",
|
|
134
|
-
"undici": "^6.
|
|
135
|
-
"vite": "^5.
|
|
134
|
+
"undici": "^6.19.8",
|
|
135
|
+
"vite": "^5.4.8",
|
|
136
136
|
"warp10": "^2.1.0"
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const markoUtils = require("@marko/babel-utils");
|
|
4
|
-
const attrTags = {
|
|
5
|
-
src: [
|
|
6
|
-
"audio",
|
|
7
|
-
"embed",
|
|
8
|
-
"iframe",
|
|
9
|
-
"img",
|
|
10
|
-
"input",
|
|
11
|
-
"script",
|
|
12
|
-
"source",
|
|
13
|
-
"track",
|
|
14
|
-
"video"
|
|
15
|
-
],
|
|
16
|
-
href: ["a", "area", "link"],
|
|
17
|
-
data: ["object"],
|
|
18
|
-
poster: ["video"],
|
|
19
|
-
srcset: ["img"],
|
|
20
|
-
//something else needs to happen here
|
|
21
|
-
background: ["body"]
|
|
22
|
-
};
|
|
23
|
-
const tagAttrs = Object.keys(attrTags).reduce((tagAttrs, attrName) => {
|
|
24
|
-
attrTags[attrName].forEach(tagName => {
|
|
25
|
-
tagAttrs[tagName] = tagAttrs[tagName] || {};
|
|
26
|
-
tagAttrs[tagName][attrName] = true;
|
|
27
|
-
});
|
|
28
|
-
return tagAttrs;
|
|
29
|
-
}, {});
|
|
30
|
-
|
|
31
|
-
module.exports = function(a, b) {
|
|
32
|
-
if (a.hub) {
|
|
33
|
-
return transformMarko5(a, b);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return transformMarko4(a, b);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
function transformMarko5(path) {
|
|
40
|
-
if (!path.get("name").isStringLiteral()) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const tagName = path.get("name.value").node;
|
|
45
|
-
const checkAttrs = tagAttrs[tagName];
|
|
46
|
-
if (!checkAttrs) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
path.get("attributes").forEach(attr => {
|
|
51
|
-
if (!checkAttrs[attr.get("name").node]) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const { confident, value } = attr.get("value").evaluate();
|
|
56
|
-
|
|
57
|
-
if (!confident || !isAssetPath(value)) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
attr.set("value", markoUtils.importDefault(path.hub.file, value, "asset"));
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function transformMarko4(el, context) {
|
|
66
|
-
const checkAttrs = tagAttrs[el.tagName];
|
|
67
|
-
if (!checkAttrs) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
el.attributes.forEach(attr => {
|
|
72
|
-
if (!checkAttrs[attr.name]) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const walker = context.createWalker({
|
|
77
|
-
enter: node => {
|
|
78
|
-
switch (node.type) {
|
|
79
|
-
case "ArrayExpression":
|
|
80
|
-
case "ObjectExpression":
|
|
81
|
-
case "Property":
|
|
82
|
-
case "LogicalExpression":
|
|
83
|
-
return;
|
|
84
|
-
case "ConditionalExpression":
|
|
85
|
-
node.consequent = walker.walk(node.consequent);
|
|
86
|
-
node.alternate = walker.walk(node.alternate);
|
|
87
|
-
walker.skip();
|
|
88
|
-
break;
|
|
89
|
-
case "Literal": {
|
|
90
|
-
const { value } = node;
|
|
91
|
-
|
|
92
|
-
if (!isAssetPath(value)) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
context.assetCount = context.assetCount || 0;
|
|
97
|
-
const varName = `__src_asset_${context.assetCount++}__`;
|
|
98
|
-
const tagString = `import ${varName} from ${JSON.stringify(value)}`;
|
|
99
|
-
const importTag = context.createNodeForEl("import");
|
|
100
|
-
importTag.tagString = tagString;
|
|
101
|
-
context.root.prependChild(importTag);
|
|
102
|
-
walker.replace(context.builder.identifier(varName));
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
default:
|
|
106
|
-
walker.skip();
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
attr.value = walker.walk(attr.value);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function isAssetPath(relativePath) {
|
|
117
|
-
if (typeof relativePath !== "string") return false;
|
|
118
|
-
if (relativePath[0] === "/") return false; // Ignore absolute paths.
|
|
119
|
-
if (!/\.[^.]+$/.test(relativePath)) return false; // Ignore paths without a file extension.
|
|
120
|
-
if (/^[a-z]{2,}:/i.test(relativePath)) return false; // Ignore paths with a protocol.
|
|
121
|
-
return true;
|
|
122
|
-
}
|