@farm.js/core 0.1.64 → 0.1.66
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/{analyzer-Q3QXC6PD.mjs → analyzer-4UFP4HVP.mjs} +3 -3
- package/dist/analyzer-H7SIX6BJ.cjs +16 -0
- package/dist/{chunk-XVWSDSUM.mjs → chunk-27FPUFWR.mjs} +60 -5
- package/dist/{chunk-JCEFKP5M.mjs → chunk-423SSBYQ.mjs} +6 -0
- package/dist/{chunk-SLYDIHLW.mjs → chunk-435QJNC2.mjs} +2 -2
- package/dist/{chunk-XZLZ6YPP.cjs → chunk-4OSOLDPL.cjs} +118 -50
- package/dist/{chunk-MG356ROI.cjs → chunk-4TVPYN32.cjs} +3 -3
- package/dist/chunk-672ISQIG.mjs +3704 -0
- package/dist/{chunk-NXFA7G3Y.cjs → chunk-752IHQTD.cjs} +4 -4
- package/dist/chunk-7ONGIFYX.cjs +3704 -0
- package/dist/{chunk-RAH5MT53.mjs → chunk-AZUUKA66.mjs} +153 -42
- package/dist/{chunk-O2XFIPNL.cjs → chunk-BIF5MLTH.cjs} +1 -1
- package/dist/{chunk-FH45OB37.mjs → chunk-BYRZ5VTH.mjs} +1 -1
- package/dist/{chunk-V727H3RI.cjs → chunk-CCAUIBIS.cjs} +6 -0
- package/dist/{chunk-DUSHDZQL.cjs → chunk-CHYTADNK.cjs} +15 -13
- package/dist/chunk-CJNAUEVC.mjs +34 -0
- package/dist/{chunk-S25BQIFW.cjs → chunk-DVKH2RVN.cjs} +2 -2
- package/dist/{chunk-FAP7CX7C.cjs → chunk-E4UDLFWR.cjs} +527 -3019
- package/dist/{chunk-EFZGB7JC.cjs → chunk-E5UN4OWX.cjs} +1 -0
- package/dist/{chunk-WNYRYI4D.mjs → chunk-EMNKZGF4.mjs} +380 -2872
- package/dist/{chunk-VVTJTMGQ.cjs → chunk-GL7N5UHF.cjs} +4 -4
- package/dist/{chunk-UR25Z5Z6.mjs → chunk-HCGWDRZO.mjs} +1 -1
- package/dist/{chunk-EL4364S2.cjs → chunk-HZPKJRYA.cjs} +74 -19
- package/dist/{chunk-3EBHJET2.cjs → chunk-IT6WRNGB.cjs} +380 -269
- package/dist/{chunk-LQDLEWPO.mjs → chunk-MPIGW42F.mjs} +1 -1
- package/dist/{chunk-S7ZW72JH.cjs → chunk-MPJEIHW2.cjs} +2 -2
- package/dist/{chunk-53ZCZ46B.cjs → chunk-NHQM2Q4I.cjs} +2 -1
- package/dist/{chunk-UYRI6U3P.mjs → chunk-O75GQVUK.mjs} +2 -1
- package/dist/{chunk-OYF23QLG.mjs → chunk-OB7VKCUZ.mjs} +38 -33
- package/dist/{chunk-JCPSA4X5.cjs → chunk-OP7LHY4Y.cjs} +128 -123
- package/dist/{chunk-O7IEMY55.cjs → chunk-RY4ABNPE.cjs} +3 -3
- package/dist/{chunk-6NHSGVVA.mjs → chunk-SK7QSNWE.mjs} +1 -1
- package/dist/{chunk-NNLFW3P4.mjs → chunk-TKK5QHKZ.mjs} +1 -1
- package/dist/{chunk-ZNXTU4YH.mjs → chunk-TM2E623I.mjs} +1 -0
- package/dist/{chunk-PAKCHVUS.mjs → chunk-TPA2PV5J.mjs} +3 -35
- package/dist/{chunk-6NNYPY5W.mjs → chunk-UBMHQVWN.mjs} +78 -10
- package/dist/{chunk-BPNOYILC.cjs → chunk-UVV3I5QA.cjs} +3 -35
- package/dist/{chunk-N3Z3PLHC.cjs → chunk-VBCQ5WOI.cjs} +6 -6
- package/dist/{chunk-WFNAOWH4.mjs → chunk-WFWFECDW.mjs} +2 -2
- package/dist/{chunk-SNFTMSHX.mjs → chunk-WVYRLP5E.mjs} +1 -1
- package/dist/{chunk-O4FWNLQK.mjs → chunk-XBSLKXBL.mjs} +10 -8
- package/dist/chunk-ZIHWAN55.cjs +34 -0
- package/dist/{devtools-WET5NAKO.cjs → devtools-N2JQCMXB.cjs} +5 -4
- package/dist/{devtools-MX3FE733.mjs → devtools-NZUVNUP3.mjs} +4 -3
- package/dist/docs.cjs +6 -5
- package/dist/docs.mjs +5 -4
- package/dist/environment/vite.cjs +9 -2
- package/dist/environment/vite.d.mts +3 -0
- package/dist/environment/vite.d.ts +3 -0
- package/dist/environment/vite.mjs +8 -1
- package/dist/index.cjs +22 -21
- package/dist/index.mjs +21 -20
- package/dist/internal/build-runtime.cjs +20 -19
- package/dist/internal/build-runtime.mjs +19 -18
- package/dist/internal/cli-runtime.cjs +6 -5
- package/dist/internal/cli-runtime.mjs +5 -4
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/config-runtime.cjs +6 -5
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/native-server-fns.cjs +5 -5
- package/dist/internal/native-server-fns.mjs +4 -4
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +7 -7
- package/dist/internal/production-runtime.d.mts +14 -0
- package/dist/internal/production-runtime.d.ts +14 -0
- package/dist/internal/production-runtime.mjs +6 -6
- package/dist/{native-tree-WOX3JMBG.cjs → native-tree-7LPH57Z4.cjs} +3 -3
- package/dist/{native-tree-BPEE2LAL.mjs → native-tree-VV6WN3GX.mjs} +2 -2
- package/dist/plugin.cjs +11 -10
- package/dist/plugin.mjs +10 -9
- package/dist/{port-UFUZL6RI.mjs → port-CLL4BC4O.mjs} +1 -1
- package/dist/{port-VTLHPZOI.cjs → port-HASZTQGY.cjs} +9 -9
- package/dist/{rsc-pipeline-3LNVP2OO.mjs → rsc-pipeline-7PNVJSTR.mjs} +6 -5
- package/dist/{rsc-pipeline-G5WELVW3.cjs → rsc-pipeline-Z7QBZOIJ.cjs} +7 -6
- package/dist/{runtime-DMEULPE7.cjs → runtime-FKFCUHSK.cjs} +21 -20
- package/dist/{runtime-HQJ2LLQL.mjs → runtime-QQHX4BP3.mjs} +12 -11
- package/dist/server.cjs +36 -35
- package/dist/server.mjs +19 -18
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +14 -12
- package/dist/vite.mjs +13 -11
- package/package.json +1 -1
- package/dist/analyzer-ODLF2Z6O.cjs +0 -16
- package/dist/chunk-NK2VWS7P.cjs +0 -954
- package/dist/chunk-ZQ5BDNKW.mjs +0 -954
|
@@ -12,17 +12,17 @@ var _chunkWBTHHTBOcjs = require('./chunk-WBTHHTBO.cjs');
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkCCAUIBIScjs = require('./chunk-CCAUIBIS.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkBIF5MLTHcjs = require('./chunk-BIF5MLTH.cjs');
|
|
19
19
|
|
|
20
20
|
// src/mobile/analyzer.ts
|
|
21
21
|
var _crypto = require('crypto');
|
|
22
22
|
var _fs = require('fs');
|
|
23
23
|
var _promises = require('fs/promises');
|
|
24
24
|
var _path = require('path'); var path = _interopRequireWildcard(_path);
|
|
25
|
-
var ANALYZER_VERSION = `
|
|
25
|
+
var ANALYZER_VERSION = `7:${_chunkBIF5MLTHcjs.FARM_VERSION}`;
|
|
26
26
|
var INTRINSIC_KINDS = {};
|
|
27
27
|
for (const tag of "div section main article header footer nav aside figure hr li".split(" ")) {
|
|
28
28
|
INTRINSIC_KINDS[tag] = "View";
|
|
@@ -41,6 +41,8 @@ Object.assign(INTRINSIC_KINDS, {
|
|
|
41
41
|
ul: "List",
|
|
42
42
|
ol: "List"
|
|
43
43
|
});
|
|
44
|
+
var TABLE_TAGS = new Set("table caption thead tbody tfoot tr th td colgroup col".split(" "));
|
|
45
|
+
var TABLE_STYLE_PROPERTIES = /* @__PURE__ */ new Set(["tableLayout", "borderCollapse"]);
|
|
44
46
|
var INPUT_TYPES = /* @__PURE__ */ new Set(["text", "email", "password", "number", "search", "tel", "url"]);
|
|
45
47
|
var MAPPED_EVENTS = {
|
|
46
48
|
View: /* @__PURE__ */ new Set(["onClick"]),
|
|
@@ -148,13 +150,13 @@ var INLINE_BOX_TAGS = new Set("span strong em b i small label code".split(" "));
|
|
|
148
150
|
function hasBoxStyle(node) {
|
|
149
151
|
const tokens = _nullishCoalesce(node.style, () => ( []));
|
|
150
152
|
const classes = tokens.filter((token) => !token.startsWith("style."));
|
|
151
|
-
const resolved =
|
|
153
|
+
const resolved = _chunkCCAUIBIScjs.resolveFarmNativeClasses.call(void 0, classes.join(" "));
|
|
152
154
|
const keys = [
|
|
153
155
|
...Object.keys(resolved.style),
|
|
154
156
|
...Object.keys(_nullishCoalesce(resolved.dark, () => ( {}))),
|
|
155
157
|
...tokens.filter((token) => token.startsWith("style.")).map((token) => token.slice(6))
|
|
156
158
|
];
|
|
157
|
-
return keys.some((key) => !
|
|
159
|
+
return keys.some((key) => !_chunkCCAUIBIScjs.FARM_NATIVE_TEXT_KEYS.has(key));
|
|
158
160
|
}
|
|
159
161
|
var MAPPED_COMPONENTS = {
|
|
160
162
|
"@farm.js/core": { Link: "Pressable" },
|
|
@@ -188,7 +190,7 @@ var COLOR = "(?:inherit|current|transparent|black|white|(?:slate|gray|zinc|neutr
|
|
|
188
190
|
var SPACE = "(?:\\d+(?:\\.5)?|px|auto)";
|
|
189
191
|
var SIZE = "(?:\\d+(?:\\.5)?|px|auto|full|\\d+/\\d+|min|max|fit)";
|
|
190
192
|
var PORTABLE_CLASSES = [
|
|
191
|
-
/^(?:flex|flex-row|flex-col|flex-row-reverse|flex-col-reverse|flex-wrap|flex-nowrap|flex-wrap-reverse|flex-1|flex-auto|flex-initial|flex-none|grow|grow-0|shrink|shrink-0|hidden|relative|absolute|overflow-hidden|overflow-visible|italic|not-italic|underline|line-through|no-underline|uppercase|lowercase|capitalize|normal-case|text-left|text-center|text-right|text-justify)$/,
|
|
193
|
+
/^(?:flex|flex-row|flex-col|flex-row-reverse|flex-col-reverse|flex-wrap|flex-nowrap|flex-wrap-reverse|flex-1|flex-auto|flex-initial|flex-none|grow|grow-0|shrink|shrink-0|hidden|relative|absolute|overflow-hidden|overflow-visible|italic|not-italic|underline|line-through|no-underline|uppercase|lowercase|capitalize|normal-case|text-left|text-center|text-right|text-justify|table-auto|table-fixed|border-collapse)$/,
|
|
192
194
|
/^(?:items|justify|self|content)-(?:start|end|center|between|around|evenly|stretch|baseline|auto)$/,
|
|
193
195
|
new RegExp(
|
|
194
196
|
`^-?(?:gap|gap-x|gap-y|p|px|py|pt|pr|pb|pl|ps|pe|m|mx|my|mt|mr|mb|ml|ms|me)-${SPACE}$`
|
|
@@ -219,7 +221,7 @@ var BLOCKING_CLASSES = [
|
|
|
219
221
|
],
|
|
220
222
|
[/^(?:space-[xy]-.+|divide-.+)$/, "needs child selectors"],
|
|
221
223
|
[
|
|
222
|
-
/^(?:block|inline|inline-block|inline-flex|table.*|contents|flow-root|list-item)$/,
|
|
224
|
+
/^(?:block|inline|inline-block|inline-flex|table(?!-(?:auto|fixed)$).*|contents|flow-root|list-item)$/,
|
|
223
225
|
"sets a display mode other than flex"
|
|
224
226
|
],
|
|
225
227
|
[
|
|
@@ -345,15 +347,50 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
345
347
|
};
|
|
346
348
|
const needsDevice = (node, message) => block(node, "client-logic", message, "native");
|
|
347
349
|
let formDepth = 0;
|
|
350
|
+
const serverFunctions = /* @__PURE__ */ new Set();
|
|
351
|
+
const serverActionReference = (expression) => {
|
|
352
|
+
if (_optionalChain([expression, 'optionalAccess', _2 => _2.type]) === "Identifier") {
|
|
353
|
+
if (serverFunctions.has(expression.name)) return {};
|
|
354
|
+
const binding = imported.get(expression.name);
|
|
355
|
+
return binding ? { source: binding.source } : void 0;
|
|
356
|
+
}
|
|
357
|
+
if (_optionalChain([expression, 'optionalAccess', _3 => _3.type]) === "MemberExpression" && expression.object.type === "Identifier") {
|
|
358
|
+
const binding = imported.get(expression.object.name);
|
|
359
|
+
return _optionalChain([binding, 'optionalAccess', _4 => _4.name]) === "*" ? { source: binding.source } : void 0;
|
|
360
|
+
}
|
|
361
|
+
return void 0;
|
|
362
|
+
};
|
|
348
363
|
const result = parseSync(file, source, { lang });
|
|
349
364
|
if (result.errors.length > 0) {
|
|
350
365
|
const error = result.errors[0];
|
|
351
|
-
const offset = _nullishCoalesce(_optionalChain([error, 'access',
|
|
366
|
+
const offset = _nullishCoalesce(_optionalChain([error, 'access', _5 => _5.labels, 'optionalAccess', _6 => _6[0], 'optionalAccess', _7 => _7.start]), () => ( 0));
|
|
352
367
|
facts.blockers.push({ ...locate(starts, offset), rule: "parse-error", message: error.message });
|
|
353
368
|
return facts;
|
|
354
369
|
}
|
|
355
370
|
const program = result.program;
|
|
356
371
|
const wins = /* @__PURE__ */ new Set();
|
|
372
|
+
const usesServer = (body) => _optionalChain([body, 'optionalAccess', _8 => _8.type]) === "BlockStatement" && body.body.some(
|
|
373
|
+
(statement) => statement.type === "ExpressionStatement" && statement.directive === "use server"
|
|
374
|
+
);
|
|
375
|
+
const findServerFunctions = (node) => {
|
|
376
|
+
if (!node || typeof node !== "object") return;
|
|
377
|
+
if (Array.isArray(node)) {
|
|
378
|
+
for (const child of node) findServerFunctions(child);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const current = node;
|
|
382
|
+
if (current.type === "FunctionDeclaration" && current.id && usesServer(current.body)) {
|
|
383
|
+
serverFunctions.add(current.id.name);
|
|
384
|
+
} else if (current.type === "VariableDeclarator" && _optionalChain([current, 'access', _9 => _9.id, 'optionalAccess', _10 => _10.type]) === "Identifier" && (_optionalChain([current, 'access', _11 => _11.init, 'optionalAccess', _12 => _12.type]) === "ArrowFunctionExpression" || _optionalChain([current, 'access', _13 => _13.init, 'optionalAccess', _14 => _14.type]) === "FunctionExpression") && usesServer(current.init.body)) {
|
|
385
|
+
serverFunctions.add(current.id.name);
|
|
386
|
+
}
|
|
387
|
+
for (const [key, value] of Object.entries(current)) {
|
|
388
|
+
if (key !== "type" && key !== "start" && key !== "end" && value && typeof value === "object") {
|
|
389
|
+
findServerFunctions(value);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
findServerFunctions(program);
|
|
357
394
|
const imported = /* @__PURE__ */ new Map();
|
|
358
395
|
const topLevel = /* @__PURE__ */ new Set();
|
|
359
396
|
const declared = /* @__PURE__ */ new Set();
|
|
@@ -393,10 +430,10 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
393
430
|
}
|
|
394
431
|
const declaration = statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration" ? statement.declaration : statement;
|
|
395
432
|
if (!declaration) continue;
|
|
396
|
-
if (_optionalChain([declaration, 'access',
|
|
433
|
+
if (_optionalChain([declaration, 'access', _15 => _15.id, 'optionalAccess', _16 => _16.name]) && /Function|Class/.test(declaration.type)) {
|
|
397
434
|
topLevel.add(declaration.id.name);
|
|
398
435
|
}
|
|
399
|
-
if (_optionalChain([declaration, 'access',
|
|
436
|
+
if (_optionalChain([declaration, 'access', _17 => _17.id, 'optionalAccess', _18 => _18.name]) && declaration.async) asyncFunctions.add(declaration.id.name);
|
|
400
437
|
if (statement.type === "ExportDefaultDeclaration" && declaration.type === "Identifier") {
|
|
401
438
|
defaultName = declaration.name;
|
|
402
439
|
}
|
|
@@ -404,10 +441,10 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
404
441
|
for (const declarator of declaration.declarations) {
|
|
405
442
|
if (declarator.id.type !== "Identifier") continue;
|
|
406
443
|
const init = declarator.init;
|
|
407
|
-
if (_optionalChain([init, 'optionalAccess',
|
|
408
|
-
const callee = _optionalChain([init, 'optionalAccess',
|
|
409
|
-
const calleeName = _optionalChain([callee, 'optionalAccess',
|
|
410
|
-
if (/Function/.test(_nullishCoalesce(_optionalChain([init, 'optionalAccess',
|
|
444
|
+
if (_optionalChain([init, 'optionalAccess', _19 => _19.async])) asyncFunctions.add(declarator.id.name);
|
|
445
|
+
const callee = _optionalChain([init, 'optionalAccess', _20 => _20.type]) === "CallExpression" ? init.callee : void 0;
|
|
446
|
+
const calleeName = _optionalChain([callee, 'optionalAccess', _21 => _21.type]) === "MemberExpression" ? callee.property.name : _optionalChain([callee, 'optionalAccess', _22 => _22.name]);
|
|
447
|
+
if (/Function/.test(_nullishCoalesce(_optionalChain([init, 'optionalAccess', _23 => _23.type]), () => ( ""))) || calleeName && /^(?:memo|forwardRef|lazy)$/.test(calleeName)) {
|
|
411
448
|
topLevel.add(declarator.id.name);
|
|
412
449
|
}
|
|
413
450
|
}
|
|
@@ -432,7 +469,9 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
432
469
|
if (isIntrinsic) {
|
|
433
470
|
kind = INTRINSIC_KINDS[tag];
|
|
434
471
|
if (!facts.tags.includes(tag)) facts.tags.push(tag);
|
|
435
|
-
if (!kind
|
|
472
|
+
if (!kind && TABLE_TAGS.has(tag)) {
|
|
473
|
+
block(opening, "unmapped-element", `<${tag}> has no React Native port`, "react-native");
|
|
474
|
+
} else if (!kind) block(opening, "unmapped-element", `<${tag}> has no native mapping`);
|
|
436
475
|
} else if (opening.name.type === "JSXNamespacedName") {
|
|
437
476
|
block(opening, "unmapped-element", `<${tag}> has no native mapping`);
|
|
438
477
|
} else {
|
|
@@ -440,7 +479,7 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
440
479
|
const binding = imported.get(root);
|
|
441
480
|
if (binding) {
|
|
442
481
|
const member = tag.includes(".") ? binding.name === "*" ? tag.split(".")[1] : "" : binding.name;
|
|
443
|
-
kind = _optionalChain([MAPPED_COMPONENTS, 'access',
|
|
482
|
+
kind = _optionalChain([MAPPED_COMPONENTS, 'access', _24 => _24[binding.source], 'optionalAccess', _25 => _25[member]]);
|
|
444
483
|
if (!kind) {
|
|
445
484
|
const fromApp = /^(?:\.|\/|@\/|~|#)/.test(binding.source);
|
|
446
485
|
if (!fromApp) {
|
|
@@ -500,13 +539,22 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
500
539
|
}
|
|
501
540
|
if ((name === "action" || name === "formAction") && isIntrinsic) {
|
|
502
541
|
if (staticString(value) === void 0) {
|
|
503
|
-
|
|
542
|
+
const reference = serverActionReference(
|
|
543
|
+
_optionalChain([value, 'optionalAccess', _26 => _26.type]) === "JSXExpressionContainer" ? value.expression : void 0
|
|
544
|
+
);
|
|
545
|
+
if (reference) {
|
|
546
|
+
(_nullishCoalesce(facts.formActions, () => ( (facts.formActions = [])))).push({
|
|
547
|
+
...reference.source !== void 0 ? { source: reference.source } : {},
|
|
548
|
+
...locate(starts, attribute.start),
|
|
549
|
+
message: `${name} on <${tag}>`
|
|
550
|
+
});
|
|
551
|
+
} else block(attribute, "form-action", `${name} on <${tag}>`);
|
|
504
552
|
}
|
|
505
553
|
submits = true;
|
|
506
554
|
continue;
|
|
507
555
|
}
|
|
508
556
|
if (/^on[A-Z]/.test(name)) {
|
|
509
|
-
if (isIntrinsic && kind && !_optionalChain([MAPPED_EVENTS, 'access',
|
|
557
|
+
if (isIntrinsic && kind && !_optionalChain([MAPPED_EVENTS, 'access', _27 => _27[kind], 'optionalAccess', _28 => _28.has, 'call', _29 => _29(name)])) {
|
|
510
558
|
block(attribute, "dom-event", `${name} on <${tag}> has no native event`);
|
|
511
559
|
} else {
|
|
512
560
|
needsDevice(attribute, `${name} on <${tag}> runs on the device`);
|
|
@@ -527,14 +575,14 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
527
575
|
} else if (problem) block(attribute, "class-name", problem);
|
|
528
576
|
else {
|
|
529
577
|
style.push(token);
|
|
530
|
-
const native =
|
|
578
|
+
const native = _chunkCCAUIBIScjs.farmNativeClassProblem.call(void 0, token);
|
|
531
579
|
if (native) block(attribute, "class-name", native, "native");
|
|
532
580
|
}
|
|
533
581
|
}
|
|
534
582
|
continue;
|
|
535
583
|
}
|
|
536
584
|
if (name === "style") {
|
|
537
|
-
const expression = _optionalChain([value, 'optionalAccess',
|
|
585
|
+
const expression = _optionalChain([value, 'optionalAccess', _30 => _30.type]) === "JSXExpressionContainer" ? value.expression : null;
|
|
538
586
|
if (!expression || expression.type !== "ObjectExpression") {
|
|
539
587
|
block(attribute, "runtime-style", `<${tag}> style is not an object literal`);
|
|
540
588
|
continue;
|
|
@@ -545,11 +593,15 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
545
593
|
continue;
|
|
546
594
|
}
|
|
547
595
|
const key = _nullishCoalesce(property.key.name, () => ( property.key.value));
|
|
596
|
+
if (TABLE_STYLE_PROPERTIES.has(key)) {
|
|
597
|
+
block(property, "style", `style.${key} has no React Native port`, "react-native");
|
|
598
|
+
continue;
|
|
599
|
+
}
|
|
548
600
|
if (!STYLE_PROPERTIES.has(key)) {
|
|
549
601
|
block(property, "style", `style.${key} has no native mapping`);
|
|
550
602
|
continue;
|
|
551
603
|
}
|
|
552
|
-
if (!
|
|
604
|
+
if (!_chunkCCAUIBIScjs.FARM_NATIVE_STYLE_PROPERTIES.has(key)) {
|
|
553
605
|
block(property, "style", `style.${key} has no native-tier style`, "native");
|
|
554
606
|
}
|
|
555
607
|
const literal2 = staticString(property.value);
|
|
@@ -587,7 +639,7 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
587
639
|
}
|
|
588
640
|
const literal = value === null ? true : staticString(value);
|
|
589
641
|
if (literal !== void 0) props[name] = literal;
|
|
590
|
-
else if (_optionalChain([value, 'optionalAccess',
|
|
642
|
+
else if (_optionalChain([value, 'optionalAccess', _31 => _31.type]) === "JSXExpressionContainer" && value.expression.type === "Literal" && (typeof value.expression.value === "number" || typeof value.expression.value === "boolean")) {
|
|
591
643
|
props[name] = value.expression.value;
|
|
592
644
|
} else props[name] = "{expr}";
|
|
593
645
|
}
|
|
@@ -626,7 +678,7 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
626
678
|
return void 0;
|
|
627
679
|
case "JSXElement": {
|
|
628
680
|
const ui = classifyElement(node);
|
|
629
|
-
if (INLINE_BOX_TAGS.has(ui.tag) && parent && parent.kind !== "Fragment" && parent.kind !== "Component" && !_optionalChain([parent, 'access',
|
|
681
|
+
if (INLINE_BOX_TAGS.has(ui.tag) && parent && parent.kind !== "Fragment" && parent.kind !== "Component" && !_optionalChain([parent, 'access', _32 => _32.style, 'optionalAccess', _33 => _33.some, 'call', _34 => _34((token) => token === "flex" || token === "inline-flex")]) && hasBoxStyle(ui)) {
|
|
630
682
|
block(
|
|
631
683
|
node.openingElement,
|
|
632
684
|
"class-name",
|
|
@@ -720,7 +772,7 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
720
772
|
if (calleeName === "setInterval") wins.add("timer");
|
|
721
773
|
if (callee.type === "Identifier" && SERVER_FN_FACTORIES.has(callee.name)) {
|
|
722
774
|
const binding = imported.get(callee.name);
|
|
723
|
-
if (_optionalChain([binding, 'optionalAccess',
|
|
775
|
+
if (_optionalChain([binding, 'optionalAccess', _35 => _35.source, 'access', _36 => _36.startsWith, 'call', _37 => _37("@farm.js/core")])) callsServerFactory = true;
|
|
724
776
|
}
|
|
725
777
|
if (calleeName === "map" && callee.type === "MemberExpression" && parent) {
|
|
726
778
|
const before = facts.elements.total;
|
|
@@ -785,11 +837,11 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
785
837
|
const isDefault = statement.type === "ExportDefaultDeclaration";
|
|
786
838
|
const declaration = statement.type === "ExportNamedDeclaration" || isDefault ? statement.declaration : statement;
|
|
787
839
|
const roots = [];
|
|
788
|
-
if (_optionalChain([declaration, 'optionalAccess',
|
|
840
|
+
if (_optionalChain([declaration, 'optionalAccess', _38 => _38.type]) === "FunctionDeclaration" || isDefault && /Function/.test(_nullishCoalesce(_optionalChain([declaration, 'optionalAccess', _39 => _39.type]), () => ( "")))) {
|
|
789
841
|
roots.push([isDefault ? "default" : declaration.id.name, declaration]);
|
|
790
|
-
} else if (_optionalChain([declaration, 'optionalAccess',
|
|
842
|
+
} else if (_optionalChain([declaration, 'optionalAccess', _40 => _40.type]) === "VariableDeclaration") {
|
|
791
843
|
for (const declarator of declaration.declarations) {
|
|
792
|
-
if (declarator.id.type === "Identifier" && /Function/.test(_nullishCoalesce(_optionalChain([declarator, 'access',
|
|
844
|
+
if (declarator.id.type === "Identifier" && /Function/.test(_nullishCoalesce(_optionalChain([declarator, 'access', _41 => _41.init, 'optionalAccess', _42 => _42.type]), () => ( "")))) {
|
|
793
845
|
roots.push([declarator.id.name, declarator]);
|
|
794
846
|
}
|
|
795
847
|
}
|
|
@@ -805,7 +857,7 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
805
857
|
facts.components[name] = holder.children.length === 1 ? holder.children[0] : holder;
|
|
806
858
|
}
|
|
807
859
|
}
|
|
808
|
-
if (isDefault && _optionalChain([declaration, 'optionalAccess',
|
|
860
|
+
if (isDefault && _optionalChain([declaration, 'optionalAccess', _43 => _43.type]) === "Identifier") {
|
|
809
861
|
facts.components.default = { kind: "Component", tag: declaration.name };
|
|
810
862
|
}
|
|
811
863
|
}
|
|
@@ -883,7 +935,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
883
935
|
}
|
|
884
936
|
for (const match of text.matchAll(/\bimport\s+(?:[\w$]+\s*,\s*)?\{([^}]*)\}/g)) {
|
|
885
937
|
for (const part of match[1].split(",")) {
|
|
886
|
-
const local = _optionalChain([part, 'access',
|
|
938
|
+
const local = _optionalChain([part, 'access', _44 => _44.trim, 'call', _45 => _45(), 'access', _46 => _46.split, 'call', _47 => _47(/\s+as\s+/), 'access', _48 => _48.pop, 'call', _49 => _49(), 'optionalAccess', _50 => _50.trim, 'call', _51 => _51()]);
|
|
887
939
|
if (local) imported.add(local);
|
|
888
940
|
}
|
|
889
941
|
}
|
|
@@ -939,7 +991,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
939
991
|
cursor = closeBrace(markup, cursor);
|
|
940
992
|
continue;
|
|
941
993
|
}
|
|
942
|
-
const attrName = _nullishCoalesce(_optionalChain([/^[^\s=/>]+/, 'access',
|
|
994
|
+
const attrName = _nullishCoalesce(_optionalChain([/^[^\s=/>]+/, 'access', _52 => _52.exec, 'call', _53 => _53(markup.slice(cursor)), 'optionalAccess', _54 => _54[0]]), () => ( char));
|
|
943
995
|
const attrOffset = range.start + cursor;
|
|
944
996
|
cursor += attrName.length;
|
|
945
997
|
while (/\s/.test(_nullishCoalesce(markup[cursor], () => ( "")))) cursor += 1;
|
|
@@ -959,7 +1011,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
959
1011
|
braced = true;
|
|
960
1012
|
cursor = end;
|
|
961
1013
|
} else {
|
|
962
|
-
value2 = _nullishCoalesce(_optionalChain([/^[^\s>]+/, 'access',
|
|
1014
|
+
value2 = _nullishCoalesce(_optionalChain([/^[^\s>]+/, 'access', _55 => _55.exec, 'call', _56 => _56(markup.slice(cursor)), 'optionalAccess', _57 => _57[0]]), () => ( ""));
|
|
963
1015
|
cursor += value2.length;
|
|
964
1016
|
}
|
|
965
1017
|
}
|
|
@@ -1000,12 +1052,15 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
1000
1052
|
const kind = INTRINSIC_KINDS[tag];
|
|
1001
1053
|
if (!facts.tags.includes(tag)) facts.tags.push(tag);
|
|
1002
1054
|
facts.elements.total += 1;
|
|
1003
|
-
if (
|
|
1055
|
+
if (kind) {
|
|
1056
|
+
facts.elements.mapped += 1;
|
|
1057
|
+
facts.elements.byKind[kind] = (_nullishCoalesce(facts.elements.byKind[kind], () => ( 0))) + 1;
|
|
1058
|
+
} else if (TABLE_TAGS.has(tag)) {
|
|
1059
|
+
block(at, "unmapped-element", `<${tag}> has no React Native port`, "react-native");
|
|
1060
|
+
} else {
|
|
1004
1061
|
block(at, "unmapped-element", `<${tag}> has no native mapping`);
|
|
1005
1062
|
continue;
|
|
1006
1063
|
}
|
|
1007
|
-
facts.elements.mapped += 1;
|
|
1008
|
-
facts.elements.byKind[kind] = (_nullishCoalesce(facts.elements.byKind[kind], () => ( 0))) + 1;
|
|
1009
1064
|
const value = (attr) => attributes.find((attribute) => attribute.name.toLowerCase() === attr);
|
|
1010
1065
|
const boundAttribute = (attr) => attributes.find(
|
|
1011
1066
|
(attribute) => attribute.dynamic && (attribute.name === `:${attr}` || attribute.name === `v-bind:${attr}` || attribute.name === attr) || attr === "class" && attribute.name.startsWith("class:")
|
|
@@ -1013,14 +1068,14 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
1013
1068
|
const classes = value("class");
|
|
1014
1069
|
if (boundAttribute("class")) {
|
|
1015
1070
|
block(at, "runtime-class-name", `<${tag}> builds its class names at runtime`);
|
|
1016
|
-
} else if (_optionalChain([classes, 'optionalAccess',
|
|
1071
|
+
} else if (_optionalChain([classes, 'optionalAccess', _58 => _58.value])) {
|
|
1017
1072
|
for (const token of classes.value.split(/\s+/).filter(Boolean)) {
|
|
1018
1073
|
const problem = classifyClass(token);
|
|
1019
1074
|
if (problem && /^class ".*" is not in the native Tailwind subset$/.test(problem)) {
|
|
1020
1075
|
facts.appClasses.push({ name: token, ...locate(starts, classes.offset) });
|
|
1021
1076
|
} else if (problem) block(classes.offset, "class-name", problem);
|
|
1022
1077
|
else {
|
|
1023
|
-
const native =
|
|
1078
|
+
const native = _chunkCCAUIBIScjs.farmNativeClassProblem.call(void 0, token);
|
|
1024
1079
|
if (native) block(classes.offset, "class-name", native, "native");
|
|
1025
1080
|
}
|
|
1026
1081
|
}
|
|
@@ -1028,8 +1083,8 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
1028
1083
|
const style = value("style");
|
|
1029
1084
|
if (boundAttribute("style")) {
|
|
1030
1085
|
block(at, "runtime-style", `<${tag}> style is computed at runtime`);
|
|
1031
|
-
} else if (_optionalChain([style, 'optionalAccess',
|
|
1032
|
-
for (const declaration of
|
|
1086
|
+
} else if (_optionalChain([style, 'optionalAccess', _59 => _59.value])) {
|
|
1087
|
+
for (const declaration of _chunkCCAUIBIScjs.resolveFarmNativeInlineStyle.call(void 0, style.value).unsupported) {
|
|
1033
1088
|
block(
|
|
1034
1089
|
style.offset,
|
|
1035
1090
|
"style",
|
|
@@ -1040,7 +1095,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
1040
1095
|
}
|
|
1041
1096
|
const type = value("type");
|
|
1042
1097
|
if (tag === "input") {
|
|
1043
|
-
const inputType = _optionalChain([type, 'optionalAccess',
|
|
1098
|
+
const inputType = _optionalChain([type, 'optionalAccess', _60 => _60.dynamic]) ? void 0 : (_nullishCoalesce(_optionalChain([type, 'optionalAccess', _61 => _61.value]), () => ( "text"))).toLowerCase();
|
|
1044
1099
|
const formType = formDepth > 0 && (inputType === "hidden" || inputType === "submit");
|
|
1045
1100
|
if (!formType && (inputType === void 0 || !INPUT_TYPES.has(inputType))) {
|
|
1046
1101
|
block(
|
|
@@ -1052,7 +1107,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
1052
1107
|
}
|
|
1053
1108
|
if (inputType === "hidden") continue;
|
|
1054
1109
|
}
|
|
1055
|
-
const buttonType = tag === "button" ? (_nullishCoalesce(_optionalChain([type, 'optionalAccess',
|
|
1110
|
+
const buttonType = tag === "button" ? (_nullishCoalesce(_optionalChain([type, 'optionalAccess', _62 => _62.value]), () => ( "submit"))).toLowerCase() : void 0;
|
|
1056
1111
|
if ((tag === "button" || kind === "TextInput") && !value("action") && !value("formaction") && (formDepth === 0 || buttonType !== void 0 && buttonType !== "submit")) {
|
|
1057
1112
|
block(
|
|
1058
1113
|
at,
|
|
@@ -1063,9 +1118,9 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
1063
1118
|
}
|
|
1064
1119
|
if (tag === "form") {
|
|
1065
1120
|
const method = value("method");
|
|
1066
|
-
const methodValue = (_nullishCoalesce(_optionalChain([method, 'optionalAccess',
|
|
1067
|
-
if (_optionalChain([method, 'optionalAccess',
|
|
1068
|
-
block(at, "form-action", `<form method="${_nullishCoalesce(_optionalChain([method, 'optionalAccess',
|
|
1121
|
+
const methodValue = (_nullishCoalesce(_optionalChain([method, 'optionalAccess', _63 => _63.value]), () => ( "get"))).toLowerCase();
|
|
1122
|
+
if (_optionalChain([method, 'optionalAccess', _64 => _64.dynamic]) || methodValue !== "get" && methodValue !== "post") {
|
|
1123
|
+
block(at, "form-action", `<form method="${_nullishCoalesce(_optionalChain([method, 'optionalAccess', _65 => _65.value]), () => ( "{expr}"))}">`, "native");
|
|
1069
1124
|
}
|
|
1070
1125
|
}
|
|
1071
1126
|
}
|
|
@@ -1144,7 +1199,7 @@ function classifyPackage(fact, serverBoundary) {
|
|
|
1144
1199
|
}
|
|
1145
1200
|
if (specifier.startsWith("@farm.js/core")) {
|
|
1146
1201
|
const portable = CORE_PORTABLE[specifier];
|
|
1147
|
-
const unmapped = fact.names.filter((name2) => !_optionalChain([portable, 'optionalAccess',
|
|
1202
|
+
const unmapped = fact.names.filter((name2) => !_optionalChain([portable, 'optionalAccess', _66 => _66.has, 'call', _67 => _67(name2)]));
|
|
1148
1203
|
if (unmapped.length > 0 || !portable) {
|
|
1149
1204
|
return {
|
|
1150
1205
|
...at,
|
|
@@ -1346,7 +1401,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1346
1401
|
const readStylesheet = (file) => {
|
|
1347
1402
|
let sheet = parsedSheets.get(file);
|
|
1348
1403
|
if (!sheet) {
|
|
1349
|
-
sheet =
|
|
1404
|
+
sheet = _chunkCCAUIBIScjs.parseFarmNativeStylesheet.call(void 0, _fs.readFileSync.call(void 0, file, "utf8"));
|
|
1350
1405
|
parsedSheets.set(file, sheet);
|
|
1351
1406
|
}
|
|
1352
1407
|
return sheet;
|
|
@@ -1358,7 +1413,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1358
1413
|
const allStylesheets = /* @__PURE__ */ new Set();
|
|
1359
1414
|
const unreadStylesheets = /* @__PURE__ */ new Set();
|
|
1360
1415
|
for (const [route, { page, layouts }] of entries) {
|
|
1361
|
-
if (!page && _optionalChain([options, 'access',
|
|
1416
|
+
if (!page && _optionalChain([options, 'access', _68 => _68.nativeOnlyRoutes, 'optionalAccess', _69 => _69.has, 'call', _70 => _70(route)])) continue;
|
|
1362
1417
|
const blockers = [];
|
|
1363
1418
|
const wins = /* @__PURE__ */ new Set();
|
|
1364
1419
|
const elements = { total: 0, mapped: 0, byKind: {} };
|
|
@@ -1420,12 +1475,25 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1420
1475
|
}
|
|
1421
1476
|
if (moduleFacts.serverBoundary && !entry) return;
|
|
1422
1477
|
for (const blocker of moduleFacts.blockers) add({ file: label, ...blocker });
|
|
1478
|
+
for (const action of _nullishCoalesce(moduleFacts.formActions, () => ( []))) {
|
|
1479
|
+
const target = action.source === void 0 ? void 0 : _optionalChain([(_nullishCoalesce(resolved.get(file), () => ( []))), 'access', _71 => _71.find, 'call', _72 => _72((entry2) => entry2.fact.source === action.source), 'optionalAccess', _73 => _73.file]);
|
|
1480
|
+
const server = options.serverComponents === true && (action.source === void 0 || target !== void 0 && _optionalChain([settled, 'access', _74 => _74.get, 'call', _75 => _75(target), 'optionalAccess', _76 => _76.serverBoundary]) === true);
|
|
1481
|
+
if (!server) {
|
|
1482
|
+
add({
|
|
1483
|
+
file: label,
|
|
1484
|
+
line: action.line,
|
|
1485
|
+
column: action.column,
|
|
1486
|
+
rule: "form-action",
|
|
1487
|
+
message: action.message
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1423
1491
|
if (!layout) {
|
|
1424
1492
|
for (const appClass of moduleFacts.appClasses)
|
|
1425
1493
|
appClasses.push({ file: label, ...appClass });
|
|
1426
1494
|
for (const tag of moduleFacts.tags) tags.add(tag);
|
|
1427
1495
|
for (const css of _nullishCoalesce(moduleFacts.styles, () => ( []))) {
|
|
1428
|
-
componentSheets.push(
|
|
1496
|
+
componentSheets.push(_chunkCCAUIBIScjs.parseFarmNativeStylesheet.call(void 0, css));
|
|
1429
1497
|
}
|
|
1430
1498
|
}
|
|
1431
1499
|
for (const win of moduleFacts.wins) wins.add(win);
|
|
@@ -1441,7 +1509,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1441
1509
|
if (entryImport.stylesheet) {
|
|
1442
1510
|
stylesheets.add(entryImport.stylesheet);
|
|
1443
1511
|
allStylesheets.add(entryImport.stylesheet);
|
|
1444
|
-
} else if (_optionalChain([entryImport, 'access',
|
|
1512
|
+
} else if (_optionalChain([entryImport, 'access', _77 => _77.blocker, 'optionalAccess', _78 => _78.rule]) === "css-import") {
|
|
1445
1513
|
unreadStylesheets.add(entryImport.fact.source);
|
|
1446
1514
|
}
|
|
1447
1515
|
if (entryImport.blocker) add({ file: label, ...entryImport.blocker });
|
|
@@ -1471,7 +1539,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1471
1539
|
for (const layout of layouts) walk(layout, true, true);
|
|
1472
1540
|
const sheets = [...[...stylesheets].map(readStylesheet), ...componentSheets];
|
|
1473
1541
|
for (const appClass of appClasses) {
|
|
1474
|
-
const { styled, problems } =
|
|
1542
|
+
const { styled, problems } = _chunkCCAUIBIScjs.inspectFarmNativeStylesheets.call(void 0, sheets, { class: appClass.name });
|
|
1475
1543
|
const at = { file: appClass.file, line: appClass.line, column: appClass.column };
|
|
1476
1544
|
if (!styled) {
|
|
1477
1545
|
blockers.push({
|
|
@@ -1486,7 +1554,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1486
1554
|
}
|
|
1487
1555
|
}
|
|
1488
1556
|
for (const tag of tags) {
|
|
1489
|
-
for (const message of
|
|
1557
|
+
for (const message of _chunkCCAUIBIScjs.inspectFarmNativeStylesheets.call(void 0, sheets, { tag }).problems) {
|
|
1490
1558
|
blockers.push({
|
|
1491
1559
|
file: relative2(root, _nullishCoalesce(page, () => ( ""))),
|
|
1492
1560
|
line: 1,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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 _chunk752IHQTDcjs = require('./chunk-752IHQTD.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunk2C5L5RPMcjs = require('./chunk-2C5L5RPM.cjs');
|
|
@@ -273,7 +273,7 @@ function requestEvent(metadata, method, status, durationMs) {
|
|
|
273
273
|
id: uuid(),
|
|
274
274
|
requestId: metadata.id,
|
|
275
275
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
276
|
-
route: routeTemplate(
|
|
276
|
+
route: routeTemplate(_chunk752IHQTDcjs.getFarmRouteLabel.call(void 0, metadata.route)),
|
|
277
277
|
agent: metadata.agent,
|
|
278
278
|
kind: "request",
|
|
279
279
|
method,
|
|
@@ -286,7 +286,7 @@ function toolEvent(metadata, event) {
|
|
|
286
286
|
id: uuid(),
|
|
287
287
|
requestId: metadata.id,
|
|
288
288
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
289
|
-
route: routeTemplate(
|
|
289
|
+
route: routeTemplate(_chunk752IHQTDcjs.getFarmRouteLabel.call(void 0, metadata.route)),
|
|
290
290
|
agent: metadata.agent,
|
|
291
291
|
kind: "mcp.tool",
|
|
292
292
|
tool: event.tool,
|