@farm.js/core 0.1.62 → 0.1.64
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/{agent-mcp-handler-OV4WRFBL.cjs → agent-mcp-handler-OXT73ZBY.cjs} +5 -5
- package/dist/{agent-mcp-handler-7QMX2LUY.mjs → agent-mcp-handler-QLFDDTYN.mjs} +4 -4
- package/dist/{agent-mcp.d-BKZ3UNbt.d.mts → agent-mcp.d-CO_ABmNK.d.mts} +1 -1
- package/dist/{agent-mcp.d-C1zr_nGS.d.ts → agent-mcp.d-QD2WZ9BS.d.ts} +1 -1
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/analyzer-ODLF2Z6O.cjs +16 -0
- package/dist/{analyzer-YESYU3GK.mjs → analyzer-Q3QXC6PD.mjs} +3 -2
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/{app-manifest.d-ntch_bvA.d.ts → app-manifest.d-BpKxiU_E.d.mts} +9 -1
- package/dist/{app-manifest.d-BpvhfKRH.d.mts → app-manifest.d-DDmNkYQQ.d.ts} +9 -1
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/app-markdown.mjs +3 -3
- package/dist/{app.d-CysWA_8v.d.mts → app.d-kuoVWhWM.d.mts} +4 -4
- package/dist/{app.d-AE8_v3Db.d.ts → app.d-x68Cwr0_.d.ts} +4 -4
- package/dist/{chunk-LT4VAF5Z.cjs → chunk-2C5L5RPM.cjs} +7 -6
- package/dist/{chunk-RMUD75WT.cjs → chunk-3EBHJET2.cjs} +355 -270
- package/dist/{chunk-RZNCMRD3.mjs → chunk-6NHSGVVA.mjs} +1 -1
- package/dist/{chunk-LVWGURLD.mjs → chunk-6NNYPY5W.mjs} +327 -13
- package/dist/{chunk-PRFNLQSP.cjs → chunk-7XGWBPQQ.cjs} +4 -4
- package/dist/{chunk-SG57PX7K.cjs → chunk-BTVDYS4B.cjs} +7 -2
- package/dist/{chunk-545WJ5UG.cjs → chunk-DUSHDZQL.cjs} +11 -11
- package/dist/{chunk-GVOMPU3Y.cjs → chunk-EL4364S2.cjs} +209 -32
- package/dist/{chunk-GGNJAGGE.cjs → chunk-FAP7CX7C.cjs} +1056 -529
- package/dist/{chunk-T46NNU4D.mjs → chunk-FH45OB37.mjs} +2 -2
- package/dist/{chunk-55U5QIXQ.mjs → chunk-FIR62CR3.mjs} +1 -1
- package/dist/{chunk-MEQN6DDA.cjs → chunk-FJWN7RV4.cjs} +5 -5
- package/dist/chunk-IOEXXZK3.mjs +88 -0
- package/dist/{chunk-EXXFSZOC.cjs → chunk-JCPSA4X5.cjs} +135 -134
- package/dist/{chunk-YSXTNSXS.mjs → chunk-K7OZAVOI.mjs} +7 -6
- package/dist/{chunk-KVW2M6PI.mjs → chunk-KL7SHLQB.mjs} +1 -1
- package/dist/{chunk-NT3QDN2E.mjs → chunk-LQDLEWPO.mjs} +1 -1
- package/dist/{chunk-UZZ6IEQP.mjs → chunk-MESQF2JC.mjs} +2 -2
- package/dist/{chunk-WKJQ2FJA.cjs → chunk-MG356ROI.cjs} +5 -5
- package/dist/{chunk-AJB3DHN6.cjs → chunk-N3Z3PLHC.cjs} +2 -2
- package/dist/{chunk-2CNKQC3G.mjs → chunk-NNLFW3P4.mjs} +2 -2
- package/dist/{chunk-XX32BOMM.cjs → chunk-NXFA7G3Y.cjs} +52 -26
- package/dist/{chunk-SM25ZC4S.cjs → chunk-O2XFIPNL.cjs} +1 -1
- package/dist/{chunk-VWW4Q3BJ.mjs → chunk-O4FWNLQK.mjs} +4 -4
- package/dist/{chunk-DZPR2W6U.cjs → chunk-O6L3YYPM.cjs} +5 -5
- package/dist/{chunk-UWI3SJAK.cjs → chunk-O7IEMY55.cjs} +3 -3
- package/dist/{chunk-6BJJYOFL.cjs → chunk-OLIGNTWU.cjs} +7 -7
- package/dist/{chunk-OUWRNHTV.mjs → chunk-OYF23QLG.mjs} +17 -16
- package/dist/{chunk-IQIKPKFP.mjs → chunk-RAH5MT53.mjs} +110 -25
- package/dist/{chunk-E72UD6ME.mjs → chunk-RVGSVQWT.mjs} +1 -1
- package/dist/{chunk-ZVIEFTUA.cjs → chunk-S25BQIFW.cjs} +16 -16
- package/dist/chunk-S7ZW72JH.cjs +254 -0
- package/dist/{chunk-VM7X5CKC.mjs → chunk-SLYDIHLW.mjs} +31 -5
- package/dist/chunk-SNFTMSHX.mjs +254 -0
- package/dist/{chunk-2WZTGPK6.mjs → chunk-SQ5O7I3L.mjs} +7 -2
- package/dist/{chunk-PCXIJKPM.mjs → chunk-TNBJ4LZG.mjs} +2 -2
- package/dist/{chunk-O27PLNQZ.cjs → chunk-UJ3R2AH2.cjs} +4 -4
- package/dist/{chunk-T4TBK5NY.mjs → chunk-VQ4NWOWO.mjs} +2 -2
- package/dist/{chunk-ZZ2QKCKW.mjs → chunk-WAY6LOQH.mjs} +1 -1
- package/dist/chunk-WBTHHTBO.cjs +88 -0
- package/dist/{chunk-ZBUAOGMY.mjs → chunk-WFNAOWH4.mjs} +1 -1
- package/dist/{chunk-IWRLV46X.cjs → chunk-WMTBBQHY.cjs} +4 -4
- package/dist/{chunk-2JYBLE63.mjs → chunk-WNYRYI4D.mjs} +770 -243
- package/dist/{chunk-CI4UNQHO.cjs → chunk-XBSKPLHF.cjs} +2 -2
- package/dist/{chunk-IOF4KXMP.mjs → chunk-XVWSDSUM.mjs} +201 -24
- package/dist/{chunk-JEJQGZI7.cjs → chunk-XZLZ6YPP.cjs} +346 -32
- package/dist/{chunk-QAS7KE7J.cjs → chunk-Y5TOT5F6.cjs} +5 -5
- package/dist/{chunk-DPE53XWL.mjs → chunk-ZEXE4TGY.mjs} +1 -1
- package/dist/{client-component.d-BoqC2MLC.d.mts → client-component.d-D74pqdea.d.mts} +14 -3
- package/dist/{client-component.d-Bgt3x5Fu.d.ts → client-component.d-D8VcypQA.d.ts} +14 -3
- package/dist/{client-plugins.d-BcqIy4au.d.ts → client-plugins.d-CXElzotB.d.ts} +18 -2
- package/dist/{client-plugins.d-CWyYBxXf.d.mts → client-plugins.d-D4-6hNx7.d.mts} +18 -2
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.d.mts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-NUVXYG7I.mjs → devtools-MX3FE733.mjs} +5 -5
- package/dist/{devtools-SVRSGPNC.cjs → devtools-WET5NAKO.cjs} +6 -6
- package/dist/docs.cjs +8 -8
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +7 -7
- package/dist/index.cjs +21 -20
- package/dist/{index.d-nAncqTXz.d.ts → index.d-A_x10zGS.d.ts} +1 -1
- package/dist/{index.d-BDaiu2i5.d.mts → index.d-SSgYDv4D.d.mts} +1 -1
- package/dist/index.d.mts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.mjs +20 -19
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +22 -21
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +21 -20
- package/dist/internal/cli-runtime.cjs +7 -7
- package/dist/internal/cli-runtime.mjs +6 -6
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +4 -4
- package/dist/internal/client-runtime.d.ts +4 -4
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +7 -7
- package/dist/internal/config-runtime.d.mts +4 -4
- package/dist/internal/config-runtime.d.ts +4 -4
- package/dist/internal/config-runtime.mjs +6 -6
- package/dist/internal/infra-analytics-runtime.cjs +11 -9
- package/dist/internal/infra-analytics-runtime.mjs +9 -7
- package/dist/internal/native-server-fns.cjs +5 -4
- package/dist/internal/native-server-fns.mjs +4 -3
- package/dist/internal/product-telemetry-runtime.cjs +17 -211
- package/dist/internal/product-telemetry-runtime.mjs +10 -204
- package/dist/internal/production-runtime.cjs +13 -12
- package/dist/internal/production-runtime.d.mts +13 -12
- package/dist/internal/production-runtime.d.ts +13 -12
- package/dist/internal/production-runtime.mjs +14 -13
- package/dist/internal/react-cache.cjs +21 -1
- package/dist/internal/react-cache.d.mts +8 -1
- package/dist/internal/react-cache.d.ts +8 -1
- package/dist/internal/react-cache.mjs +21 -1
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.d.mts +3 -3
- package/dist/middleware.d.ts +3 -3
- package/dist/mobile.d.mts +2 -2
- package/dist/mobile.d.ts +2 -2
- package/dist/{native-tree-AS5L3ID3.mjs → native-tree-BPEE2LAL.mjs} +2 -2
- package/dist/{native-tree-Z2WYUJEV.cjs → native-tree-WOX3JMBG.cjs} +3 -3
- package/dist/{navigation-delegate.d-CSCm8ZxL.d.mts → navigation-delegate.d-DQVYKoaZ.d.mts} +1 -1
- package/dist/{navigation-delegate.d-BbUHRXxG.d.ts → navigation-delegate.d-GghbHJuK.d.ts} +1 -1
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/plugin.cjs +14 -14
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.mjs +13 -13
- package/dist/{production-runtime.d-DgT24A0f.d.ts → production-runtime.d-Bzns3NW9.d.ts} +1 -1
- package/dist/{production-runtime.d-CcQiDko5.d.mts → production-runtime.d-DiFa5vHW.d.mts} +1 -1
- package/dist/{render-plan.d-CyrX6MDs.d.ts → render-plan.d-CL_Ikfg_.d.ts} +1 -1
- package/dist/{render-plan.d-BH9WF-JZ.d.mts → render-plan.d-CcF0MeCf.d.mts} +1 -1
- package/dist/renderer-client.d.mts +4 -4
- package/dist/renderer-client.d.ts +4 -4
- package/dist/{request.d-BB8M8bcD.d.ts → request.d-B1RnTLri.d.ts} +1 -1
- package/dist/{request.d-CUrPnCW7.d.mts → request.d-DarDOCk9.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-DYqZMIf4.d.ts → route-rendering.d-BTUYCIj4.d.ts} +1 -1
- package/dist/{route-rendering.d-CYxlzaFm.d.mts → route-rendering.d-D_2Ual0-.d.mts} +1 -1
- package/dist/{router.d-DaKo507j.d.ts → router.d-CMANF6da.d.ts} +1 -1
- package/dist/{router.d-7o24CD8u.d.mts → router.d-Cuv1jntg.d.mts} +1 -1
- package/dist/{routes.d-BknKQcTu.d.ts → routes.d-B6yFe6jm.d.ts} +1 -1
- package/dist/{routes.d-D1IrO9KK.d.mts → routes.d-c2HKfrfL.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/{rsc-pipeline-RFLHDAKD.mjs → rsc-pipeline-3LNVP2OO.mjs} +6 -6
- package/dist/{rsc-pipeline-OF2I7PCX.cjs → rsc-pipeline-G5WELVW3.cjs} +7 -7
- package/dist/{runtime-LBTK62AD.cjs → runtime-DMEULPE7.cjs} +22 -11
- package/dist/{runtime-M6UJCSLA.mjs → runtime-HQJ2LLQL.mjs} +20 -9
- package/dist/{runtime.d-CN73a-IL.d.ts → runtime.d-C3RQUj6_.d.ts} +1 -1
- package/dist/{runtime.d-CcNuzhX6.d.mts → runtime.d-wvh4ngU0.d.mts} +1 -1
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server.cjs +31 -31
- package/dist/server.d.mts +9 -9
- package/dist/server.d.ts +9 -9
- package/dist/server.mjs +16 -16
- package/dist/{spa-router.d-CNi77LZm.d.mts → spa-router.d-WU_qS5gJ.d.mts} +2 -2
- package/dist/{spa-router.d-Cvgf5QP4.d.ts → spa-router.d-m8H_Kl_B.d.ts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils.d-C3H-14_Y.d.ts → utils.d-C9dQD5Zg.d.ts} +1 -1
- package/dist/{utils.d-D8VfzZYn.d.mts → utils.d-W9IiEqmW.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +18 -14
- package/dist/vite.d.mts +23 -5
- package/dist/vite.d.ts +23 -5
- package/dist/vite.mjs +17 -13
- package/package.json +1 -1
- package/dist/analyzer-2AHWJJR7.cjs +0 -15
- package/dist/chunk-CSLUBKGG.mjs +0 -44
- package/dist/chunk-SGBNF56S.cjs +0 -44
|
@@ -3,19 +3,26 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
var _chunkWBTHHTBOcjs = require('./chunk-WBTHHTBO.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
|
|
7
14
|
|
|
8
15
|
var _chunkV727H3RIcjs = require('./chunk-V727H3RI.cjs');
|
|
9
16
|
|
|
10
17
|
|
|
11
|
-
var
|
|
18
|
+
var _chunkO2XFIPNLcjs = require('./chunk-O2XFIPNL.cjs');
|
|
12
19
|
|
|
13
20
|
// src/mobile/analyzer.ts
|
|
14
21
|
var _crypto = require('crypto');
|
|
15
22
|
var _fs = require('fs');
|
|
16
23
|
var _promises = require('fs/promises');
|
|
17
24
|
var _path = require('path'); var path = _interopRequireWildcard(_path);
|
|
18
|
-
var ANALYZER_VERSION = `
|
|
25
|
+
var ANALYZER_VERSION = `6:${_chunkO2XFIPNLcjs.FARM_VERSION}`;
|
|
19
26
|
var INTRINSIC_KINDS = {};
|
|
20
27
|
for (const tag of "div section main article header footer nav aside figure hr li".split(" ")) {
|
|
21
28
|
INTRINSIC_KINDS[tag] = "View";
|
|
@@ -29,6 +36,8 @@ Object.assign(INTRINSIC_KINDS, {
|
|
|
29
36
|
a: "Pressable",
|
|
30
37
|
input: "TextInput",
|
|
31
38
|
textarea: "TextInput",
|
|
39
|
+
// Native-tier screens submit forms as a browser would (native-tree.ts).
|
|
40
|
+
form: "View",
|
|
32
41
|
ul: "List",
|
|
33
42
|
ol: "List"
|
|
34
43
|
});
|
|
@@ -162,6 +171,8 @@ var MAPPED_COMPONENTS = {
|
|
|
162
171
|
};
|
|
163
172
|
var SERVER_FN_FACTORIES = /* @__PURE__ */ new Set(["createServerFn", "createServerQuery"]);
|
|
164
173
|
var SCRIPT_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js", ".mjs"];
|
|
174
|
+
var COMPONENT_EXTENSIONS = [".vue", ".svelte"];
|
|
175
|
+
var isModuleFile = (file) => [...SCRIPT_EXTENSIONS, ...COMPONENT_EXTENSIONS].some((extension) => file.endsWith(extension));
|
|
165
176
|
var STYLE_FILE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)(?:\?.*)?$/i;
|
|
166
177
|
var ASSET_FILE = /\.(?:png|jpe?g|gif|webp|avif|svg|ico|bmp|json|woff2?|ttf|otf|mp3|wav|txt)(?:\?.*)?$/i;
|
|
167
178
|
var STYLE_PROPERTIES = new Set(
|
|
@@ -310,7 +321,7 @@ var SKIP_KEYS = /* @__PURE__ */ new Set([
|
|
|
310
321
|
"typeArguments",
|
|
311
322
|
"decorators"
|
|
312
323
|
]);
|
|
313
|
-
function analyzeSource(file, source, parseSync) {
|
|
324
|
+
function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
314
325
|
const facts = {
|
|
315
326
|
imports: [],
|
|
316
327
|
blockers: [],
|
|
@@ -333,10 +344,11 @@ function analyzeSource(file, source, parseSync) {
|
|
|
333
344
|
});
|
|
334
345
|
};
|
|
335
346
|
const needsDevice = (node, message) => block(node, "client-logic", message, "native");
|
|
336
|
-
|
|
347
|
+
let formDepth = 0;
|
|
348
|
+
const result = parseSync(file, source, { lang });
|
|
337
349
|
if (result.errors.length > 0) {
|
|
338
350
|
const error = result.errors[0];
|
|
339
|
-
const offset = _nullishCoalesce(_optionalChain([error, 'access',
|
|
351
|
+
const offset = _nullishCoalesce(_optionalChain([error, 'access', _2 => _2.labels, 'optionalAccess', _3 => _3[0], 'optionalAccess', _4 => _4.start]), () => ( 0));
|
|
340
352
|
facts.blockers.push({ ...locate(starts, offset), rule: "parse-error", message: error.message });
|
|
341
353
|
return facts;
|
|
342
354
|
}
|
|
@@ -381,10 +393,10 @@ function analyzeSource(file, source, parseSync) {
|
|
|
381
393
|
}
|
|
382
394
|
const declaration = statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration" ? statement.declaration : statement;
|
|
383
395
|
if (!declaration) continue;
|
|
384
|
-
if (_optionalChain([declaration, 'access',
|
|
396
|
+
if (_optionalChain([declaration, 'access', _5 => _5.id, 'optionalAccess', _6 => _6.name]) && /Function|Class/.test(declaration.type)) {
|
|
385
397
|
topLevel.add(declaration.id.name);
|
|
386
398
|
}
|
|
387
|
-
if (_optionalChain([declaration, 'access',
|
|
399
|
+
if (_optionalChain([declaration, 'access', _7 => _7.id, 'optionalAccess', _8 => _8.name]) && declaration.async) asyncFunctions.add(declaration.id.name);
|
|
388
400
|
if (statement.type === "ExportDefaultDeclaration" && declaration.type === "Identifier") {
|
|
389
401
|
defaultName = declaration.name;
|
|
390
402
|
}
|
|
@@ -392,10 +404,10 @@ function analyzeSource(file, source, parseSync) {
|
|
|
392
404
|
for (const declarator of declaration.declarations) {
|
|
393
405
|
if (declarator.id.type !== "Identifier") continue;
|
|
394
406
|
const init = declarator.init;
|
|
395
|
-
if (_optionalChain([init, 'optionalAccess',
|
|
396
|
-
const callee = _optionalChain([init, 'optionalAccess',
|
|
397
|
-
const calleeName = _optionalChain([callee, 'optionalAccess',
|
|
398
|
-
if (/Function/.test(_nullishCoalesce(_optionalChain([init, 'optionalAccess',
|
|
407
|
+
if (_optionalChain([init, 'optionalAccess', _9 => _9.async])) asyncFunctions.add(declarator.id.name);
|
|
408
|
+
const callee = _optionalChain([init, 'optionalAccess', _10 => _10.type]) === "CallExpression" ? init.callee : void 0;
|
|
409
|
+
const calleeName = _optionalChain([callee, 'optionalAccess', _11 => _11.type]) === "MemberExpression" ? callee.property.name : _optionalChain([callee, 'optionalAccess', _12 => _12.name]);
|
|
410
|
+
if (/Function/.test(_nullishCoalesce(_optionalChain([init, 'optionalAccess', _13 => _13.type]), () => ( ""))) || calleeName && /^(?:memo|forwardRef|lazy)$/.test(calleeName)) {
|
|
399
411
|
topLevel.add(declarator.id.name);
|
|
400
412
|
}
|
|
401
413
|
}
|
|
@@ -428,7 +440,7 @@ function analyzeSource(file, source, parseSync) {
|
|
|
428
440
|
const binding = imported.get(root);
|
|
429
441
|
if (binding) {
|
|
430
442
|
const member = tag.includes(".") ? binding.name === "*" ? tag.split(".")[1] : "" : binding.name;
|
|
431
|
-
kind = _optionalChain([MAPPED_COMPONENTS, 'access',
|
|
443
|
+
kind = _optionalChain([MAPPED_COMPONENTS, 'access', _14 => _14[binding.source], 'optionalAccess', _15 => _15[member]]);
|
|
432
444
|
if (!kind) {
|
|
433
445
|
const fromApp = /^(?:\.|\/|@\/|~|#)/.test(binding.source);
|
|
434
446
|
if (!fromApp) {
|
|
@@ -464,6 +476,7 @@ function analyzeSource(file, source, parseSync) {
|
|
|
464
476
|
const props = {};
|
|
465
477
|
const style = [];
|
|
466
478
|
const events = [];
|
|
479
|
+
let submits = false;
|
|
467
480
|
for (const attribute of opening.attributes) {
|
|
468
481
|
if (attribute.type === "JSXSpreadAttribute") {
|
|
469
482
|
if (isIntrinsic)
|
|
@@ -486,11 +499,14 @@ function analyzeSource(file, source, parseSync) {
|
|
|
486
499
|
continue;
|
|
487
500
|
}
|
|
488
501
|
if ((name === "action" || name === "formAction") && isIntrinsic) {
|
|
489
|
-
|
|
502
|
+
if (staticString(value) === void 0) {
|
|
503
|
+
block(attribute, "form-action", `${name} on <${tag}>`);
|
|
504
|
+
}
|
|
505
|
+
submits = true;
|
|
490
506
|
continue;
|
|
491
507
|
}
|
|
492
508
|
if (/^on[A-Z]/.test(name)) {
|
|
493
|
-
if (isIntrinsic && kind && !_optionalChain([MAPPED_EVENTS, 'access',
|
|
509
|
+
if (isIntrinsic && kind && !_optionalChain([MAPPED_EVENTS, 'access', _16 => _16[kind], 'optionalAccess', _17 => _17.has, 'call', _18 => _18(name)])) {
|
|
494
510
|
block(attribute, "dom-event", `${name} on <${tag}> has no native event`);
|
|
495
511
|
} else {
|
|
496
512
|
needsDevice(attribute, `${name} on <${tag}> runs on the device`);
|
|
@@ -518,7 +534,7 @@ function analyzeSource(file, source, parseSync) {
|
|
|
518
534
|
continue;
|
|
519
535
|
}
|
|
520
536
|
if (name === "style") {
|
|
521
|
-
const expression = _optionalChain([value, 'optionalAccess',
|
|
537
|
+
const expression = _optionalChain([value, 'optionalAccess', _19 => _19.type]) === "JSXExpressionContainer" ? value.expression : null;
|
|
522
538
|
if (!expression || expression.type !== "ObjectExpression") {
|
|
523
539
|
block(attribute, "runtime-style", `<${tag}> style is not an object literal`);
|
|
524
540
|
continue;
|
|
@@ -560,7 +576,8 @@ function analyzeSource(file, source, parseSync) {
|
|
|
560
576
|
}
|
|
561
577
|
if (tag === "input" && name === "type") {
|
|
562
578
|
const type = staticString(value);
|
|
563
|
-
|
|
579
|
+
const formType = formDepth > 0 && (type === "hidden" || type === "submit");
|
|
580
|
+
if (!formType && (type === void 0 || !INPUT_TYPES.has(type))) {
|
|
564
581
|
block(
|
|
565
582
|
attribute,
|
|
566
583
|
"unmapped-element",
|
|
@@ -570,13 +587,29 @@ function analyzeSource(file, source, parseSync) {
|
|
|
570
587
|
}
|
|
571
588
|
const literal = value === null ? true : staticString(value);
|
|
572
589
|
if (literal !== void 0) props[name] = literal;
|
|
573
|
-
else if (_optionalChain([value, 'optionalAccess',
|
|
590
|
+
else if (_optionalChain([value, 'optionalAccess', _20 => _20.type]) === "JSXExpressionContainer" && value.expression.type === "Literal" && (typeof value.expression.value === "number" || typeof value.expression.value === "boolean")) {
|
|
574
591
|
props[name] = value.expression.value;
|
|
575
592
|
} else props[name] = "{expr}";
|
|
576
593
|
}
|
|
577
594
|
if (kind === "TextInput" && events.some((event) => event === "onChange" || event === "onInput")) {
|
|
578
595
|
wins.add("input");
|
|
579
596
|
}
|
|
597
|
+
const inForm = formDepth > 0;
|
|
598
|
+
const buttonType = tag === "button" ? _nullishCoalesce(props.type, () => ( "submit")) : void 0;
|
|
599
|
+
if (isIntrinsic && (tag === "button" || kind === "TextInput") && events.length === 0 && !submits && props.type !== "hidden" && (!inForm || buttonType !== void 0 && buttonType !== "submit")) {
|
|
600
|
+
block(
|
|
601
|
+
opening,
|
|
602
|
+
"inert-control",
|
|
603
|
+
inForm ? `<button type="${String(buttonType)}"> does nothing on a native-tier screen` : `<${tag}> has no link or form to submit on a native-tier screen`,
|
|
604
|
+
"native"
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
if (isIntrinsic && tag === "form") {
|
|
608
|
+
const method = typeof props.method === "string" ? props.method.toLowerCase() : "get";
|
|
609
|
+
if (props.method === "{expr}" || method !== "get" && method !== "post") {
|
|
610
|
+
block(opening, "form-action", `<form method="${String(props.method)}">`, "native");
|
|
611
|
+
}
|
|
612
|
+
}
|
|
580
613
|
if (Object.keys(props).length > 0) node.props = props;
|
|
581
614
|
if (style.length > 0) node.style = style;
|
|
582
615
|
if (events.length > 0) node.events = events;
|
|
@@ -593,7 +626,7 @@ function analyzeSource(file, source, parseSync) {
|
|
|
593
626
|
return void 0;
|
|
594
627
|
case "JSXElement": {
|
|
595
628
|
const ui = classifyElement(node);
|
|
596
|
-
if (INLINE_BOX_TAGS.has(ui.tag) && parent && parent.kind !== "Fragment" && parent.kind !== "Component" && !_optionalChain([parent, 'access',
|
|
629
|
+
if (INLINE_BOX_TAGS.has(ui.tag) && parent && parent.kind !== "Fragment" && parent.kind !== "Component" && !_optionalChain([parent, 'access', _21 => _21.style, 'optionalAccess', _22 => _22.some, 'call', _23 => _23((token) => token === "flex" || token === "inline-flex")]) && hasBoxStyle(ui)) {
|
|
597
630
|
block(
|
|
598
631
|
node.openingElement,
|
|
599
632
|
"class-name",
|
|
@@ -604,7 +637,10 @@ function analyzeSource(file, source, parseSync) {
|
|
|
604
637
|
for (const attribute of node.openingElement.attributes) {
|
|
605
638
|
visit(attribute.type === "JSXSpreadAttribute" ? attribute.argument : attribute.value);
|
|
606
639
|
}
|
|
640
|
+
const form = ui.tag === "form";
|
|
641
|
+
if (form) formDepth += 1;
|
|
607
642
|
visitChildren(node.children, ui);
|
|
643
|
+
if (form) formDepth -= 1;
|
|
608
644
|
append(parent, ui);
|
|
609
645
|
return ui;
|
|
610
646
|
}
|
|
@@ -684,7 +720,7 @@ function analyzeSource(file, source, parseSync) {
|
|
|
684
720
|
if (calleeName === "setInterval") wins.add("timer");
|
|
685
721
|
if (callee.type === "Identifier" && SERVER_FN_FACTORIES.has(callee.name)) {
|
|
686
722
|
const binding = imported.get(callee.name);
|
|
687
|
-
if (_optionalChain([binding, 'optionalAccess',
|
|
723
|
+
if (_optionalChain([binding, 'optionalAccess', _24 => _24.source, 'access', _25 => _25.startsWith, 'call', _26 => _26("@farm.js/core")])) callsServerFactory = true;
|
|
688
724
|
}
|
|
689
725
|
if (calleeName === "map" && callee.type === "MemberExpression" && parent) {
|
|
690
726
|
const before = facts.elements.total;
|
|
@@ -749,11 +785,11 @@ function analyzeSource(file, source, parseSync) {
|
|
|
749
785
|
const isDefault = statement.type === "ExportDefaultDeclaration";
|
|
750
786
|
const declaration = statement.type === "ExportNamedDeclaration" || isDefault ? statement.declaration : statement;
|
|
751
787
|
const roots = [];
|
|
752
|
-
if (_optionalChain([declaration, 'optionalAccess',
|
|
788
|
+
if (_optionalChain([declaration, 'optionalAccess', _27 => _27.type]) === "FunctionDeclaration" || isDefault && /Function/.test(_nullishCoalesce(_optionalChain([declaration, 'optionalAccess', _28 => _28.type]), () => ( "")))) {
|
|
753
789
|
roots.push([isDefault ? "default" : declaration.id.name, declaration]);
|
|
754
|
-
} else if (_optionalChain([declaration, 'optionalAccess',
|
|
790
|
+
} else if (_optionalChain([declaration, 'optionalAccess', _29 => _29.type]) === "VariableDeclaration") {
|
|
755
791
|
for (const declarator of declaration.declarations) {
|
|
756
|
-
if (declarator.id.type === "Identifier" && /Function/.test(_nullishCoalesce(_optionalChain([declarator, 'access',
|
|
792
|
+
if (declarator.id.type === "Identifier" && /Function/.test(_nullishCoalesce(_optionalChain([declarator, 'access', _30 => _30.init, 'optionalAccess', _31 => _31.type]), () => ( "")))) {
|
|
757
793
|
roots.push([declarator.id.name, declarator]);
|
|
758
794
|
}
|
|
759
795
|
}
|
|
@@ -769,7 +805,7 @@ function analyzeSource(file, source, parseSync) {
|
|
|
769
805
|
facts.components[name] = holder.children.length === 1 ? holder.children[0] : holder;
|
|
770
806
|
}
|
|
771
807
|
}
|
|
772
|
-
if (isDefault && _optionalChain([declaration, 'optionalAccess',
|
|
808
|
+
if (isDefault && _optionalChain([declaration, 'optionalAccess', _32 => _32.type]) === "Identifier") {
|
|
773
809
|
facts.components.default = { kind: "Component", tag: declaration.name };
|
|
774
810
|
}
|
|
775
811
|
}
|
|
@@ -780,6 +816,278 @@ function analyzeSource(file, source, parseSync) {
|
|
|
780
816
|
facts.blockers.sort((left, right) => left.line - right.line || left.column - right.column);
|
|
781
817
|
return facts;
|
|
782
818
|
}
|
|
819
|
+
var COMPONENT_STRUCTURE = /* @__PURE__ */ new Set([
|
|
820
|
+
"template",
|
|
821
|
+
"slot",
|
|
822
|
+
"Transition",
|
|
823
|
+
"TransitionGroup",
|
|
824
|
+
"KeepAlive",
|
|
825
|
+
"Suspense",
|
|
826
|
+
"svelte:head",
|
|
827
|
+
"svelte:fragment",
|
|
828
|
+
"svelte:options",
|
|
829
|
+
"svelte:window",
|
|
830
|
+
"svelte:body",
|
|
831
|
+
"svelte:document",
|
|
832
|
+
"svelte:boundary"
|
|
833
|
+
]);
|
|
834
|
+
var COMPONENT_DYNAMIC = /* @__PURE__ */ new Set(["component", "svelte:element", "svelte:component", "Teleport"]);
|
|
835
|
+
var VOID_ELEMENTS = new Set(
|
|
836
|
+
"area base br col embed hr img input link meta source track wbr".split(" ")
|
|
837
|
+
);
|
|
838
|
+
function analyzeComponentSource(file, source, parseSync) {
|
|
839
|
+
const blocks = _chunkWBTHHTBOcjs.readFarmComponentBlocks.call(void 0, file, source);
|
|
840
|
+
const name = blocks.kind === "vue" ? "Vue" : "Svelte";
|
|
841
|
+
const scripts = _chunkWBTHHTBOcjs.keepFarmComponentRanges.call(void 0, source, blocks.scripts);
|
|
842
|
+
const typed = blocks.scripts.some((script) => script.attributes.lang === "tsx") ? "tsx" : "ts";
|
|
843
|
+
const facts = analyzeSource(file, scripts, parseSync, typed);
|
|
844
|
+
facts.blockers = facts.blockers.filter((blocker) => blocker.rule !== "client-logic");
|
|
845
|
+
const starts = lineStarts(source);
|
|
846
|
+
const block = (offset, rule, message, only) => facts.blockers.push({ ...locate(starts, offset), rule, message, ...only ? { only } : {} });
|
|
847
|
+
facts.blockers.push({
|
|
848
|
+
line: 1,
|
|
849
|
+
column: 1,
|
|
850
|
+
rule: "renderer-component",
|
|
851
|
+
message: `a ${name} component has no React Native port`,
|
|
852
|
+
only: "react-native"
|
|
853
|
+
});
|
|
854
|
+
for (const script of _chunkWBTHHTBOcjs.farmComponentModuleScripts.call(void 0, blocks)) {
|
|
855
|
+
const hydrate = /\bexport\s+const\s+hydrate\s*=\s*true\b/.exec(
|
|
856
|
+
source.slice(script.start, script.end)
|
|
857
|
+
);
|
|
858
|
+
if (hydrate) {
|
|
859
|
+
block(
|
|
860
|
+
script.start + hydrate.index,
|
|
861
|
+
"client-logic",
|
|
862
|
+
"it exports hydrate = true, which hydrates the page in the browser",
|
|
863
|
+
"native"
|
|
864
|
+
);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
const styles = blocks.styles.filter((style) => !style.attributes.lang || style.attributes.lang === "css").map((style) => source.slice(style.start, style.end));
|
|
868
|
+
if (styles.length > 0) facts.styles = styles;
|
|
869
|
+
for (const style of blocks.styles) {
|
|
870
|
+
if (style.attributes.lang && style.attributes.lang !== "css") {
|
|
871
|
+
block(
|
|
872
|
+
style.start,
|
|
873
|
+
"css-import",
|
|
874
|
+
`<style lang="${String(style.attributes.lang)}"> is not CSS`
|
|
875
|
+
);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
const imported = /* @__PURE__ */ new Set();
|
|
879
|
+
for (const script of blocks.scripts) {
|
|
880
|
+
const text = source.slice(script.start, script.end);
|
|
881
|
+
for (const match of text.matchAll(/\bimport\s+(?:type\s+)?([\w$]+)\s*(?:,|from\b)/g)) {
|
|
882
|
+
imported.add(match[1]);
|
|
883
|
+
}
|
|
884
|
+
for (const match of text.matchAll(/\bimport\s+(?:[\w$]+\s*,\s*)?\{([^}]*)\}/g)) {
|
|
885
|
+
for (const part of match[1].split(",")) {
|
|
886
|
+
const local = _optionalChain([part, 'access', _33 => _33.trim, 'call', _34 => _34(), 'access', _35 => _35.split, 'call', _36 => _36(/\s+as\s+/), 'access', _37 => _37.pop, 'call', _38 => _38(), 'optionalAccess', _39 => _39.trim, 'call', _40 => _40()]);
|
|
887
|
+
if (local) imported.add(local);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
const pascal = (tag) => tag.replace(/(^|-)([a-z])/g, (_, __, letter) => letter.toUpperCase());
|
|
892
|
+
let formDepth = 0;
|
|
893
|
+
const open = [];
|
|
894
|
+
for (const range of blocks.markup) {
|
|
895
|
+
const markup = source.slice(range.start, range.end);
|
|
896
|
+
let index = 0;
|
|
897
|
+
while (index < markup.length) {
|
|
898
|
+
const at = range.start + index;
|
|
899
|
+
if (markup.startsWith("<!--", index)) {
|
|
900
|
+
const end = markup.indexOf("-->", index + 4);
|
|
901
|
+
index = end === -1 ? markup.length : end + 3;
|
|
902
|
+
continue;
|
|
903
|
+
}
|
|
904
|
+
if (markup[index] === "{") {
|
|
905
|
+
const end = closeBrace(markup, index);
|
|
906
|
+
if (blocks.kind === "svelte" && /^\{@html\b/.test(markup.slice(index))) {
|
|
907
|
+
block(at, "dangerously-set-inner-html", "{@html} renders raw HTML");
|
|
908
|
+
}
|
|
909
|
+
index = end;
|
|
910
|
+
continue;
|
|
911
|
+
}
|
|
912
|
+
if (markup[index] !== "<") {
|
|
913
|
+
index += 1;
|
|
914
|
+
continue;
|
|
915
|
+
}
|
|
916
|
+
const closing = markup[index + 1] === "/";
|
|
917
|
+
const nameMatch = /^[A-Za-z][\w:.-]*/.exec(markup.slice(index + (closing ? 2 : 1)));
|
|
918
|
+
if (!nameMatch) {
|
|
919
|
+
index += 1;
|
|
920
|
+
continue;
|
|
921
|
+
}
|
|
922
|
+
const tag = nameMatch[0];
|
|
923
|
+
let cursor = index + (closing ? 2 : 1) + tag.length;
|
|
924
|
+
const attributes = [];
|
|
925
|
+
let selfClosing = false;
|
|
926
|
+
while (cursor < markup.length && markup[cursor] !== ">") {
|
|
927
|
+
const char = markup[cursor];
|
|
928
|
+
if (/\s/.test(char)) {
|
|
929
|
+
cursor += 1;
|
|
930
|
+
continue;
|
|
931
|
+
}
|
|
932
|
+
if (char === "/" && markup[cursor + 1] === ">") {
|
|
933
|
+
selfClosing = true;
|
|
934
|
+
cursor += 1;
|
|
935
|
+
continue;
|
|
936
|
+
}
|
|
937
|
+
if (char === "{") {
|
|
938
|
+
attributes.push({ name: "{", dynamic: true, offset: range.start + cursor });
|
|
939
|
+
cursor = closeBrace(markup, cursor);
|
|
940
|
+
continue;
|
|
941
|
+
}
|
|
942
|
+
const attrName = _nullishCoalesce(_optionalChain([/^[^\s=/>]+/, 'access', _41 => _41.exec, 'call', _42 => _42(markup.slice(cursor)), 'optionalAccess', _43 => _43[0]]), () => ( char));
|
|
943
|
+
const attrOffset = range.start + cursor;
|
|
944
|
+
cursor += attrName.length;
|
|
945
|
+
while (/\s/.test(_nullishCoalesce(markup[cursor], () => ( "")))) cursor += 1;
|
|
946
|
+
let value2;
|
|
947
|
+
let braced = false;
|
|
948
|
+
if (markup[cursor] === "=") {
|
|
949
|
+
cursor += 1;
|
|
950
|
+
while (/\s/.test(_nullishCoalesce(markup[cursor], () => ( "")))) cursor += 1;
|
|
951
|
+
const quote = markup[cursor];
|
|
952
|
+
if (quote === '"' || quote === "'") {
|
|
953
|
+
const end = markup.indexOf(quote, cursor + 1);
|
|
954
|
+
value2 = markup.slice(cursor + 1, end === -1 ? markup.length : end);
|
|
955
|
+
cursor = end === -1 ? markup.length : end + 1;
|
|
956
|
+
} else if (quote === "{") {
|
|
957
|
+
const end = closeBrace(markup, cursor);
|
|
958
|
+
value2 = markup.slice(cursor, end);
|
|
959
|
+
braced = true;
|
|
960
|
+
cursor = end;
|
|
961
|
+
} else {
|
|
962
|
+
value2 = _nullishCoalesce(_optionalChain([/^[^\s>]+/, 'access', _44 => _44.exec, 'call', _45 => _45(markup.slice(cursor)), 'optionalAccess', _46 => _46[0]]), () => ( ""));
|
|
963
|
+
cursor += value2.length;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
const dynamic = braced || attrName.startsWith(":") || attrName.startsWith("v-bind:") || attrName.startsWith("@") || attrName.startsWith("v-on:") || blocks.kind === "svelte" && value2 !== void 0 && /\{/.test(value2);
|
|
967
|
+
attributes.push({ name: attrName, value: value2, dynamic, offset: attrOffset });
|
|
968
|
+
}
|
|
969
|
+
index = cursor + 1;
|
|
970
|
+
if (closing) {
|
|
971
|
+
const position = open.lastIndexOf(tag);
|
|
972
|
+
if (position !== -1) {
|
|
973
|
+
for (const closed of open.splice(position)) if (closed === "form") formDepth -= 1;
|
|
974
|
+
}
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
const element = !selfClosing && !VOID_ELEMENTS.has(tag.toLowerCase());
|
|
978
|
+
if (element) open.push(tag);
|
|
979
|
+
if (tag === "form" && element) formDepth += 1;
|
|
980
|
+
for (const attribute of attributes) {
|
|
981
|
+
if (attribute.name === "v-html") {
|
|
982
|
+
block(attribute.offset, "dangerously-set-inner-html", "v-html renders raw HTML");
|
|
983
|
+
}
|
|
984
|
+
if (attribute.name.toLowerCase() === "contenteditable") {
|
|
985
|
+
block(attribute.offset, "content-editable", "contentEditable");
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
if (COMPONENT_STRUCTURE.has(tag)) continue;
|
|
989
|
+
if (COMPONENT_DYNAMIC.has(tag) || attributes.some((attribute) => attribute.name === "is")) {
|
|
990
|
+
block(at, "dynamic-component", `<${tag}> picks what it renders at runtime`);
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
const intrinsic = /^[a-z][a-z0-9]*$/.test(tag);
|
|
994
|
+
if (!intrinsic) {
|
|
995
|
+
if (!imported.has(tag) && !imported.has(pascal(tag))) {
|
|
996
|
+
block(at, "dynamic-component", `<${tag}> is not a component this file imports`);
|
|
997
|
+
}
|
|
998
|
+
continue;
|
|
999
|
+
}
|
|
1000
|
+
const kind = INTRINSIC_KINDS[tag];
|
|
1001
|
+
if (!facts.tags.includes(tag)) facts.tags.push(tag);
|
|
1002
|
+
facts.elements.total += 1;
|
|
1003
|
+
if (!kind) {
|
|
1004
|
+
block(at, "unmapped-element", `<${tag}> has no native mapping`);
|
|
1005
|
+
continue;
|
|
1006
|
+
}
|
|
1007
|
+
facts.elements.mapped += 1;
|
|
1008
|
+
facts.elements.byKind[kind] = (_nullishCoalesce(facts.elements.byKind[kind], () => ( 0))) + 1;
|
|
1009
|
+
const value = (attr) => attributes.find((attribute) => attribute.name.toLowerCase() === attr);
|
|
1010
|
+
const boundAttribute = (attr) => attributes.find(
|
|
1011
|
+
(attribute) => attribute.dynamic && (attribute.name === `:${attr}` || attribute.name === `v-bind:${attr}` || attribute.name === attr) || attr === "class" && attribute.name.startsWith("class:")
|
|
1012
|
+
);
|
|
1013
|
+
const classes = value("class");
|
|
1014
|
+
if (boundAttribute("class")) {
|
|
1015
|
+
block(at, "runtime-class-name", `<${tag}> builds its class names at runtime`);
|
|
1016
|
+
} else if (_optionalChain([classes, 'optionalAccess', _47 => _47.value])) {
|
|
1017
|
+
for (const token of classes.value.split(/\s+/).filter(Boolean)) {
|
|
1018
|
+
const problem = classifyClass(token);
|
|
1019
|
+
if (problem && /^class ".*" is not in the native Tailwind subset$/.test(problem)) {
|
|
1020
|
+
facts.appClasses.push({ name: token, ...locate(starts, classes.offset) });
|
|
1021
|
+
} else if (problem) block(classes.offset, "class-name", problem);
|
|
1022
|
+
else {
|
|
1023
|
+
const native = _chunkV727H3RIcjs.farmNativeClassProblem.call(void 0, token);
|
|
1024
|
+
if (native) block(classes.offset, "class-name", native, "native");
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
const style = value("style");
|
|
1029
|
+
if (boundAttribute("style")) {
|
|
1030
|
+
block(at, "runtime-style", `<${tag}> style is computed at runtime`);
|
|
1031
|
+
} else if (_optionalChain([style, 'optionalAccess', _48 => _48.value])) {
|
|
1032
|
+
for (const declaration of _chunkV727H3RIcjs.resolveFarmNativeInlineStyle.call(void 0, style.value).unsupported) {
|
|
1033
|
+
block(
|
|
1034
|
+
style.offset,
|
|
1035
|
+
"style",
|
|
1036
|
+
`<${tag}> style "${declaration}" has no native-tier style`,
|
|
1037
|
+
"native"
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
const type = value("type");
|
|
1042
|
+
if (tag === "input") {
|
|
1043
|
+
const inputType = _optionalChain([type, 'optionalAccess', _49 => _49.dynamic]) ? void 0 : (_nullishCoalesce(_optionalChain([type, 'optionalAccess', _50 => _50.value]), () => ( "text"))).toLowerCase();
|
|
1044
|
+
const formType = formDepth > 0 && (inputType === "hidden" || inputType === "submit");
|
|
1045
|
+
if (!formType && (inputType === void 0 || !INPUT_TYPES.has(inputType))) {
|
|
1046
|
+
block(
|
|
1047
|
+
at,
|
|
1048
|
+
"unmapped-element",
|
|
1049
|
+
`<input type="${_nullishCoalesce(inputType, () => ( "{expr}"))}"> has no native mapping`
|
|
1050
|
+
);
|
|
1051
|
+
continue;
|
|
1052
|
+
}
|
|
1053
|
+
if (inputType === "hidden") continue;
|
|
1054
|
+
}
|
|
1055
|
+
const buttonType = tag === "button" ? (_nullishCoalesce(_optionalChain([type, 'optionalAccess', _51 => _51.value]), () => ( "submit"))).toLowerCase() : void 0;
|
|
1056
|
+
if ((tag === "button" || kind === "TextInput") && !value("action") && !value("formaction") && (formDepth === 0 || buttonType !== void 0 && buttonType !== "submit")) {
|
|
1057
|
+
block(
|
|
1058
|
+
at,
|
|
1059
|
+
"inert-control",
|
|
1060
|
+
formDepth > 0 ? `<button type="${buttonType}"> does nothing on a native-tier screen` : `<${tag}> has no link or form to submit on a native-tier screen`,
|
|
1061
|
+
"native"
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
if (tag === "form") {
|
|
1065
|
+
const method = value("method");
|
|
1066
|
+
const methodValue = (_nullishCoalesce(_optionalChain([method, 'optionalAccess', _52 => _52.value]), () => ( "get"))).toLowerCase();
|
|
1067
|
+
if (_optionalChain([method, 'optionalAccess', _53 => _53.dynamic]) || methodValue !== "get" && methodValue !== "post") {
|
|
1068
|
+
block(at, "form-action", `<form method="${_nullishCoalesce(_optionalChain([method, 'optionalAccess', _54 => _54.value]), () => ( "{expr}"))}">`, "native");
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
return facts;
|
|
1074
|
+
}
|
|
1075
|
+
function closeBrace(text, start) {
|
|
1076
|
+
let depth = 0;
|
|
1077
|
+
for (let index = start; index < text.length; index += 1) {
|
|
1078
|
+
const char = text[index];
|
|
1079
|
+
if (char === '"' || char === "'" || char === "`") {
|
|
1080
|
+
const end = text.indexOf(char, index + 1);
|
|
1081
|
+
if (end === -1) return text.length;
|
|
1082
|
+
index = end;
|
|
1083
|
+
} else if (char === "{") depth += 1;
|
|
1084
|
+
else if (char === "}") {
|
|
1085
|
+
depth -= 1;
|
|
1086
|
+
if (depth === 0) return index + 1;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
return text.length;
|
|
1090
|
+
}
|
|
783
1091
|
function readAliases(root, srcDir) {
|
|
784
1092
|
const aliases = [{ prefix: "@/", targets: [path.join(root, srcDir) + path.sep] }];
|
|
785
1093
|
try {
|
|
@@ -836,7 +1144,7 @@ function classifyPackage(fact, serverBoundary) {
|
|
|
836
1144
|
}
|
|
837
1145
|
if (specifier.startsWith("@farm.js/core")) {
|
|
838
1146
|
const portable = CORE_PORTABLE[specifier];
|
|
839
|
-
const unmapped = fact.names.filter((name2) => !_optionalChain([portable, 'optionalAccess',
|
|
1147
|
+
const unmapped = fact.names.filter((name2) => !_optionalChain([portable, 'optionalAccess', _55 => _55.has, 'call', _56 => _56(name2)]));
|
|
840
1148
|
if (unmapped.length > 0 || !portable) {
|
|
841
1149
|
return {
|
|
842
1150
|
...at,
|
|
@@ -922,11 +1230,14 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
922
1230
|
let pending = facts.get(file);
|
|
923
1231
|
if (!pending) {
|
|
924
1232
|
pending = _promises.readFile.call(void 0, file, "utf8").then((source) => {
|
|
925
|
-
const
|
|
1233
|
+
const component = _chunkWBTHHTBOcjs.farmComponentKind.call(void 0, file);
|
|
1234
|
+
const hash = _crypto.createHash.call(void 0, "sha1").update(
|
|
1235
|
+
component ? `${component}\0` : file.endsWith(".tsx") ? "tsx\0" : file.endsWith(".ts") ? "ts\0" : "jsx\0"
|
|
1236
|
+
).update(source).digest("hex");
|
|
926
1237
|
let result = cache.modules[hash];
|
|
927
1238
|
if (result) cached += 1;
|
|
928
1239
|
else {
|
|
929
|
-
result = analyzeSource(file, source, parseSync);
|
|
1240
|
+
result = component ? analyzeComponentSource(file, source, parseSync) : analyzeSource(file, source, parseSync);
|
|
930
1241
|
parsed += 1;
|
|
931
1242
|
}
|
|
932
1243
|
used[hash] = result;
|
|
@@ -990,7 +1301,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
990
1301
|
}
|
|
991
1302
|
};
|
|
992
1303
|
}
|
|
993
|
-
if (!
|
|
1304
|
+
if (!isModuleFile(file)) {
|
|
994
1305
|
return {
|
|
995
1306
|
fact,
|
|
996
1307
|
blocker: {
|
|
@@ -1027,8 +1338,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1027
1338
|
const scripts = /* @__PURE__ */ new Set();
|
|
1028
1339
|
for (const { page, layouts } of entries.values()) {
|
|
1029
1340
|
for (const file of [page, ...layouts]) {
|
|
1030
|
-
if (file &&
|
|
1031
|
-
scripts.add(file);
|
|
1341
|
+
if (file && isModuleFile(file)) scripts.add(file);
|
|
1032
1342
|
}
|
|
1033
1343
|
}
|
|
1034
1344
|
await Promise.all([...scripts].map(visitModule));
|
|
@@ -1048,7 +1358,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1048
1358
|
const allStylesheets = /* @__PURE__ */ new Set();
|
|
1049
1359
|
const unreadStylesheets = /* @__PURE__ */ new Set();
|
|
1050
1360
|
for (const [route, { page, layouts }] of entries) {
|
|
1051
|
-
if (!page && _optionalChain([options, 'access',
|
|
1361
|
+
if (!page && _optionalChain([options, 'access', _57 => _57.nativeOnlyRoutes, 'optionalAccess', _58 => _58.has, 'call', _59 => _59(route)])) continue;
|
|
1052
1362
|
const blockers = [];
|
|
1053
1363
|
const wins = /* @__PURE__ */ new Set();
|
|
1054
1364
|
const elements = { total: 0, mapped: 0, byKind: {} };
|
|
@@ -1059,6 +1369,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1059
1369
|
const tags = /* @__PURE__ */ new Set();
|
|
1060
1370
|
const graph = [];
|
|
1061
1371
|
const layoutClasses = /* @__PURE__ */ new Set();
|
|
1372
|
+
const componentSheets = [];
|
|
1062
1373
|
const walk = (file, entry, layout) => {
|
|
1063
1374
|
if (seen.has(file)) return;
|
|
1064
1375
|
seen.add(file);
|
|
@@ -1113,6 +1424,9 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1113
1424
|
for (const appClass of moduleFacts.appClasses)
|
|
1114
1425
|
appClasses.push({ file: label, ...appClass });
|
|
1115
1426
|
for (const tag of moduleFacts.tags) tags.add(tag);
|
|
1427
|
+
for (const css of _nullishCoalesce(moduleFacts.styles, () => ( []))) {
|
|
1428
|
+
componentSheets.push(_chunkV727H3RIcjs.parseFarmNativeStylesheet.call(void 0, css));
|
|
1429
|
+
}
|
|
1116
1430
|
}
|
|
1117
1431
|
for (const win of moduleFacts.wins) wins.add(win);
|
|
1118
1432
|
elements.total += moduleFacts.elements.total;
|
|
@@ -1127,7 +1441,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1127
1441
|
if (entryImport.stylesheet) {
|
|
1128
1442
|
stylesheets.add(entryImport.stylesheet);
|
|
1129
1443
|
allStylesheets.add(entryImport.stylesheet);
|
|
1130
|
-
} else if (_optionalChain([entryImport, 'access',
|
|
1444
|
+
} else if (_optionalChain([entryImport, 'access', _60 => _60.blocker, 'optionalAccess', _61 => _61.rule]) === "css-import") {
|
|
1131
1445
|
unreadStylesheets.add(entryImport.fact.source);
|
|
1132
1446
|
}
|
|
1133
1447
|
if (entryImport.blocker) add({ file: label, ...entryImport.blocker });
|
|
@@ -1155,7 +1469,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1155
1469
|
ir.root = `${relative2(root, page)}#default`;
|
|
1156
1470
|
}
|
|
1157
1471
|
for (const layout of layouts) walk(layout, true, true);
|
|
1158
|
-
const sheets = [...stylesheets].map(readStylesheet);
|
|
1472
|
+
const sheets = [...[...stylesheets].map(readStylesheet), ...componentSheets];
|
|
1159
1473
|
for (const appClass of appClasses) {
|
|
1160
1474
|
const { styled, problems } = _chunkV727H3RIcjs.inspectFarmNativeStylesheets.call(void 0, sheets, { class: appClass.name });
|
|
1161
1475
|
const at = { file: appClass.file, line: appClass.line, column: appClass.column };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkFJWN7RV4cjs = require('./chunk-FJWN7RV4.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk2C5L5RPMcjs = require('./chunk-2C5L5RPM.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -105,10 +105,10 @@ function collectFarmDefaultMCPPages(sources, options) {
|
|
|
105
105
|
for (const source of sources) {
|
|
106
106
|
const module = isRecord(source.module) ? source.module : void 0;
|
|
107
107
|
if (_optionalChain([module, 'optionalAccess', _ => _.__farmRouteGuard])) continue;
|
|
108
|
-
if (!
|
|
108
|
+
if (!_chunk2C5L5RPMcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, source.pattern)) continue;
|
|
109
109
|
readable.push({ pattern: source.pattern, metadata: _optionalChain([module, 'optionalAccess', _2 => _2.metadata]) });
|
|
110
110
|
}
|
|
111
|
-
return
|
|
111
|
+
return _chunkFJWN7RV4cjs.collectFarmLlmsTxtPages.call(void 0, readable, {
|
|
112
112
|
origin: options.origin,
|
|
113
113
|
basePath: options.basePath,
|
|
114
114
|
markdown: options.markdown
|
|
@@ -118,7 +118,7 @@ function collectFarmDefaultMCPPages(sources, options) {
|
|
|
118
118
|
url: `${options.origin}${_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, page.path, options.basePath)}`,
|
|
119
119
|
...page.description ? { description: page.description } : {},
|
|
120
120
|
markdownUrl: `${options.origin}${_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0,
|
|
121
|
-
|
|
121
|
+
_chunk2C5L5RPMcjs.getFarmMarkdownMirrorPath.call(void 0, page.path),
|
|
122
122
|
options.basePath
|
|
123
123
|
)}`
|
|
124
124
|
}));
|