@tamagui/static 1.13.3 → 1.13.4
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/cjs/constants.js +1 -52
- package/dist/cjs/constants.js.map +2 -2
- package/dist/cjs/extractor/accessSafe.js +1 -52
- package/dist/cjs/extractor/accessSafe.js.map +2 -2
- package/dist/cjs/extractor/babelParse.js +1 -66
- package/dist/cjs/extractor/babelParse.js.map +2 -2
- package/dist/cjs/extractor/buildClassName.js +1 -99
- package/dist/cjs/extractor/buildClassName.js.map +2 -2
- package/dist/cjs/extractor/bundle.js +1 -126
- package/dist/cjs/extractor/bundle.js.map +2 -2
- package/dist/cjs/extractor/createEvaluator.js +1 -86
- package/dist/cjs/extractor/createEvaluator.js.map +2 -2
- package/dist/cjs/extractor/createExtractor.js +15 -1630
- package/dist/cjs/extractor/createExtractor.js.map +2 -2
- package/dist/cjs/extractor/ensureImportingConcat.js +1 -64
- package/dist/cjs/extractor/ensureImportingConcat.js.map +2 -2
- package/dist/cjs/extractor/evaluateAstNode.js +1 -130
- package/dist/cjs/extractor/evaluateAstNode.js.map +2 -2
- package/dist/cjs/extractor/extractHelpers.js +1 -207
- package/dist/cjs/extractor/extractHelpers.js.map +2 -2
- package/dist/cjs/extractor/extractMediaStyle.js +1 -193
- package/dist/cjs/extractor/extractMediaStyle.js.map +2 -2
- package/dist/cjs/extractor/extractToClassNames.js +13 -413
- package/dist/cjs/extractor/extractToClassNames.js.map +2 -2
- package/dist/cjs/extractor/findTopmostFunction.js +1 -43
- package/dist/cjs/extractor/findTopmostFunction.js.map +2 -2
- package/dist/cjs/extractor/generatedUid.js +1 -59
- package/dist/cjs/extractor/generatedUid.js.map +2 -2
- package/dist/cjs/extractor/getPrefixLogs.js +1 -31
- package/dist/cjs/extractor/getPrefixLogs.js.map +2 -2
- package/dist/cjs/extractor/getPropValueFromAttributes.js +1 -89
- package/dist/cjs/extractor/getPropValueFromAttributes.js.map +2 -2
- package/dist/cjs/extractor/getSourceModule.js +1 -103
- package/dist/cjs/extractor/getSourceModule.js.map +2 -2
- package/dist/cjs/extractor/getStaticBindingsForScope.js +1 -225
- package/dist/cjs/extractor/getStaticBindingsForScope.js.map +2 -2
- package/dist/cjs/extractor/hoistClassNames.js +1 -74
- package/dist/cjs/extractor/hoistClassNames.js.map +2 -2
- package/dist/cjs/extractor/literalToAst.js +1 -115
- package/dist/cjs/extractor/literalToAst.js.map +2 -2
- package/dist/cjs/extractor/loadFile.js +2 -20
- package/dist/cjs/extractor/loadFile.js.map +2 -2
- package/dist/cjs/extractor/loadTamagui.js +15 -432
- package/dist/cjs/extractor/loadTamagui.js.map +2 -2
- package/dist/cjs/extractor/logLines.js +3 -43
- package/dist/cjs/extractor/logLines.js.map +2 -2
- package/dist/cjs/extractor/normalizeTernaries.js +1 -85
- package/dist/cjs/extractor/normalizeTernaries.js.map +2 -2
- package/dist/cjs/extractor/removeUnusedHooks.js +1 -109
- package/dist/cjs/extractor/removeUnusedHooks.js.map +2 -2
- package/dist/cjs/extractor/timer.js +1 -52
- package/dist/cjs/extractor/timer.js.map +2 -2
- package/dist/cjs/extractor/validHTMLAttributes.js +1 -126
- package/dist/cjs/extractor/validHTMLAttributes.js.map +2 -2
- package/dist/cjs/getPragmaOptions.js +2 -67
- package/dist/cjs/getPragmaOptions.js.map +2 -2
- package/dist/cjs/helpers/memoize.js +1 -45
- package/dist/cjs/helpers/memoize.js.map +2 -2
- package/dist/cjs/index.js +1 -42
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/require.js +5 -81
- package/dist/cjs/require.js.map +2 -2
- package/dist/cjs/types.js +1 -16
- package/dist/cjs/types.js.map +2 -2
- package/dist/cjs/webpackPlugin.js +1 -34
- package/dist/cjs/webpackPlugin.js.map +2 -2
- package/dist/esm/constants.js +1 -14
- package/dist/esm/constants.js.map +2 -2
- package/dist/esm/constants.mjs +1 -14
- package/dist/esm/constants.mjs.map +2 -2
- package/dist/esm/extractor/accessSafe.js +1 -18
- package/dist/esm/extractor/accessSafe.js.map +2 -2
- package/dist/esm/extractor/accessSafe.mjs +1 -18
- package/dist/esm/extractor/accessSafe.mjs.map +2 -2
- package/dist/esm/extractor/babelParse.js +1 -31
- package/dist/esm/extractor/babelParse.js.map +2 -2
- package/dist/esm/extractor/babelParse.mjs +1 -31
- package/dist/esm/extractor/babelParse.mjs.map +2 -2
- package/dist/esm/extractor/buildClassName.js +1 -64
- package/dist/esm/extractor/buildClassName.js.map +2 -2
- package/dist/esm/extractor/buildClassName.mjs +1 -64
- package/dist/esm/extractor/buildClassName.mjs.map +2 -2
- package/dist/esm/extractor/bundle.js +1 -91
- package/dist/esm/extractor/bundle.js.map +2 -2
- package/dist/esm/extractor/bundle.mjs +1 -91
- package/dist/esm/extractor/bundle.mjs.map +2 -2
- package/dist/esm/extractor/createEvaluator.js +1 -51
- package/dist/esm/extractor/createEvaluator.js.map +2 -2
- package/dist/esm/extractor/createEvaluator.mjs +1 -51
- package/dist/esm/extractor/createEvaluator.mjs.map +2 -2
- package/dist/esm/extractor/createExtractor.js +15 -1613
- package/dist/esm/extractor/createExtractor.js.map +2 -2
- package/dist/esm/extractor/createExtractor.mjs +15 -1613
- package/dist/esm/extractor/createExtractor.mjs.map +2 -2
- package/dist/esm/extractor/ensureImportingConcat.js +1 -30
- package/dist/esm/extractor/ensureImportingConcat.js.map +2 -2
- package/dist/esm/extractor/ensureImportingConcat.mjs +1 -30
- package/dist/esm/extractor/ensureImportingConcat.mjs.map +2 -2
- package/dist/esm/extractor/evaluateAstNode.js +1 -96
- package/dist/esm/extractor/evaluateAstNode.js.map +2 -2
- package/dist/esm/extractor/evaluateAstNode.mjs +1 -96
- package/dist/esm/extractor/evaluateAstNode.mjs.map +2 -2
- package/dist/esm/extractor/extractHelpers.js +1 -161
- package/dist/esm/extractor/extractHelpers.js.map +2 -2
- package/dist/esm/extractor/extractHelpers.mjs +1 -161
- package/dist/esm/extractor/extractHelpers.mjs.map +2 -2
- package/dist/esm/extractor/extractMediaStyle.js +1 -158
- package/dist/esm/extractor/extractMediaStyle.js.map +2 -2
- package/dist/esm/extractor/extractMediaStyle.mjs +1 -158
- package/dist/esm/extractor/extractMediaStyle.mjs.map +2 -2
- package/dist/esm/extractor/extractToClassNames.js +13 -379
- package/dist/esm/extractor/extractToClassNames.js.map +2 -2
- package/dist/esm/extractor/extractToClassNames.mjs +13 -379
- package/dist/esm/extractor/extractToClassNames.mjs.map +2 -2
- package/dist/esm/extractor/findTopmostFunction.js +1 -19
- package/dist/esm/extractor/findTopmostFunction.js.map +2 -2
- package/dist/esm/extractor/findTopmostFunction.mjs +1 -19
- package/dist/esm/extractor/findTopmostFunction.mjs.map +2 -2
- package/dist/esm/extractor/generatedUid.js +1 -25
- package/dist/esm/extractor/generatedUid.js.map +2 -2
- package/dist/esm/extractor/generatedUid.mjs +1 -25
- package/dist/esm/extractor/generatedUid.mjs.map +2 -2
- package/dist/esm/extractor/getPrefixLogs.js +1 -7
- package/dist/esm/extractor/getPrefixLogs.js.map +2 -2
- package/dist/esm/extractor/getPrefixLogs.mjs +1 -7
- package/dist/esm/extractor/getPrefixLogs.mjs.map +2 -2
- package/dist/esm/extractor/getPropValueFromAttributes.js +1 -55
- package/dist/esm/extractor/getPropValueFromAttributes.js.map +2 -2
- package/dist/esm/extractor/getPropValueFromAttributes.mjs +1 -55
- package/dist/esm/extractor/getPropValueFromAttributes.mjs.map +2 -2
- package/dist/esm/extractor/getSourceModule.js +1 -69
- package/dist/esm/extractor/getSourceModule.js.map +2 -2
- package/dist/esm/extractor/getSourceModule.mjs +1 -69
- package/dist/esm/extractor/getSourceModule.mjs.map +2 -2
- package/dist/esm/extractor/getStaticBindingsForScope.js +1 -190
- package/dist/esm/extractor/getStaticBindingsForScope.js.map +2 -2
- package/dist/esm/extractor/getStaticBindingsForScope.mjs +1 -190
- package/dist/esm/extractor/getStaticBindingsForScope.mjs.map +2 -2
- package/dist/esm/extractor/hoistClassNames.js +1 -40
- package/dist/esm/extractor/hoistClassNames.js.map +2 -2
- package/dist/esm/extractor/hoistClassNames.mjs +1 -40
- package/dist/esm/extractor/hoistClassNames.mjs.map +2 -2
- package/dist/esm/extractor/literalToAst.js +1 -80
- package/dist/esm/extractor/literalToAst.js.map +2 -2
- package/dist/esm/extractor/literalToAst.mjs +1 -80
- package/dist/esm/extractor/literalToAst.mjs.map +2 -2
- package/dist/esm/extractor/loadFile.js +2 -19
- package/dist/esm/extractor/loadFile.js.map +2 -2
- package/dist/esm/extractor/loadFile.mjs +2 -19
- package/dist/esm/extractor/loadFile.mjs.map +2 -2
- package/dist/esm/extractor/loadTamagui.js +15 -396
- package/dist/esm/extractor/loadTamagui.js.map +2 -2
- package/dist/esm/extractor/loadTamagui.mjs +15 -396
- package/dist/esm/extractor/loadTamagui.mjs.map +2 -2
- package/dist/esm/extractor/logLines.js +3 -19
- package/dist/esm/extractor/logLines.js.map +2 -2
- package/dist/esm/extractor/logLines.mjs +3 -19
- package/dist/esm/extractor/logLines.mjs.map +2 -2
- package/dist/esm/extractor/normalizeTernaries.js +1 -51
- package/dist/esm/extractor/normalizeTernaries.js.map +2 -2
- package/dist/esm/extractor/normalizeTernaries.mjs +1 -51
- package/dist/esm/extractor/normalizeTernaries.mjs.map +2 -2
- package/dist/esm/extractor/removeUnusedHooks.js +1 -75
- package/dist/esm/extractor/removeUnusedHooks.js.map +2 -2
- package/dist/esm/extractor/removeUnusedHooks.mjs +1 -75
- package/dist/esm/extractor/removeUnusedHooks.mjs.map +2 -2
- package/dist/esm/extractor/timer.js +1 -28
- package/dist/esm/extractor/timer.js.map +2 -2
- package/dist/esm/extractor/timer.mjs +1 -28
- package/dist/esm/extractor/timer.mjs.map +2 -2
- package/dist/esm/extractor/validHTMLAttributes.js +1 -101
- package/dist/esm/extractor/validHTMLAttributes.js.map +2 -2
- package/dist/esm/extractor/validHTMLAttributes.mjs +1 -101
- package/dist/esm/extractor/validHTMLAttributes.mjs.map +2 -2
- package/dist/esm/getPragmaOptions.js +2 -43
- package/dist/esm/getPragmaOptions.js.map +2 -2
- package/dist/esm/getPragmaOptions.mjs +2 -43
- package/dist/esm/getPragmaOptions.mjs.map +2 -2
- package/dist/esm/helpers/memoize.js +1 -21
- package/dist/esm/helpers/memoize.js.map +2 -2
- package/dist/esm/helpers/memoize.mjs +1 -21
- package/dist/esm/helpers/memoize.mjs.map +2 -2
- package/dist/esm/index.js +1 -15
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/index.mjs +1 -15
- package/dist/esm/index.mjs.map +2 -2
- package/dist/esm/require.js +5 -55
- package/dist/esm/require.js.map +2 -2
- package/dist/esm/require.mjs +5 -55
- package/dist/esm/require.mjs.map +2 -2
- package/dist/esm/webpackPlugin.js +1 -10
- package/dist/esm/webpackPlugin.js.map +2 -2
- package/dist/esm/webpackPlugin.mjs +1 -10
- package/dist/esm/webpackPlugin.mjs.map +2 -2
- package/package.json +14 -14
|
@@ -1,86 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var normalizeTernaries_exports = {};
|
|
30
|
-
__export(normalizeTernaries_exports, {
|
|
31
|
-
normalizeTernaries: () => normalizeTernaries
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(normalizeTernaries_exports);
|
|
34
|
-
var import_generator = __toESM(require("@babel/generator"));
|
|
35
|
-
var t = __toESM(require("@babel/types"));
|
|
36
|
-
var import_invariant = __toESM(require("invariant"));
|
|
37
|
-
function normalizeTernaries(ternaries) {
|
|
38
|
-
(0, import_invariant.default)(
|
|
39
|
-
Array.isArray(ternaries),
|
|
40
|
-
"extractStaticTernaries expects param 1 to be an array of ternaries"
|
|
41
|
-
);
|
|
42
|
-
if (ternaries.length === 0) {
|
|
43
|
-
return [];
|
|
44
|
-
}
|
|
45
|
-
const ternariesByKey = {};
|
|
46
|
-
for (let idx = -1, len = ternaries.length; ++idx < len; ) {
|
|
47
|
-
const { test, consequent, alternate, remove, ...rest } = ternaries[idx];
|
|
48
|
-
let ternaryTest = test;
|
|
49
|
-
if (t.isExpressionStatement(test)) {
|
|
50
|
-
ternaryTest = test.expression;
|
|
51
|
-
}
|
|
52
|
-
let shouldSwap = false;
|
|
53
|
-
if (t.isUnaryExpression(test) && test.operator === "!") {
|
|
54
|
-
ternaryTest = test.argument;
|
|
55
|
-
shouldSwap = true;
|
|
56
|
-
} else if (t.isBinaryExpression(test)) {
|
|
57
|
-
if (test.operator === "!==" || test.operator === "!=") {
|
|
58
|
-
ternaryTest = t.binaryExpression(test.operator, test.left, test.right);
|
|
59
|
-
shouldSwap = true;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const key = (0, import_generator.default)(ternaryTest).code;
|
|
63
|
-
if (!ternariesByKey[key]) {
|
|
64
|
-
ternariesByKey[key] = {
|
|
65
|
-
...rest,
|
|
66
|
-
alternate: {},
|
|
67
|
-
consequent: {},
|
|
68
|
-
test: ternaryTest,
|
|
69
|
-
remove
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
const altStyle = (shouldSwap ? consequent : alternate) ?? {};
|
|
73
|
-
const consStyle = (shouldSwap ? alternate : consequent) ?? {};
|
|
74
|
-
Object.assign(ternariesByKey[key].alternate, altStyle);
|
|
75
|
-
Object.assign(ternariesByKey[key].consequent, consStyle);
|
|
76
|
-
}
|
|
77
|
-
const ternaryExpression = Object.keys(ternariesByKey).map((key) => {
|
|
78
|
-
return ternariesByKey[key];
|
|
79
|
-
});
|
|
80
|
-
return ternaryExpression;
|
|
81
|
-
}
|
|
82
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
-
0 && (module.exports = {
|
|
84
|
-
normalizeTernaries
|
|
85
|
-
});
|
|
1
|
+
"use strict";var h=Object.create;var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var O=(e,r)=>{for(var n in r)p(e,n,{get:r[n],enumerable:!0})},u=(e,r,n,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of j(r))!q.call(e,s)&&s!==n&&p(e,s,{get:()=>r[s],enumerable:!(a=d(r,s))||a.enumerable});return e};var l=(e,r,n)=>(n=e!=null?h(k(e)):{},u(r||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)),v=e=>u(p({},"__esModule",{value:!0}),e);var B={};O(B,{normalizeTernaries:()=>A});module.exports=v(B);var x=l(require("@babel/generator")),c=l(require("@babel/types")),g=l(require("invariant"));function A(e){if((0,g.default)(Array.isArray(e),"extractStaticTernaries expects param 1 to be an array of ternaries"),e.length===0)return[];const r={};for(let a=-1,s=e.length;++a<s;){const{test:t,consequent:f,alternate:m,remove:E,...T}=e[a];let o=t;c.isExpressionStatement(t)&&(o=t.expression);let i=!1;c.isUnaryExpression(t)&&t.operator==="!"?(o=t.argument,i=!0):c.isBinaryExpression(t)&&(t.operator==="!=="||t.operator==="!=")&&(o=c.binaryExpression(t.operator,t.left,t.right),i=!0);const y=(0,x.default)(o).code;r[y]||(r[y]={...T,alternate:{},consequent:{},test:o,remove:E});const b=(i?f:m)??{},S=(i?m:f)??{};Object.assign(r[y].alternate,b),Object.assign(r[y].consequent,S)}return Object.keys(r).map(a=>r[a])}0&&(module.exports={normalizeTernaries});
|
|
86
2
|
//# sourceMappingURL=normalizeTernaries.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/normalizeTernaries.ts"],
|
|
4
4
|
"sourcesContent": ["import generate from '@babel/generator'\nimport * as t from '@babel/types'\nimport invariant from 'invariant'\n\nimport { Ternary } from '../types.js'\n\nexport function normalizeTernaries(ternaries: Ternary[]) {\n invariant(\n Array.isArray(ternaries),\n 'extractStaticTernaries expects param 1 to be an array of ternaries'\n )\n\n if (ternaries.length === 0) {\n return []\n }\n\n const ternariesByKey: { [key: string]: Ternary } = {}\n\n for (let idx = -1, len = ternaries.length; ++idx < len; ) {\n const { test, consequent, alternate, remove, ...rest } = ternaries[idx]\n\n let ternaryTest = test\n\n // strip parens\n if (t.isExpressionStatement(test)) {\n ternaryTest = (test as any).expression\n }\n\n // convert `!thing` to `thing` with swapped consequent and alternate\n let shouldSwap = false\n if (t.isUnaryExpression(test) && test.operator === '!') {\n ternaryTest = test.argument\n shouldSwap = true\n } else if (t.isBinaryExpression(test)) {\n if (test.operator === '!==' || test.operator === '!=') {\n ternaryTest = t.binaryExpression(test.operator, test.left, test.right)\n shouldSwap = true\n }\n }\n\n // @ts-ignore\n const key = generate(ternaryTest as any).code\n\n if (!ternariesByKey[key]) {\n ternariesByKey[key] = {\n ...rest,\n alternate: {},\n consequent: {},\n test: ternaryTest,\n remove,\n }\n }\n const altStyle = (shouldSwap ? consequent : alternate) ?? {}\n const consStyle = (shouldSwap ? alternate : consequent) ?? {}\n Object.assign(ternariesByKey[key].alternate!, altStyle)\n Object.assign(ternariesByKey[key].consequent!, consStyle)\n }\n\n const ternaryExpression = Object.keys(ternariesByKey).map((key) => {\n return ternariesByKey[key]\n })\n\n return ternaryExpression\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["invariant", "generate"]
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAqB,+BACrBC,EAAmB,2BACnBC,EAAsB,wBAIf,SAASJ,EAAmBK,EAAsB,CAMvD,MALA,EAAAC,SACE,MAAM,QAAQD,CAAS,EACvB,oEACF,EAEIA,EAAU,SAAW,EACvB,MAAO,CAAC,EAGV,MAAME,EAA6C,CAAC,EAEpD,QAASC,EAAM,GAAIC,EAAMJ,EAAU,OAAQ,EAAEG,EAAMC,GAAO,CACxD,KAAM,CAAE,KAAAC,EAAM,WAAAC,EAAY,UAAAC,EAAW,OAAAC,EAAQ,GAAGC,CAAK,EAAIT,EAAUG,CAAG,EAEtE,IAAIO,EAAcL,EAGdP,EAAE,sBAAsBO,CAAI,IAC9BK,EAAeL,EAAa,YAI9B,IAAIM,EAAa,GACbb,EAAE,kBAAkBO,CAAI,GAAKA,EAAK,WAAa,KACjDK,EAAcL,EAAK,SACnBM,EAAa,IACJb,EAAE,mBAAmBO,CAAI,IAC9BA,EAAK,WAAa,OAASA,EAAK,WAAa,QAC/CK,EAAcZ,EAAE,iBAAiBO,EAAK,SAAUA,EAAK,KAAMA,EAAK,KAAK,EACrEM,EAAa,IAKjB,MAAMC,KAAM,EAAAC,SAASH,CAAkB,EAAE,KAEpCR,EAAeU,CAAG,IACrBV,EAAeU,CAAG,EAAI,CACpB,GAAGH,EACH,UAAW,CAAC,EACZ,WAAY,CAAC,EACb,KAAMC,EACN,OAAAF,CACF,GAEF,MAAMM,GAAYH,EAAaL,EAAaC,IAAc,CAAC,EACrDQ,GAAaJ,EAAaJ,EAAYD,IAAe,CAAC,EAC5D,OAAO,OAAOJ,EAAeU,CAAG,EAAE,UAAYE,CAAQ,EACtD,OAAO,OAAOZ,EAAeU,CAAG,EAAE,WAAaG,CAAS,CAC1D,CAMA,OAJ0B,OAAO,KAAKb,CAAc,EAAE,IAAKU,GAClDV,EAAeU,CAAG,CAC1B,CAGH",
|
|
6
|
+
"names": ["normalizeTernaries_exports", "__export", "normalizeTernaries", "__toCommonJS", "import_generator", "t", "import_invariant", "ternaries", "invariant", "ternariesByKey", "idx", "len", "test", "consequent", "alternate", "remove", "rest", "ternaryTest", "shouldSwap", "key", "generate", "altStyle", "consStyle"]
|
|
7
7
|
}
|
|
@@ -1,110 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var removeUnusedHooks_exports = {};
|
|
30
|
-
__export(removeUnusedHooks_exports, {
|
|
31
|
-
removeUnusedHooks: () => removeUnusedHooks
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(removeUnusedHooks_exports);
|
|
34
|
-
var t = __toESM(require("@babel/types"));
|
|
35
|
-
const hooks = {
|
|
36
|
-
useMedia: true,
|
|
37
|
-
useTheme: true
|
|
38
|
-
};
|
|
39
|
-
function removeUnusedHooks(compFn, shouldPrintDebug) {
|
|
40
|
-
compFn.scope.crawl();
|
|
41
|
-
let bodyStatements = compFn == null ? void 0 : compFn.get("body");
|
|
42
|
-
if (!bodyStatements) {
|
|
43
|
-
console.log("no body statemnts?", compFn);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (!Array.isArray(bodyStatements)) {
|
|
47
|
-
if (bodyStatements.isFunctionExpression()) {
|
|
48
|
-
bodyStatements = bodyStatements.scope.path.get("body");
|
|
49
|
-
} else {
|
|
50
|
-
bodyStatements = bodyStatements.get("body");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (!bodyStatements || !Array.isArray(bodyStatements)) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const statements = bodyStatements;
|
|
57
|
-
for (const statement of statements) {
|
|
58
|
-
if (!statement.isVariableDeclaration()) {
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
const declarations = statement.get("declarations");
|
|
62
|
-
if (!Array.isArray(declarations)) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
const isBindingReferenced = (name) => {
|
|
66
|
-
var _a;
|
|
67
|
-
return !!((_a = statement.scope.getBinding(name)) == null ? void 0 : _a.referenced);
|
|
68
|
-
};
|
|
69
|
-
for (const declarator of declarations) {
|
|
70
|
-
const id = declarator.get("id");
|
|
71
|
-
const init = declarator.node.init;
|
|
72
|
-
if (Array.isArray(id) || Array.isArray(init)) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const shouldRemove = (() => {
|
|
76
|
-
const isHook = t.isCallExpression(init) && t.isIdentifier(init.callee) && hooks[init.callee.name];
|
|
77
|
-
if (!isHook) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
if (t.isIdentifier(id.node)) {
|
|
81
|
-
const name = id.node.name;
|
|
82
|
-
return !isBindingReferenced(name);
|
|
83
|
-
} else if (t.isObjectPattern(id.node)) {
|
|
84
|
-
const propPaths = id.get("properties");
|
|
85
|
-
return propPaths.every((prop) => {
|
|
86
|
-
if (!prop.isObjectProperty())
|
|
87
|
-
return false;
|
|
88
|
-
const value = prop.get("value");
|
|
89
|
-
if (Array.isArray(value) || !value.isIdentifier())
|
|
90
|
-
return false;
|
|
91
|
-
const name = value.node.name;
|
|
92
|
-
return !isBindingReferenced(name);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
return false;
|
|
96
|
-
})();
|
|
97
|
-
if (shouldRemove) {
|
|
98
|
-
declarator.remove();
|
|
99
|
-
if (shouldPrintDebug) {
|
|
100
|
-
console.log(` [\u{1FA9D}] removed ${id.node["name"] ?? ""}`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
-
0 && (module.exports = {
|
|
108
|
-
removeUnusedHooks
|
|
109
|
-
});
|
|
1
|
+
"use strict";var h=Object.create;var d=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var k=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},g=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of v(t))!P.call(e,o)&&o!==r&&d(e,o,{get:()=>t[o],enumerable:!(i=b(t,o))||i.enumerable});return e};var N=(e,t,r)=>(r=e!=null?h(p(e)):{},g(t||!e||!e.__esModule?d(r,"default",{value:e,enumerable:!0}):r,e)),x=e=>g(d({},"__esModule",{value:!0}),e);var R={};k(R,{removeUnusedHooks:()=>I});module.exports=x(R);var f=N(require("@babel/types"));const H={useMedia:!0,useTheme:!0};function I(e,t){e.scope.crawl();let r=e==null?void 0:e.get("body");if(!r){console.log("no body statemnts?",e);return}if(Array.isArray(r)||(r.isFunctionExpression()?r=r.scope.path.get("body"):r=r.get("body")),!r||!Array.isArray(r))return;const i=r;for(const o of i){if(!o.isVariableDeclaration())continue;const l=o.get("declarations");if(!Array.isArray(l))continue;const u=s=>{var n;return!!((n=o.scope.getBinding(s))!=null&&n.referenced)};for(const s of l){const n=s.get("id"),a=s.node.init;if(Array.isArray(n)||Array.isArray(a))continue;(()=>{if(!(f.isCallExpression(a)&&f.isIdentifier(a.callee)&&H[a.callee.name]))return!1;if(f.isIdentifier(n.node)){const y=n.node.name;return!u(y)}else if(f.isObjectPattern(n.node))return n.get("properties").every(m=>{if(!m.isObjectProperty())return!1;const c=m.get("value");if(Array.isArray(c)||!c.isIdentifier())return!1;const A=c.node.name;return!u(A)});return!1})()&&(s.remove(),t&&console.log(` [\u{1FA9D}] removed ${n.node.name??""}`))}}}0&&(module.exports={removeUnusedHooks});
|
|
110
2
|
//# sourceMappingURL=removeUnusedHooks.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/removeUnusedHooks.ts"],
|
|
4
4
|
"sourcesContent": ["import { NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\n\nconst hooks = {\n useMedia: true,\n useTheme: true,\n}\n\nexport function removeUnusedHooks(compFn: NodePath<any>, shouldPrintDebug: boolean | 'verbose') {\n compFn.scope.crawl()\n // check the top level statements\n let bodyStatements = compFn?.get('body')\n if (!bodyStatements) {\n // eslint-disable-next-line no-console\n console.log('no body statemnts?', compFn)\n return\n }\n if (!Array.isArray(bodyStatements)) {\n if (bodyStatements.isFunctionExpression()) {\n bodyStatements = bodyStatements.scope.path.get('body')\n } else {\n bodyStatements = bodyStatements.get('body')\n }\n }\n if (!bodyStatements || !Array.isArray(bodyStatements)) {\n return\n }\n const statements = bodyStatements as NodePath<any>[]\n for (const statement of statements) {\n if (!statement.isVariableDeclaration()) {\n continue\n }\n const declarations = statement.get('declarations')\n if (!Array.isArray(declarations)) {\n continue\n }\n const isBindingReferenced = (name: string) => {\n return !!statement.scope.getBinding(name)?.referenced\n }\n for (const declarator of declarations) {\n const id = declarator.get('id')\n const init = declarator.node.init\n if (Array.isArray(id) || Array.isArray(init)) {\n continue\n }\n const shouldRemove = (() => {\n const isHook =\n t.isCallExpression(init) && t.isIdentifier(init.callee) && hooks[init.callee.name]\n if (!isHook) {\n return false\n }\n if (t.isIdentifier(id.node)) {\n // remove \"const media = useMedia()\"\n const name = id.node.name\n return !isBindingReferenced(name)\n } else if (t.isObjectPattern(id.node)) {\n // remove \"const { sm } = useMedia()\"\n const propPaths = id.get('properties') as NodePath<any>[]\n return propPaths.every((prop) => {\n if (!prop.isObjectProperty()) return false\n const value = prop.get('value')\n if (Array.isArray(value) || !value.isIdentifier()) return false\n const name = value.node.name\n return !isBindingReferenced(name)\n })\n }\n return false\n })()\n if (shouldRemove) {\n declarator.remove()\n if (shouldPrintDebug) {\n // eslint-disable-next-line no-console\n console.log(` [\uD83E\uDE9D] removed ${id.node['name'] ?? ''}`)\n }\n }\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAmB,2BAEnB,MAAMC,EAAQ,CACZ,SAAU,GACV,SAAU,EACZ,EAEO,SAASH,EAAkBI,EAAuBC,EAAuC,CAC9FD,EAAO,MAAM,MAAM,EAEnB,IAAIE,EAAiBF,GAAA,YAAAA,EAAQ,IAAI,QACjC,GAAI,CAACE,EAAgB,CAEnB,QAAQ,IAAI,qBAAsBF,CAAM,EACxC,MACF,CAQA,GAPK,MAAM,QAAQE,CAAc,IAC3BA,EAAe,qBAAqB,EACtCA,EAAiBA,EAAe,MAAM,KAAK,IAAI,MAAM,EAErDA,EAAiBA,EAAe,IAAI,MAAM,GAG1C,CAACA,GAAkB,CAAC,MAAM,QAAQA,CAAc,EAClD,OAEF,MAAMC,EAAaD,EACnB,UAAWE,KAAaD,EAAY,CAClC,GAAI,CAACC,EAAU,sBAAsB,EACnC,SAEF,MAAMC,EAAeD,EAAU,IAAI,cAAc,EACjD,GAAI,CAAC,MAAM,QAAQC,CAAY,EAC7B,SAEF,MAAMC,EAAuBC,GAAiB,CApClD,IAAAC,EAqCM,MAAO,CAAC,GAACA,EAAAJ,EAAU,MAAM,WAAWG,CAAI,IAA/B,MAAAC,EAAkC,WAC7C,EACA,UAAWC,KAAcJ,EAAc,CACrC,MAAMK,EAAKD,EAAW,IAAI,IAAI,EACxBE,EAAOF,EAAW,KAAK,KAC7B,GAAI,MAAM,QAAQC,CAAE,GAAK,MAAM,QAAQC,CAAI,EACzC,UAEoB,IAAM,CAG1B,GAAI,EADFb,EAAE,iBAAiBa,CAAI,GAAKb,EAAE,aAAaa,EAAK,MAAM,GAAKZ,EAAMY,EAAK,OAAO,IAAI,GAEjF,MAAO,GAET,GAAIb,EAAE,aAAaY,EAAG,IAAI,EAAG,CAE3B,MAAMH,EAAOG,EAAG,KAAK,KACrB,MAAO,CAACJ,EAAoBC,CAAI,CAClC,SAAWT,EAAE,gBAAgBY,EAAG,IAAI,EAGlC,OADkBA,EAAG,IAAI,YAAY,EACpB,MAAOE,GAAS,CAC/B,GAAI,CAACA,EAAK,iBAAiB,EAAG,MAAO,GACrC,MAAMC,EAAQD,EAAK,IAAI,OAAO,EAC9B,GAAI,MAAM,QAAQC,CAAK,GAAK,CAACA,EAAM,aAAa,EAAG,MAAO,GAC1D,MAAMN,EAAOM,EAAM,KAAK,KACxB,MAAO,CAACP,EAAoBC,CAAI,CAClC,CAAC,EAEH,MAAO,EACT,GAAG,IAEDE,EAAW,OAAO,EACdR,GAEF,QAAQ,IAAI,yBAAkBS,EAAG,KAAK,MAAW,IAAI,EAG3D,CACF,CACF",
|
|
6
|
+
"names": ["removeUnusedHooks_exports", "__export", "removeUnusedHooks", "__toCommonJS", "t", "hooks", "compFn", "shouldPrintDebug", "bodyStatements", "statements", "statement", "declarations", "isBindingReferenced", "name", "_a", "declarator", "id", "init", "prop", "value"]
|
|
7
7
|
}
|
|
@@ -1,53 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var timer_exports = {};
|
|
20
|
-
__export(timer_exports, {
|
|
21
|
-
timer: () => timer
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(timer_exports);
|
|
24
|
-
const timer = () => {
|
|
25
|
-
const start = Date.now();
|
|
26
|
-
let last = start;
|
|
27
|
-
return {
|
|
28
|
-
mark: (name, print = false) => {
|
|
29
|
-
if (print) {
|
|
30
|
-
const took = Date.now() - last;
|
|
31
|
-
last = Date.now();
|
|
32
|
-
console.log(`Time ${name}: ${took}ms`);
|
|
33
|
-
if (took > 10) {
|
|
34
|
-
console.log(" long timer");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
done: (print = false) => {
|
|
39
|
-
if (print) {
|
|
40
|
-
const total = Date.now() - start;
|
|
41
|
-
console.log(`Total time: ${total}ms`);
|
|
42
|
-
if (total > 50) {
|
|
43
|
-
console.log(" long timer");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 && (module.exports = {
|
|
51
|
-
timer
|
|
52
|
-
});
|
|
1
|
+
"use strict";var s=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var c=(t,o)=>{for(var e in o)s(t,e,{get:o[e],enumerable:!0})},m=(t,o,e,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of i(o))!r.call(t,n)&&n!==e&&s(t,n,{get:()=>o[n],enumerable:!(l=a(o,n))||l.enumerable});return t};var g=t=>m(s({},"__esModule",{value:!0}),t);var w={};c(w,{timer:()=>f});module.exports=g(w);const f=()=>{const t=Date.now();let o=t;return{mark:(e,l=!1)=>{if(l){const n=Date.now()-o;o=Date.now(),console.log(`Time ${e}: ${n}ms`),n>10&&console.log(" long timer")}},done:(e=!1)=>{if(e){const l=Date.now()-t;console.log(`Total time: ${l}ms`),l>50&&console.log(" long timer")}}}};0&&(module.exports={timer});
|
|
53
2
|
//# sourceMappingURL=timer.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/timer.ts"],
|
|
4
4
|
"sourcesContent": ["export const timer = () => {\n const start = Date.now()\n let last = start\n return {\n mark: (name: string, print = false) => {\n if (print) {\n const took = Date.now() - last\n last = Date.now()\n // eslint-disable-next-line no-console\n console.log(`Time ${name}: ${took}ms`)\n if (took > 10) {\n // eslint-disable-next-line no-console\n console.log(' long timer')\n }\n }\n },\n done: (print = false) => {\n if (print) {\n const total = Date.now() - start\n // eslint-disable-next-line no-console\n console.log(`Total time: ${total}ms`)\n if (total > 50) {\n // eslint-disable-next-line no-console\n console.log(' long timer')\n }\n }\n },\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAQ,IAAM,CACzB,MAAME,EAAQ,KAAK,IAAI,EACvB,IAAIC,EAAOD,EACX,MAAO,CACL,KAAM,CAACE,EAAcC,EAAQ,KAAU,CACrC,GAAIA,EAAO,CACT,MAAMC,EAAO,KAAK,IAAI,EAAIH,EAC1BA,EAAO,KAAK,IAAI,EAEhB,QAAQ,IAAI,QAAQC,MAASE,KAAQ,EACjCA,EAAO,IAET,QAAQ,IAAI,cAAc,CAE9B,CACF,EACA,KAAM,CAACD,EAAQ,KAAU,CACvB,GAAIA,EAAO,CACT,MAAME,EAAQ,KAAK,IAAI,EAAIL,EAE3B,QAAQ,IAAI,eAAeK,KAAS,EAChCA,EAAQ,IAEV,QAAQ,IAAI,cAAc,CAE9B,CACF,CACF,CACF",
|
|
6
|
+
"names": ["timer_exports", "__export", "timer", "__toCommonJS", "start", "last", "name", "print", "took", "total"]
|
|
7
7
|
}
|
|
@@ -1,127 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var validHTMLAttributes_exports = {};
|
|
20
|
-
__export(validHTMLAttributes_exports, {
|
|
21
|
-
validAccessibilityAttributes: () => validAccessibilityAttributes,
|
|
22
|
-
validHTMLAttributes: () => validHTMLAttributes
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(validHTMLAttributes_exports);
|
|
25
|
-
const validHTMLAttributes = {
|
|
26
|
-
autocomplete: true,
|
|
27
|
-
border: true,
|
|
28
|
-
contenteditable: true,
|
|
29
|
-
crossorigin: true,
|
|
30
|
-
dir: true,
|
|
31
|
-
draggable: true,
|
|
32
|
-
enctype: true,
|
|
33
|
-
formenctype: true,
|
|
34
|
-
formmethod: true,
|
|
35
|
-
formtarget: true,
|
|
36
|
-
inputmode: true,
|
|
37
|
-
kind: true,
|
|
38
|
-
link: true,
|
|
39
|
-
method: true,
|
|
40
|
-
preload: true,
|
|
41
|
-
referrerpolicy: true,
|
|
42
|
-
rel: true,
|
|
43
|
-
rev: true,
|
|
44
|
-
role: true,
|
|
45
|
-
sandbox: true,
|
|
46
|
-
shape: true,
|
|
47
|
-
spellcheck: true,
|
|
48
|
-
target: true,
|
|
49
|
-
translate: true,
|
|
50
|
-
type: true,
|
|
51
|
-
wrap: true,
|
|
52
|
-
"aria-autocomplete": true,
|
|
53
|
-
"aria-busy": true,
|
|
54
|
-
"aria-checked": true,
|
|
55
|
-
"aria-current": true,
|
|
56
|
-
"aria-disabled": true,
|
|
57
|
-
"aria-expanded": true,
|
|
58
|
-
"aria-haspopup": true,
|
|
59
|
-
"aria-hidden": true,
|
|
60
|
-
"aria-invalid": true,
|
|
61
|
-
"aria-polite": true,
|
|
62
|
-
"aria-modal": true,
|
|
63
|
-
"aria-multiline": true,
|
|
64
|
-
"aria-multiselectable": true,
|
|
65
|
-
"aria-orientation": true,
|
|
66
|
-
"aria-pressed": true,
|
|
67
|
-
"aria-readonly": true,
|
|
68
|
-
"aria-relevant": true,
|
|
69
|
-
"aria-required": true,
|
|
70
|
-
"aria-selected": true,
|
|
71
|
-
"aria-sort": true
|
|
72
|
-
};
|
|
73
|
-
const validAccessibilityAttributes = {
|
|
74
|
-
accessibilityRole: true,
|
|
75
|
-
accessibilityActiveDescendant: true,
|
|
76
|
-
accessibilityAtomic: true,
|
|
77
|
-
accessibilityAutoComplete: true,
|
|
78
|
-
accessibilityBusy: true,
|
|
79
|
-
accessibilityChecked: true,
|
|
80
|
-
accessibilityColumnCount: true,
|
|
81
|
-
accessibilityColumnIndex: true,
|
|
82
|
-
accessibilityColumnSpan: true,
|
|
83
|
-
accessibilityControls: true,
|
|
84
|
-
accessibilityCurrent: true,
|
|
85
|
-
accessibilityDescribedBy: true,
|
|
86
|
-
accessibilityDetails: true,
|
|
87
|
-
disabled: true,
|
|
88
|
-
accessibilityErrorMessage: true,
|
|
89
|
-
accessibilityExpanded: true,
|
|
90
|
-
accessibilityFlowTo: true,
|
|
91
|
-
accessibilityHasPopup: true,
|
|
92
|
-
accessibilityHidden: true,
|
|
93
|
-
accessibilityInvalid: true,
|
|
94
|
-
accessibilityKeyShortcuts: true,
|
|
95
|
-
accessibilityLabel: true,
|
|
96
|
-
accessibilityLabelledBy: true,
|
|
97
|
-
accessibilityLevel: true,
|
|
98
|
-
accessibilityLiveRegion: true,
|
|
99
|
-
accessibilityModal: true,
|
|
100
|
-
accessibilityMultiline: true,
|
|
101
|
-
accessibilityMultiSelectable: true,
|
|
102
|
-
accessibilityOrientation: true,
|
|
103
|
-
accessibilityOwns: true,
|
|
104
|
-
accessibilityPlaceholder: true,
|
|
105
|
-
accessibilityPosInSet: true,
|
|
106
|
-
accessibilityPressed: true,
|
|
107
|
-
accessibilityReadOnly: true,
|
|
108
|
-
accessibilityRequired: true,
|
|
109
|
-
accessibilityRoleDescription: true,
|
|
110
|
-
accessibilityRowCount: true,
|
|
111
|
-
accessibilityRowIndex: true,
|
|
112
|
-
accessibilityRowSpan: true,
|
|
113
|
-
accessibilitySelected: true,
|
|
114
|
-
accessibilitySetSize: true,
|
|
115
|
-
accessibilitySort: true,
|
|
116
|
-
accessibilityValueMax: true,
|
|
117
|
-
accessibilityValueMin: true,
|
|
118
|
-
accessibilityValueNow: true,
|
|
119
|
-
accessibilityValueText: true,
|
|
120
|
-
nativeID: true
|
|
121
|
-
};
|
|
122
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
123
|
-
0 && (module.exports = {
|
|
124
|
-
validAccessibilityAttributes,
|
|
125
|
-
validHTMLAttributes
|
|
126
|
-
});
|
|
1
|
+
"use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var r in e)a(t,r,{get:e[r],enumerable:!0})},o=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of c(e))!l.call(t,i)&&i!==r&&a(t,i,{get:()=>e[i],enumerable:!(s=u(e,i))||s.enumerable});return t};var y=t=>o(a({},"__esModule",{value:!0}),t);var p={};b(p,{validAccessibilityAttributes:()=>d,validHTMLAttributes:()=>n});module.exports=y(p);const n={autocomplete:!0,border:!0,contenteditable:!0,crossorigin:!0,dir:!0,draggable:!0,enctype:!0,formenctype:!0,formmethod:!0,formtarget:!0,inputmode:!0,kind:!0,link:!0,method:!0,preload:!0,referrerpolicy:!0,rel:!0,rev:!0,role:!0,sandbox:!0,shape:!0,spellcheck:!0,target:!0,translate:!0,type:!0,wrap:!0,"aria-autocomplete":!0,"aria-busy":!0,"aria-checked":!0,"aria-current":!0,"aria-disabled":!0,"aria-expanded":!0,"aria-haspopup":!0,"aria-hidden":!0,"aria-invalid":!0,"aria-polite":!0,"aria-modal":!0,"aria-multiline":!0,"aria-multiselectable":!0,"aria-orientation":!0,"aria-pressed":!0,"aria-readonly":!0,"aria-relevant":!0,"aria-required":!0,"aria-selected":!0,"aria-sort":!0},d={accessibilityRole:!0,accessibilityActiveDescendant:!0,accessibilityAtomic:!0,accessibilityAutoComplete:!0,accessibilityBusy:!0,accessibilityChecked:!0,accessibilityColumnCount:!0,accessibilityColumnIndex:!0,accessibilityColumnSpan:!0,accessibilityControls:!0,accessibilityCurrent:!0,accessibilityDescribedBy:!0,accessibilityDetails:!0,disabled:!0,accessibilityErrorMessage:!0,accessibilityExpanded:!0,accessibilityFlowTo:!0,accessibilityHasPopup:!0,accessibilityHidden:!0,accessibilityInvalid:!0,accessibilityKeyShortcuts:!0,accessibilityLabel:!0,accessibilityLabelledBy:!0,accessibilityLevel:!0,accessibilityLiveRegion:!0,accessibilityModal:!0,accessibilityMultiline:!0,accessibilityMultiSelectable:!0,accessibilityOrientation:!0,accessibilityOwns:!0,accessibilityPlaceholder:!0,accessibilityPosInSet:!0,accessibilityPressed:!0,accessibilityReadOnly:!0,accessibilityRequired:!0,accessibilityRoleDescription:!0,accessibilityRowCount:!0,accessibilityRowIndex:!0,accessibilityRowSpan:!0,accessibilitySelected:!0,accessibilitySetSize:!0,accessibilitySort:!0,accessibilityValueMax:!0,accessibilityValueMin:!0,accessibilityValueNow:!0,accessibilityValueText:!0,nativeID:!0};0&&(module.exports={validAccessibilityAttributes,validHTMLAttributes});
|
|
127
2
|
//# sourceMappingURL=validHTMLAttributes.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/validHTMLAttributes.ts"],
|
|
4
4
|
"sourcesContent": ["export const validHTMLAttributes = {\n autocomplete: true,\n border: true,\n contenteditable: true,\n crossorigin: true,\n dir: true,\n draggable: true,\n enctype: true,\n formenctype: true,\n formmethod: true,\n formtarget: true,\n inputmode: true,\n kind: true,\n link: true,\n method: true,\n preload: true,\n referrerpolicy: true,\n rel: true,\n rev: true,\n role: true,\n sandbox: true,\n shape: true,\n spellcheck: true,\n target: true,\n translate: true,\n type: true,\n wrap: true,\n 'aria-autocomplete': true,\n 'aria-busy': true,\n 'aria-checked': true,\n 'aria-current': true,\n 'aria-disabled': true,\n 'aria-expanded': true,\n 'aria-haspopup': true,\n 'aria-hidden': true,\n 'aria-invalid': true,\n 'aria-polite': true,\n 'aria-modal': true,\n 'aria-multiline': true,\n 'aria-multiselectable': true,\n 'aria-orientation': true,\n 'aria-pressed': true,\n 'aria-readonly': true,\n 'aria-relevant': true,\n 'aria-required': true,\n 'aria-selected': true,\n 'aria-sort': true,\n}\n\n// for moving off react-native-web eventually (unused atm)\nexport const validAccessibilityAttributes = {\n accessibilityRole: true,\n accessibilityActiveDescendant: true,\n accessibilityAtomic: true,\n accessibilityAutoComplete: true,\n accessibilityBusy: true,\n accessibilityChecked: true,\n accessibilityColumnCount: true,\n accessibilityColumnIndex: true,\n accessibilityColumnSpan: true,\n accessibilityControls: true,\n accessibilityCurrent: true,\n accessibilityDescribedBy: true,\n accessibilityDetails: true,\n disabled: true,\n accessibilityErrorMessage: true,\n accessibilityExpanded: true,\n accessibilityFlowTo: true,\n accessibilityHasPopup: true,\n accessibilityHidden: true,\n accessibilityInvalid: true,\n accessibilityKeyShortcuts: true,\n accessibilityLabel: true,\n accessibilityLabelledBy: true,\n accessibilityLevel: true,\n accessibilityLiveRegion: true,\n accessibilityModal: true,\n accessibilityMultiline: true,\n accessibilityMultiSelectable: true,\n accessibilityOrientation: true,\n accessibilityOwns: true,\n accessibilityPlaceholder: true,\n accessibilityPosInSet: true,\n accessibilityPressed: true,\n accessibilityReadOnly: true,\n accessibilityRequired: true,\n accessibilityRoleDescription: true,\n accessibilityRowCount: true,\n accessibilityRowIndex: true,\n accessibilityRowSpan: true,\n accessibilitySelected: true,\n accessibilitySetSize: true,\n accessibilitySort: true,\n accessibilityValueMax: true,\n accessibilityValueMin: true,\n accessibilityValueNow: true,\n accessibilityValueText: true,\n nativeID: true,\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,EAAA,wBAAAC,IAAA,eAAAC,EAAAJ,GAAO,MAAMG,EAAsB,CACjC,aAAc,GACd,OAAQ,GACR,gBAAiB,GACjB,YAAa,GACb,IAAK,GACL,UAAW,GACX,QAAS,GACT,YAAa,GACb,WAAY,GACZ,WAAY,GACZ,UAAW,GACX,KAAM,GACN,KAAM,GACN,OAAQ,GACR,QAAS,GACT,eAAgB,GAChB,IAAK,GACL,IAAK,GACL,KAAM,GACN,QAAS,GACT,MAAO,GACP,WAAY,GACZ,OAAQ,GACR,UAAW,GACX,KAAM,GACN,KAAM,GACN,oBAAqB,GACrB,YAAa,GACb,eAAgB,GAChB,eAAgB,GAChB,gBAAiB,GACjB,gBAAiB,GACjB,gBAAiB,GACjB,cAAe,GACf,eAAgB,GAChB,cAAe,GACf,aAAc,GACd,iBAAkB,GAClB,uBAAwB,GACxB,mBAAoB,GACpB,eAAgB,GAChB,gBAAiB,GACjB,gBAAiB,GACjB,gBAAiB,GACjB,gBAAiB,GACjB,YAAa,EACf,EAGaD,EAA+B,CAC1C,kBAAmB,GACnB,8BAA+B,GAC/B,oBAAqB,GACrB,0BAA2B,GAC3B,kBAAmB,GACnB,qBAAsB,GACtB,yBAA0B,GAC1B,yBAA0B,GAC1B,wBAAyB,GACzB,sBAAuB,GACvB,qBAAsB,GACtB,yBAA0B,GAC1B,qBAAsB,GACtB,SAAU,GACV,0BAA2B,GAC3B,sBAAuB,GACvB,oBAAqB,GACrB,sBAAuB,GACvB,oBAAqB,GACrB,qBAAsB,GACtB,0BAA2B,GAC3B,mBAAoB,GACpB,wBAAyB,GACzB,mBAAoB,GACpB,wBAAyB,GACzB,mBAAoB,GACpB,uBAAwB,GACxB,6BAA8B,GAC9B,yBAA0B,GAC1B,kBAAmB,GACnB,yBAA0B,GAC1B,sBAAuB,GACvB,qBAAsB,GACtB,sBAAuB,GACvB,sBAAuB,GACvB,6BAA8B,GAC9B,sBAAuB,GACvB,sBAAuB,GACvB,qBAAsB,GACtB,sBAAuB,GACvB,qBAAsB,GACtB,kBAAmB,GACnB,sBAAuB,GACvB,sBAAuB,GACvB,sBAAuB,GACvB,uBAAwB,GACxB,SAAU,EACZ",
|
|
6
|
+
"names": ["validHTMLAttributes_exports", "__export", "validAccessibilityAttributes", "validHTMLAttributes", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -1,68 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var getPragmaOptions_exports = {};
|
|
20
|
-
__export(getPragmaOptions_exports, {
|
|
21
|
-
getPragmaOptions: () => getPragmaOptions
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(getPragmaOptions_exports);
|
|
24
|
-
function getPragmaOptions({
|
|
25
|
-
source,
|
|
26
|
-
path,
|
|
27
|
-
disableCommentCheck
|
|
28
|
-
}) {
|
|
29
|
-
var _a, _b;
|
|
30
|
-
if (!disableCommentCheck && !source.startsWith("//") && !source.startsWith("/*")) {
|
|
31
|
-
return {
|
|
32
|
-
shouldPrintDebug: false,
|
|
33
|
-
shouldDisable: false
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
let shouldPrintDebug = false;
|
|
37
|
-
let shouldDisable = false;
|
|
38
|
-
const firstLine = source.slice(0, 800).split("\n")[0];
|
|
39
|
-
if (firstLine.includes("tamagui-ignore")) {
|
|
40
|
-
shouldDisable = true;
|
|
41
|
-
}
|
|
42
|
-
if (firstLine.includes("debug")) {
|
|
43
|
-
shouldPrintDebug = true;
|
|
44
|
-
}
|
|
45
|
-
if (firstLine.includes("debug-verbose")) {
|
|
46
|
-
shouldPrintDebug = "verbose";
|
|
47
|
-
}
|
|
48
|
-
if (process.env.TAMAGUI_DEBUG_FILE) {
|
|
49
|
-
if (path.includes(process.env.TAMAGUI_DEBUG_FILE)) {
|
|
50
|
-
shouldPrintDebug = "verbose";
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if ((_a = process.env.DEBUG) == null ? void 0 : _a.includes("tamagui")) {
|
|
54
|
-
shouldPrintDebug = true;
|
|
55
|
-
}
|
|
56
|
-
if ((_b = process.env.DEBUG) == null ? void 0 : _b.includes("tamagui-verbose")) {
|
|
57
|
-
shouldPrintDebug = "verbose";
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
shouldPrintDebug,
|
|
61
|
-
shouldDisable
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
-
0 && (module.exports = {
|
|
66
|
-
getPragmaOptions
|
|
67
|
-
});
|
|
1
|
+
"use strict";var l=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var c=(e,s)=>{for(var n in s)l(e,n,{get:s[n],enumerable:!0})},d=(e,s,n,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let t of b(s))!f.call(e,t)&&t!==n&&l(e,t,{get:()=>s[t],enumerable:!(i=a(s,t))||i.enumerable});return e};var g=e=>d(l({},"__esModule",{value:!0}),e);var h={};c(h,{getPragmaOptions:()=>v});module.exports=g(h);function v({source:e,path:s,disableCommentCheck:n}){var o,u;if(!n&&!e.startsWith("//")&&!e.startsWith("/*"))return{shouldPrintDebug:!1,shouldDisable:!1};let i=!1,t=!1;const r=e.slice(0,800).split(`
|
|
2
|
+
`)[0];return r.includes("tamagui-ignore")&&(t=!0),r.includes("debug")&&(i=!0),r.includes("debug-verbose")&&(i="verbose"),process.env.TAMAGUI_DEBUG_FILE&&s.includes(process.env.TAMAGUI_DEBUG_FILE)&&(i="verbose"),(o=process.env.DEBUG)!=null&&o.includes("tamagui")&&(i=!0),(u=process.env.DEBUG)!=null&&u.includes("tamagui-verbose")&&(i="verbose"),{shouldPrintDebug:i,shouldDisable:t}}0&&(module.exports={getPragmaOptions});
|
|
68
3
|
//# sourceMappingURL=getPragmaOptions.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/getPragmaOptions.ts"],
|
|
4
4
|
"sourcesContent": ["export function getPragmaOptions({\n source,\n path,\n disableCommentCheck,\n}: {\n source: string\n path: string\n disableCommentCheck?: boolean\n}) {\n if (!disableCommentCheck && !source.startsWith('//') && !source.startsWith('/*')) {\n return {\n shouldPrintDebug: false,\n shouldDisable: false,\n }\n }\n\n let shouldPrintDebug: boolean | 'verbose' = false\n let shouldDisable = false\n\n // try and avoid too much parsing but sometimes esbuild adds helpers above..\n const firstLine = source.slice(0, 800).split('\\n')[0]\n\n if (firstLine.includes('tamagui-ignore')) {\n shouldDisable = true\n }\n\n if (firstLine.includes('debug')) {\n shouldPrintDebug = true\n }\n\n if (firstLine.includes('debug-verbose')) {\n shouldPrintDebug = 'verbose'\n }\n\n if (process.env.TAMAGUI_DEBUG_FILE) {\n if (path.includes(process.env.TAMAGUI_DEBUG_FILE)) {\n shouldPrintDebug = 'verbose'\n }\n }\n\n if (process.env.DEBUG?.includes('tamagui')) {\n shouldPrintDebug = true\n }\n\n if (process.env.DEBUG?.includes('tamagui-verbose')) {\n shouldPrintDebug = 'verbose'\n }\n\n return {\n shouldPrintDebug,\n shouldDisable,\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAO,SAASE,EAAiB,CAC/B,OAAAE,EACA,KAAAC,EACA,oBAAAC,CACF,EAIG,CARH,IAAAC,EAAAC,EASE,GAAI,CAACF,GAAuB,CAACF,EAAO,WAAW,IAAI,GAAK,CAACA,EAAO,WAAW,IAAI,EAC7E,MAAO,CACL,iBAAkB,GAClB,cAAe,EACjB,EAGF,IAAIK,EAAwC,GACxCC,EAAgB,GAGpB,MAAMC,EAAYP,EAAO,MAAM,EAAG,GAAG,EAAE,MAAM;AAAA,CAAI,EAAE,CAAC,EAEpD,OAAIO,EAAU,SAAS,gBAAgB,IACrCD,EAAgB,IAGdC,EAAU,SAAS,OAAO,IAC5BF,EAAmB,IAGjBE,EAAU,SAAS,eAAe,IACpCF,EAAmB,WAGjB,QAAQ,IAAI,oBACVJ,EAAK,SAAS,QAAQ,IAAI,kBAAkB,IAC9CI,EAAmB,YAInBF,EAAA,QAAQ,IAAI,QAAZ,MAAAA,EAAmB,SAAS,aAC9BE,EAAmB,KAGjBD,EAAA,QAAQ,IAAI,QAAZ,MAAAA,EAAmB,SAAS,qBAC9BC,EAAmB,WAGd,CACL,iBAAAA,EACA,cAAAC,CACF,CACF",
|
|
6
|
+
"names": ["getPragmaOptions_exports", "__export", "getPragmaOptions", "__toCommonJS", "source", "path", "disableCommentCheck", "_a", "_b", "shouldPrintDebug", "shouldDisable", "firstLine"]
|
|
7
7
|
}
|
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var memoize_exports = {};
|
|
20
|
-
__export(memoize_exports, {
|
|
21
|
-
memoize: () => memoize
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(memoize_exports);
|
|
24
|
-
function memoize(func, resolver) {
|
|
25
|
-
if (typeof func !== "function" || resolver != null && typeof resolver !== "function") {
|
|
26
|
-
throw new TypeError("Expected a function");
|
|
27
|
-
}
|
|
28
|
-
const memoized = function(...args) {
|
|
29
|
-
const key = resolver ? resolver.apply(this, args) : args[0];
|
|
30
|
-
const cache = memoized.cache;
|
|
31
|
-
if (cache.has(key)) {
|
|
32
|
-
return cache.get(key);
|
|
33
|
-
}
|
|
34
|
-
const result = func.apply(this, args);
|
|
35
|
-
memoized.cache = cache.set(key, result) || cache;
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
memoized.cache = new (memoize.Cache || Map)();
|
|
39
|
-
return memoized;
|
|
40
|
-
}
|
|
41
|
-
memoize.Cache = Map;
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
memoize
|
|
45
|
-
});
|
|
1
|
+
"use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var m=(n,t)=>{for(var c in t)a(n,c,{get:t[c],enumerable:!0})},r=(n,t,c,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of f(t))!y.call(n,e)&&e!==c&&a(n,e,{get:()=>t[e],enumerable:!(o=u(t,e))||o.enumerable});return n};var s=n=>r(a({},"__esModule",{value:!0}),n);var w={};m(w,{memoize:()=>p});module.exports=s(w);function p(n,t){if(typeof n!="function"||t!=null&&typeof t!="function")throw new TypeError("Expected a function");const c=function(...o){const e=t?t.apply(this,o):o[0],i=c.cache;if(i.has(e))return i.get(e);const h=n.apply(this,o);return c.cache=i.set(e,h)||i,h};return c.cache=new(p.Cache||Map),c}p.Cache=Map;0&&(module.exports={memoize});
|
|
46
2
|
//# sourceMappingURL=memoize.js.map
|