@farm.js/core 0.1.64 → 0.1.65
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-GHWK46LX.cjs +16 -0
- package/dist/{analyzer-Q3QXC6PD.mjs → analyzer-PE33SK5W.mjs} +2 -2
- package/dist/{chunk-O4FWNLQK.mjs → chunk-2L54YV25.mjs} +10 -8
- package/dist/{chunk-S25BQIFW.cjs → chunk-32RPJAAS.cjs} +2 -2
- package/dist/{chunk-FAP7CX7C.cjs → chunk-3KJPIO5D.cjs} +526 -3018
- package/dist/{chunk-OYF23QLG.mjs → chunk-6X5NKNBE.mjs} +36 -32
- package/dist/{chunk-LQDLEWPO.mjs → chunk-72JSHQQQ.mjs} +1 -1
- package/dist/{chunk-WNYRYI4D.mjs → chunk-7GYCZRTH.mjs} +379 -2871
- package/dist/chunk-7QVRWGBL.cjs +3704 -0
- package/dist/{chunk-O2XFIPNL.cjs → chunk-A3G5IY2W.cjs} +1 -1
- package/dist/{chunk-NXFA7G3Y.cjs → chunk-C7DCMGC4.cjs} +4 -4
- package/dist/chunk-CJNAUEVC.mjs +34 -0
- package/dist/{chunk-O7IEMY55.cjs → chunk-CZF4XIRZ.cjs} +3 -3
- package/dist/{chunk-SLYDIHLW.mjs → chunk-E2TSYUHV.mjs} +2 -2
- package/dist/{chunk-VVTJTMGQ.cjs → chunk-GL7N5UHF.cjs} +4 -4
- package/dist/{chunk-6NHSGVVA.mjs → chunk-GRBJ7VKH.mjs} +1 -1
- package/dist/{chunk-UR25Z5Z6.mjs → chunk-HCGWDRZO.mjs} +1 -1
- package/dist/{chunk-FH45OB37.mjs → chunk-HKNYNSOK.mjs} +1 -1
- package/dist/{chunk-DUSHDZQL.cjs → chunk-IMK32ERL.cjs} +15 -13
- package/dist/{chunk-XVWSDSUM.mjs → chunk-IP2KHSGF.mjs} +4 -2
- package/dist/{chunk-MG356ROI.cjs → chunk-OSFIUSYK.cjs} +3 -3
- package/dist/{chunk-SNFTMSHX.mjs → chunk-Q75QPLBA.mjs} +1 -1
- package/dist/{chunk-WFNAOWH4.mjs → chunk-QHRCR44V.mjs} +2 -2
- package/dist/{chunk-JCPSA4X5.cjs → chunk-T4M52BA5.cjs} +116 -112
- package/dist/{chunk-PAKCHVUS.mjs → chunk-TPA2PV5J.mjs} +3 -35
- package/dist/{chunk-N3Z3PLHC.cjs → chunk-TRIDJQ6A.cjs} +6 -6
- package/dist/{chunk-3EBHJET2.cjs → chunk-TZOGZKI7.cjs} +380 -269
- package/dist/{chunk-BPNOYILC.cjs → chunk-UVV3I5QA.cjs} +3 -35
- package/dist/{chunk-RAH5MT53.mjs → chunk-VHHLKIDZ.mjs} +153 -42
- package/dist/{chunk-S7ZW72JH.cjs → chunk-WNXVWXG3.cjs} +2 -2
- package/dist/{chunk-XZLZ6YPP.cjs → chunk-YD4J37RN.cjs} +90 -33
- package/dist/{chunk-NNLFW3P4.mjs → chunk-YUW7F6SK.mjs} +1 -1
- package/dist/chunk-ZAUOOGER.mjs +3704 -0
- package/dist/chunk-ZIHWAN55.cjs +34 -0
- package/dist/{chunk-EL4364S2.cjs → chunk-ZQQK4U66.cjs} +4 -2
- package/dist/{chunk-6NNYPY5W.mjs → chunk-ZX2JHEWW.mjs} +59 -2
- package/dist/{devtools-MX3FE733.mjs → devtools-PUVZB3F2.mjs} +4 -3
- package/dist/{devtools-WET5NAKO.cjs → devtools-SGYOG36E.cjs} +5 -4
- 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 +20 -19
- package/dist/index.mjs +19 -18
- package/dist/internal/build-runtime.cjs +18 -17
- package/dist/internal/build-runtime.mjs +17 -16
- 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 +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +5 -5
- package/dist/internal/production-runtime.d.mts +7 -0
- package/dist/internal/production-runtime.d.ts +7 -0
- package/dist/internal/production-runtime.mjs +4 -4
- package/dist/{native-tree-WOX3JMBG.cjs → native-tree-HE2FLS72.cjs} +2 -2
- package/dist/{native-tree-BPEE2LAL.mjs → native-tree-YF2DSPKM.mjs} +1 -1
- package/dist/plugin.cjs +11 -10
- package/dist/plugin.mjs +10 -9
- package/dist/{rsc-pipeline-3LNVP2OO.mjs → rsc-pipeline-T3PWURLJ.mjs} +6 -5
- package/dist/{rsc-pipeline-G5WELVW3.cjs → rsc-pipeline-V4ANLRAA.cjs} +7 -6
- package/dist/{runtime-DMEULPE7.cjs → runtime-5AROV2C3.cjs} +12 -11
- package/dist/{runtime-HQJ2LLQL.mjs → runtime-LRIQ3XH7.mjs} +9 -8
- 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
|
@@ -15,14 +15,14 @@ var _chunkWBTHHTBOcjs = require('./chunk-WBTHHTBO.cjs');
|
|
|
15
15
|
var _chunkV727H3RIcjs = require('./chunk-V727H3RI.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkA3G5IY2Wcjs = require('./chunk-A3G5IY2W.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 = `6:${
|
|
25
|
+
var ANALYZER_VERSION = `6:${_chunkA3G5IY2Wcjs.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";
|
|
@@ -345,15 +345,50 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
345
345
|
};
|
|
346
346
|
const needsDevice = (node, message) => block(node, "client-logic", message, "native");
|
|
347
347
|
let formDepth = 0;
|
|
348
|
+
const serverFunctions = /* @__PURE__ */ new Set();
|
|
349
|
+
const serverActionReference = (expression) => {
|
|
350
|
+
if (_optionalChain([expression, 'optionalAccess', _2 => _2.type]) === "Identifier") {
|
|
351
|
+
if (serverFunctions.has(expression.name)) return {};
|
|
352
|
+
const binding = imported.get(expression.name);
|
|
353
|
+
return binding ? { source: binding.source } : void 0;
|
|
354
|
+
}
|
|
355
|
+
if (_optionalChain([expression, 'optionalAccess', _3 => _3.type]) === "MemberExpression" && expression.object.type === "Identifier") {
|
|
356
|
+
const binding = imported.get(expression.object.name);
|
|
357
|
+
return _optionalChain([binding, 'optionalAccess', _4 => _4.name]) === "*" ? { source: binding.source } : void 0;
|
|
358
|
+
}
|
|
359
|
+
return void 0;
|
|
360
|
+
};
|
|
348
361
|
const result = parseSync(file, source, { lang });
|
|
349
362
|
if (result.errors.length > 0) {
|
|
350
363
|
const error = result.errors[0];
|
|
351
|
-
const offset = _nullishCoalesce(_optionalChain([error, 'access',
|
|
364
|
+
const offset = _nullishCoalesce(_optionalChain([error, 'access', _5 => _5.labels, 'optionalAccess', _6 => _6[0], 'optionalAccess', _7 => _7.start]), () => ( 0));
|
|
352
365
|
facts.blockers.push({ ...locate(starts, offset), rule: "parse-error", message: error.message });
|
|
353
366
|
return facts;
|
|
354
367
|
}
|
|
355
368
|
const program = result.program;
|
|
356
369
|
const wins = /* @__PURE__ */ new Set();
|
|
370
|
+
const usesServer = (body) => _optionalChain([body, 'optionalAccess', _8 => _8.type]) === "BlockStatement" && body.body.some(
|
|
371
|
+
(statement) => statement.type === "ExpressionStatement" && statement.directive === "use server"
|
|
372
|
+
);
|
|
373
|
+
const findServerFunctions = (node) => {
|
|
374
|
+
if (!node || typeof node !== "object") return;
|
|
375
|
+
if (Array.isArray(node)) {
|
|
376
|
+
for (const child of node) findServerFunctions(child);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
const current = node;
|
|
380
|
+
if (current.type === "FunctionDeclaration" && current.id && usesServer(current.body)) {
|
|
381
|
+
serverFunctions.add(current.id.name);
|
|
382
|
+
} 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)) {
|
|
383
|
+
serverFunctions.add(current.id.name);
|
|
384
|
+
}
|
|
385
|
+
for (const [key, value] of Object.entries(current)) {
|
|
386
|
+
if (key !== "type" && key !== "start" && key !== "end" && value && typeof value === "object") {
|
|
387
|
+
findServerFunctions(value);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
findServerFunctions(program);
|
|
357
392
|
const imported = /* @__PURE__ */ new Map();
|
|
358
393
|
const topLevel = /* @__PURE__ */ new Set();
|
|
359
394
|
const declared = /* @__PURE__ */ new Set();
|
|
@@ -393,10 +428,10 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
393
428
|
}
|
|
394
429
|
const declaration = statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration" ? statement.declaration : statement;
|
|
395
430
|
if (!declaration) continue;
|
|
396
|
-
if (_optionalChain([declaration, 'access',
|
|
431
|
+
if (_optionalChain([declaration, 'access', _15 => _15.id, 'optionalAccess', _16 => _16.name]) && /Function|Class/.test(declaration.type)) {
|
|
397
432
|
topLevel.add(declaration.id.name);
|
|
398
433
|
}
|
|
399
|
-
if (_optionalChain([declaration, 'access',
|
|
434
|
+
if (_optionalChain([declaration, 'access', _17 => _17.id, 'optionalAccess', _18 => _18.name]) && declaration.async) asyncFunctions.add(declaration.id.name);
|
|
400
435
|
if (statement.type === "ExportDefaultDeclaration" && declaration.type === "Identifier") {
|
|
401
436
|
defaultName = declaration.name;
|
|
402
437
|
}
|
|
@@ -404,10 +439,10 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
404
439
|
for (const declarator of declaration.declarations) {
|
|
405
440
|
if (declarator.id.type !== "Identifier") continue;
|
|
406
441
|
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',
|
|
442
|
+
if (_optionalChain([init, 'optionalAccess', _19 => _19.async])) asyncFunctions.add(declarator.id.name);
|
|
443
|
+
const callee = _optionalChain([init, 'optionalAccess', _20 => _20.type]) === "CallExpression" ? init.callee : void 0;
|
|
444
|
+
const calleeName = _optionalChain([callee, 'optionalAccess', _21 => _21.type]) === "MemberExpression" ? callee.property.name : _optionalChain([callee, 'optionalAccess', _22 => _22.name]);
|
|
445
|
+
if (/Function/.test(_nullishCoalesce(_optionalChain([init, 'optionalAccess', _23 => _23.type]), () => ( ""))) || calleeName && /^(?:memo|forwardRef|lazy)$/.test(calleeName)) {
|
|
411
446
|
topLevel.add(declarator.id.name);
|
|
412
447
|
}
|
|
413
448
|
}
|
|
@@ -440,7 +475,7 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
440
475
|
const binding = imported.get(root);
|
|
441
476
|
if (binding) {
|
|
442
477
|
const member = tag.includes(".") ? binding.name === "*" ? tag.split(".")[1] : "" : binding.name;
|
|
443
|
-
kind = _optionalChain([MAPPED_COMPONENTS, 'access',
|
|
478
|
+
kind = _optionalChain([MAPPED_COMPONENTS, 'access', _24 => _24[binding.source], 'optionalAccess', _25 => _25[member]]);
|
|
444
479
|
if (!kind) {
|
|
445
480
|
const fromApp = /^(?:\.|\/|@\/|~|#)/.test(binding.source);
|
|
446
481
|
if (!fromApp) {
|
|
@@ -500,13 +535,22 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
500
535
|
}
|
|
501
536
|
if ((name === "action" || name === "formAction") && isIntrinsic) {
|
|
502
537
|
if (staticString(value) === void 0) {
|
|
503
|
-
|
|
538
|
+
const reference = serverActionReference(
|
|
539
|
+
_optionalChain([value, 'optionalAccess', _26 => _26.type]) === "JSXExpressionContainer" ? value.expression : void 0
|
|
540
|
+
);
|
|
541
|
+
if (reference) {
|
|
542
|
+
(_nullishCoalesce(facts.formActions, () => ( (facts.formActions = [])))).push({
|
|
543
|
+
...reference.source !== void 0 ? { source: reference.source } : {},
|
|
544
|
+
...locate(starts, attribute.start),
|
|
545
|
+
message: `${name} on <${tag}>`
|
|
546
|
+
});
|
|
547
|
+
} else block(attribute, "form-action", `${name} on <${tag}>`);
|
|
504
548
|
}
|
|
505
549
|
submits = true;
|
|
506
550
|
continue;
|
|
507
551
|
}
|
|
508
552
|
if (/^on[A-Z]/.test(name)) {
|
|
509
|
-
if (isIntrinsic && kind && !_optionalChain([MAPPED_EVENTS, 'access',
|
|
553
|
+
if (isIntrinsic && kind && !_optionalChain([MAPPED_EVENTS, 'access', _27 => _27[kind], 'optionalAccess', _28 => _28.has, 'call', _29 => _29(name)])) {
|
|
510
554
|
block(attribute, "dom-event", `${name} on <${tag}> has no native event`);
|
|
511
555
|
} else {
|
|
512
556
|
needsDevice(attribute, `${name} on <${tag}> runs on the device`);
|
|
@@ -534,7 +578,7 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
534
578
|
continue;
|
|
535
579
|
}
|
|
536
580
|
if (name === "style") {
|
|
537
|
-
const expression = _optionalChain([value, 'optionalAccess',
|
|
581
|
+
const expression = _optionalChain([value, 'optionalAccess', _30 => _30.type]) === "JSXExpressionContainer" ? value.expression : null;
|
|
538
582
|
if (!expression || expression.type !== "ObjectExpression") {
|
|
539
583
|
block(attribute, "runtime-style", `<${tag}> style is not an object literal`);
|
|
540
584
|
continue;
|
|
@@ -587,7 +631,7 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
587
631
|
}
|
|
588
632
|
const literal = value === null ? true : staticString(value);
|
|
589
633
|
if (literal !== void 0) props[name] = literal;
|
|
590
|
-
else if (_optionalChain([value, 'optionalAccess',
|
|
634
|
+
else if (_optionalChain([value, 'optionalAccess', _31 => _31.type]) === "JSXExpressionContainer" && value.expression.type === "Literal" && (typeof value.expression.value === "number" || typeof value.expression.value === "boolean")) {
|
|
591
635
|
props[name] = value.expression.value;
|
|
592
636
|
} else props[name] = "{expr}";
|
|
593
637
|
}
|
|
@@ -626,7 +670,7 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
626
670
|
return void 0;
|
|
627
671
|
case "JSXElement": {
|
|
628
672
|
const ui = classifyElement(node);
|
|
629
|
-
if (INLINE_BOX_TAGS.has(ui.tag) && parent && parent.kind !== "Fragment" && parent.kind !== "Component" && !_optionalChain([parent, 'access',
|
|
673
|
+
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
674
|
block(
|
|
631
675
|
node.openingElement,
|
|
632
676
|
"class-name",
|
|
@@ -720,7 +764,7 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
720
764
|
if (calleeName === "setInterval") wins.add("timer");
|
|
721
765
|
if (callee.type === "Identifier" && SERVER_FN_FACTORIES.has(callee.name)) {
|
|
722
766
|
const binding = imported.get(callee.name);
|
|
723
|
-
if (_optionalChain([binding, 'optionalAccess',
|
|
767
|
+
if (_optionalChain([binding, 'optionalAccess', _35 => _35.source, 'access', _36 => _36.startsWith, 'call', _37 => _37("@farm.js/core")])) callsServerFactory = true;
|
|
724
768
|
}
|
|
725
769
|
if (calleeName === "map" && callee.type === "MemberExpression" && parent) {
|
|
726
770
|
const before = facts.elements.total;
|
|
@@ -785,11 +829,11 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
785
829
|
const isDefault = statement.type === "ExportDefaultDeclaration";
|
|
786
830
|
const declaration = statement.type === "ExportNamedDeclaration" || isDefault ? statement.declaration : statement;
|
|
787
831
|
const roots = [];
|
|
788
|
-
if (_optionalChain([declaration, 'optionalAccess',
|
|
832
|
+
if (_optionalChain([declaration, 'optionalAccess', _38 => _38.type]) === "FunctionDeclaration" || isDefault && /Function/.test(_nullishCoalesce(_optionalChain([declaration, 'optionalAccess', _39 => _39.type]), () => ( "")))) {
|
|
789
833
|
roots.push([isDefault ? "default" : declaration.id.name, declaration]);
|
|
790
|
-
} else if (_optionalChain([declaration, 'optionalAccess',
|
|
834
|
+
} else if (_optionalChain([declaration, 'optionalAccess', _40 => _40.type]) === "VariableDeclaration") {
|
|
791
835
|
for (const declarator of declaration.declarations) {
|
|
792
|
-
if (declarator.id.type === "Identifier" && /Function/.test(_nullishCoalesce(_optionalChain([declarator, 'access',
|
|
836
|
+
if (declarator.id.type === "Identifier" && /Function/.test(_nullishCoalesce(_optionalChain([declarator, 'access', _41 => _41.init, 'optionalAccess', _42 => _42.type]), () => ( "")))) {
|
|
793
837
|
roots.push([declarator.id.name, declarator]);
|
|
794
838
|
}
|
|
795
839
|
}
|
|
@@ -805,7 +849,7 @@ function analyzeSource(file, source, parseSync, lang = scriptLang(file)) {
|
|
|
805
849
|
facts.components[name] = holder.children.length === 1 ? holder.children[0] : holder;
|
|
806
850
|
}
|
|
807
851
|
}
|
|
808
|
-
if (isDefault && _optionalChain([declaration, 'optionalAccess',
|
|
852
|
+
if (isDefault && _optionalChain([declaration, 'optionalAccess', _43 => _43.type]) === "Identifier") {
|
|
809
853
|
facts.components.default = { kind: "Component", tag: declaration.name };
|
|
810
854
|
}
|
|
811
855
|
}
|
|
@@ -883,7 +927,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
883
927
|
}
|
|
884
928
|
for (const match of text.matchAll(/\bimport\s+(?:[\w$]+\s*,\s*)?\{([^}]*)\}/g)) {
|
|
885
929
|
for (const part of match[1].split(",")) {
|
|
886
|
-
const local = _optionalChain([part, 'access',
|
|
930
|
+
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
931
|
if (local) imported.add(local);
|
|
888
932
|
}
|
|
889
933
|
}
|
|
@@ -939,7 +983,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
939
983
|
cursor = closeBrace(markup, cursor);
|
|
940
984
|
continue;
|
|
941
985
|
}
|
|
942
|
-
const attrName = _nullishCoalesce(_optionalChain([/^[^\s=/>]+/, 'access',
|
|
986
|
+
const attrName = _nullishCoalesce(_optionalChain([/^[^\s=/>]+/, 'access', _52 => _52.exec, 'call', _53 => _53(markup.slice(cursor)), 'optionalAccess', _54 => _54[0]]), () => ( char));
|
|
943
987
|
const attrOffset = range.start + cursor;
|
|
944
988
|
cursor += attrName.length;
|
|
945
989
|
while (/\s/.test(_nullishCoalesce(markup[cursor], () => ( "")))) cursor += 1;
|
|
@@ -959,7 +1003,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
959
1003
|
braced = true;
|
|
960
1004
|
cursor = end;
|
|
961
1005
|
} else {
|
|
962
|
-
value2 = _nullishCoalesce(_optionalChain([/^[^\s>]+/, 'access',
|
|
1006
|
+
value2 = _nullishCoalesce(_optionalChain([/^[^\s>]+/, 'access', _55 => _55.exec, 'call', _56 => _56(markup.slice(cursor)), 'optionalAccess', _57 => _57[0]]), () => ( ""));
|
|
963
1007
|
cursor += value2.length;
|
|
964
1008
|
}
|
|
965
1009
|
}
|
|
@@ -1013,7 +1057,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
1013
1057
|
const classes = value("class");
|
|
1014
1058
|
if (boundAttribute("class")) {
|
|
1015
1059
|
block(at, "runtime-class-name", `<${tag}> builds its class names at runtime`);
|
|
1016
|
-
} else if (_optionalChain([classes, 'optionalAccess',
|
|
1060
|
+
} else if (_optionalChain([classes, 'optionalAccess', _58 => _58.value])) {
|
|
1017
1061
|
for (const token of classes.value.split(/\s+/).filter(Boolean)) {
|
|
1018
1062
|
const problem = classifyClass(token);
|
|
1019
1063
|
if (problem && /^class ".*" is not in the native Tailwind subset$/.test(problem)) {
|
|
@@ -1028,7 +1072,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
1028
1072
|
const style = value("style");
|
|
1029
1073
|
if (boundAttribute("style")) {
|
|
1030
1074
|
block(at, "runtime-style", `<${tag}> style is computed at runtime`);
|
|
1031
|
-
} else if (_optionalChain([style, 'optionalAccess',
|
|
1075
|
+
} else if (_optionalChain([style, 'optionalAccess', _59 => _59.value])) {
|
|
1032
1076
|
for (const declaration of _chunkV727H3RIcjs.resolveFarmNativeInlineStyle.call(void 0, style.value).unsupported) {
|
|
1033
1077
|
block(
|
|
1034
1078
|
style.offset,
|
|
@@ -1040,7 +1084,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
1040
1084
|
}
|
|
1041
1085
|
const type = value("type");
|
|
1042
1086
|
if (tag === "input") {
|
|
1043
|
-
const inputType = _optionalChain([type, 'optionalAccess',
|
|
1087
|
+
const inputType = _optionalChain([type, 'optionalAccess', _60 => _60.dynamic]) ? void 0 : (_nullishCoalesce(_optionalChain([type, 'optionalAccess', _61 => _61.value]), () => ( "text"))).toLowerCase();
|
|
1044
1088
|
const formType = formDepth > 0 && (inputType === "hidden" || inputType === "submit");
|
|
1045
1089
|
if (!formType && (inputType === void 0 || !INPUT_TYPES.has(inputType))) {
|
|
1046
1090
|
block(
|
|
@@ -1052,7 +1096,7 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
1052
1096
|
}
|
|
1053
1097
|
if (inputType === "hidden") continue;
|
|
1054
1098
|
}
|
|
1055
|
-
const buttonType = tag === "button" ? (_nullishCoalesce(_optionalChain([type, 'optionalAccess',
|
|
1099
|
+
const buttonType = tag === "button" ? (_nullishCoalesce(_optionalChain([type, 'optionalAccess', _62 => _62.value]), () => ( "submit"))).toLowerCase() : void 0;
|
|
1056
1100
|
if ((tag === "button" || kind === "TextInput") && !value("action") && !value("formaction") && (formDepth === 0 || buttonType !== void 0 && buttonType !== "submit")) {
|
|
1057
1101
|
block(
|
|
1058
1102
|
at,
|
|
@@ -1063,9 +1107,9 @@ function analyzeComponentSource(file, source, parseSync) {
|
|
|
1063
1107
|
}
|
|
1064
1108
|
if (tag === "form") {
|
|
1065
1109
|
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',
|
|
1110
|
+
const methodValue = (_nullishCoalesce(_optionalChain([method, 'optionalAccess', _63 => _63.value]), () => ( "get"))).toLowerCase();
|
|
1111
|
+
if (_optionalChain([method, 'optionalAccess', _64 => _64.dynamic]) || methodValue !== "get" && methodValue !== "post") {
|
|
1112
|
+
block(at, "form-action", `<form method="${_nullishCoalesce(_optionalChain([method, 'optionalAccess', _65 => _65.value]), () => ( "{expr}"))}">`, "native");
|
|
1069
1113
|
}
|
|
1070
1114
|
}
|
|
1071
1115
|
}
|
|
@@ -1144,7 +1188,7 @@ function classifyPackage(fact, serverBoundary) {
|
|
|
1144
1188
|
}
|
|
1145
1189
|
if (specifier.startsWith("@farm.js/core")) {
|
|
1146
1190
|
const portable = CORE_PORTABLE[specifier];
|
|
1147
|
-
const unmapped = fact.names.filter((name2) => !_optionalChain([portable, 'optionalAccess',
|
|
1191
|
+
const unmapped = fact.names.filter((name2) => !_optionalChain([portable, 'optionalAccess', _66 => _66.has, 'call', _67 => _67(name2)]));
|
|
1148
1192
|
if (unmapped.length > 0 || !portable) {
|
|
1149
1193
|
return {
|
|
1150
1194
|
...at,
|
|
@@ -1358,7 +1402,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1358
1402
|
const allStylesheets = /* @__PURE__ */ new Set();
|
|
1359
1403
|
const unreadStylesheets = /* @__PURE__ */ new Set();
|
|
1360
1404
|
for (const [route, { page, layouts }] of entries) {
|
|
1361
|
-
if (!page && _optionalChain([options, 'access',
|
|
1405
|
+
if (!page && _optionalChain([options, 'access', _68 => _68.nativeOnlyRoutes, 'optionalAccess', _69 => _69.has, 'call', _70 => _70(route)])) continue;
|
|
1362
1406
|
const blockers = [];
|
|
1363
1407
|
const wins = /* @__PURE__ */ new Set();
|
|
1364
1408
|
const elements = { total: 0, mapped: 0, byKind: {} };
|
|
@@ -1420,6 +1464,19 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1420
1464
|
}
|
|
1421
1465
|
if (moduleFacts.serverBoundary && !entry) return;
|
|
1422
1466
|
for (const blocker of moduleFacts.blockers) add({ file: label, ...blocker });
|
|
1467
|
+
for (const action of _nullishCoalesce(moduleFacts.formActions, () => ( []))) {
|
|
1468
|
+
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]);
|
|
1469
|
+
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);
|
|
1470
|
+
if (!server) {
|
|
1471
|
+
add({
|
|
1472
|
+
file: label,
|
|
1473
|
+
line: action.line,
|
|
1474
|
+
column: action.column,
|
|
1475
|
+
rule: "form-action",
|
|
1476
|
+
message: action.message
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1423
1480
|
if (!layout) {
|
|
1424
1481
|
for (const appClass of moduleFacts.appClasses)
|
|
1425
1482
|
appClasses.push({ file: label, ...appClass });
|
|
@@ -1441,7 +1498,7 @@ async function analyzeFarmMobileRoutes(options) {
|
|
|
1441
1498
|
if (entryImport.stylesheet) {
|
|
1442
1499
|
stylesheets.add(entryImport.stylesheet);
|
|
1443
1500
|
allStylesheets.add(entryImport.stylesheet);
|
|
1444
|
-
} else if (_optionalChain([entryImport, 'access',
|
|
1501
|
+
} else if (_optionalChain([entryImport, 'access', _77 => _77.blocker, 'optionalAccess', _78 => _78.rule]) === "css-import") {
|
|
1445
1502
|
unreadStylesheets.add(entryImport.fact.source);
|
|
1446
1503
|
}
|
|
1447
1504
|
if (entryImport.blocker) add({ file: label, ...entryImport.blocker });
|