diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 60c660d..0000000 --- a/.prettierrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "trailingComma": "none", - "tabWidth": 2, - "semi": true, - "singleQuote": true, - "arrowParens": "avoid", - "printWidth": 100 -} \ No newline at end of file diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..9ab08ba --- /dev/null +++ b/biome.json @@ -0,0 +1,264 @@ +{ + "$schema": "https://unpkg.com/@biomejs/biome/configuration_schema.json", + "files": { + "ignore": [ + "node_modules/**/*" + ] + }, + "vcs": { + "useIgnoreFile": true + }, + "linter": { + "enabled": true, + "ignore": [ + "node_modules/**/*" + ], + "rules": { + "a11y": { + "noAccessKey": "error", + "noAriaUnsupportedElements": "error", + "noAutofocus": "error", + "noBlankTarget": "error", + "noDistractingElements": "error", + "noHeaderScope": "error", + "noInteractiveElementToNoninteractiveRole": "error", + "noNoninteractiveElementToInteractiveRole": "error", + "noNoninteractiveTabindex": "error", + "noPositiveTabindex": "error", + "noRedundantAlt": "error", + "noRedundantRoles": "error", + "noSvgWithoutTitle": "error", + "useAltText": "error", + "useAnchorContent": "error", + "useAriaActivedescendantWithTabindex": "error", + "useAriaPropsForRole": "error", + "useButtonType": "error", + "useHeadingContent": "error", + "useHtmlLang": "error", + "useIframeTitle": "warn", + "useKeyWithClickEvents": "warn", + "useKeyWithMouseEvents": "warn", + "useMediaCaption": "error", + "useValidAnchor": "error", + "useValidAriaProps": "error", + "useValidAriaValues": "error", + "useValidLang": "error" + }, + "complexity": { + "noBannedTypes": "error", + "noExcessiveCognitiveComplexity": "error", + "noExtraBooleanCast": "error", + "noForEach": "error", + "noMultipleSpacesInRegularExpressionLiterals": "warn", + "noStaticOnlyClass": "error", + "noThisInStatic": "error", + "noUselessCatch": "error", + "noUselessConstructor": "error", + "noUselessEmptyExport": "error", + "noUselessFragments": "error", + "noUselessLabel": "error", + "noUselessRename": "error", + "noUselessSwitchCase": "error", + "noUselessThisAlias": "error", + "noUselessTypeConstraint": "error", + "noVoid": "off", + "noWith": "error", + "useArrowFunction": "error", + "useFlatMap": "error", + "useLiteralKeys": "error", + "useOptionalChain": "warn", + "useSimpleNumberKeys": "error", + "useSimplifiedLogicExpression": "error" + }, + "correctness": { + "noChildrenProp": "error", + "noConstantCondition": "error", + "noConstAssign": "error", + "noConstructorReturn": "error", + "noEmptyCharacterClassInRegex": "error", + "noEmptyPattern": "error", + "noGlobalObjectCalls": "error", + "noInnerDeclarations": "error", + "noInvalidConstructorSuper": "error", + "noInvalidNewBuiltin": "error", + "noNewSymbol": "error", + "noNonoctalDecimalEscape": "error", + "noPrecisionLoss": "error", + "noRenderReturnValue": "error", + "noSelfAssign": "error", + "noSetterReturn": "error", + "noStringCaseMismatch": "error", + "noSwitchDeclarations": "error", + "noUndeclaredVariables": "error", + "noUnnecessaryContinue": "error", + "noUnreachable": "error", + "noUnreachableSuper": "error", + "noUnsafeFinally": "error", + "noUnsafeOptionalChaining": "error", + "noUnusedLabels": "error", + "noUnusedVariables": "error", + "noVoidElementsWithChildren": "error", + "noVoidTypeReturn": "error", + "useExhaustiveDependencies": "error", + "useHookAtTopLevel": "error", + "useIsNan": "error", + "useValidForDirection": "error", + "useYield": "error" + }, + "performance": { + "noAccumulatingSpread": "error", + "noDelete": "off" + }, + "security": { + "noDangerouslySetInnerHtml": "error", + "noDangerouslySetInnerHtmlWithChildren": "error" + }, + "style": { + "noArguments": "error", + "noCommaOperator": "off", + "noImplicitBoolean": "error", + "noInferrableTypes": "error", + "noNamespace": "error", + "noNegationElse": "error", + "noNonNullAssertion": "off", + "noParameterAssign": "off", + "noParameterProperties": "off", + "noRestrictedGlobals": "error", + "noShoutyConstants": "error", + "noUnusedTemplateLiteral": "error", + "noUselessElse": "error", + "noVar": "error", + "useAsConstAssertion": "error", + "useBlockStatements": "error", + "useCollapsedElseIf": "error", + "useConst": "error", + "useDefaultParameterLast": "error", + "useEnumInitializers": "error", + "useExponentiationOperator": "error", + "useFragmentSyntax": "error", + "useLiteralEnumMembers": "error", + "useNamingConvention": "off", + "useNumericLiterals": "error", + "useSelfClosingElements": "error", + "useShorthandArrayType": "error", + "useShorthandAssign": "error", + "useSingleCaseStatement": "error", + "useSingleVarDeclarator": "error", + "useTemplate": "off", + "useWhile": "error" + }, + "suspicious": { + "noApproximativeNumericConstant": "error", + "noArrayIndexKey": "error", + "noAssignInExpressions": "error", + "noAsyncPromiseExecutor": "error", + "noCatchAssign": "error", + "noClassAssign": "error", + "noCommentText": "error", + "noCompareNegZero": "error", + "noConfusingLabels": "error", + "noConfusingVoidType": "error", + "noConsoleLog": "warn", + "noConstEnum": "off", + "noControlCharactersInRegex": "error", + "noDebugger": "off", + "noDoubleEquals": "error", + "noDuplicateCase": "error", + "noDuplicateClassMembers": "error", + "noDuplicateJsxProps": "error", + "noDuplicateObjectKeys": "error", + "noDuplicateParameters": "error", + "noEmptyInterface": "error", + "noExplicitAny": "warn", + "noExtraNonNullAssertion": "error", + "noFallthroughSwitchClause": "error", + "noFunctionAssign": "error", + "noGlobalIsFinite": "error", + "noGlobalIsNan": "error", + "noImportAssign": "error", + "noLabelVar": "error", + "noMisleadingInstantiator": "error", + "noMisrefactoredShorthandAssign": "off", + "noPrototypeBuiltins": "error", + "noRedeclare": "error", + "noRedundantUseStrict": "error", + "noSelfCompare": "off", + "noShadowRestrictedNames": "error", + "noSparseArray": "off", + "noUnsafeDeclarationMerging": "error", + "noUnsafeNegation": "error", + "useDefaultSwitchClauseLast": "error", + "useGetterReturn": "error", + "useIsArray": "error", + "useNamespaceKeyword": "error", + "useValidTypeof": "error" + }, + "nursery": { + "noAriaHiddenOnFocusable": "off", + "noDefaultExport": "off", + "noDuplicateJsonKeys": "off", + "noEmptyBlockStatements": "error", + "noImplicitAnyLet": "off", + "noUnusedImports": "error", + "noUnusedPrivateClassMembers": "error", + "noUselessLoneBlockStatements": "error", + "useAwait": "error", + "useGroupedTypeImport": "error", + "useImportRestrictions": "off", + "useRegexLiterals": "error", + "useValidAriaRole": "error" + } + } + }, + "formatter": { + "enabled": true, + "ignore": [ + "node_modules/**/*" + ], + "formatWithErrors": false, + "indentWidth": 2, + "indentStyle": "space", + "lineEnding": "lf", + "lineWidth": 80 + }, + "organizeImports": { + "enabled": true, + "ignore": [ + "node_modules/**/*" + ] + }, + "javascript": { + "formatter": { + "enabled": true, + "arrowParentheses": "asNeeded", + "bracketSameLine": false, + "bracketSpacing": true, + "indentWidth": 2, + "indentStyle": "space", + "jsxQuoteStyle": "double", + "lineEnding": "lf", + "lineWidth": 80, + "quoteProperties": "asNeeded", + "quoteStyle": "single", + "semicolons": "always", + "trailingComma": "all" + }, + "globals": [], + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + }, + "json": { + "formatter": { + "enabled": true, + "indentWidth": 2, + "indentStyle": "space", + "lineEnding": "lf", + "lineWidth": 80 + }, + "parser": { + "allowComments": false, + "allowTrailingCommas": false + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index 8c32d46..fe8ab1b 100644 --- a/package.json +++ b/package.json @@ -47,31 +47,30 @@ "scripts": { "build": "rollup -c", "test": "vitest", - "test:CI": "vitest --no-threads", - "prepublishOnly": "npm run build", - "format": "prettier -w \"{tests,src}/**/*.{js,ts}\"" + "test:CI": "vitest", + "prepublishOnly": "npm run build" }, "devDependencies": { - "@babel/core": "^7.23.2", + "@babel/core": "^7.23.6", + "@biomejs/biome": "^1.4.1", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-typescript": "^11.1.5", - "@types/babel__core": "^7.20.3", - "@types/babel__generator": "^7.6.6", - "@types/babel__traverse": "^7.20.3", - "@types/node": "^20.8.8", - "prettier": "^3.0.3", - "rollup": "^4.1.4", - "solid-js": "^1.8.3", + "@types/babel__core": "^7.20.5", + "@types/babel__generator": "^7.6.8", + "@types/babel__traverse": "^7.20.4", + "@types/node": "^20.10.5", + "rollup": "^4.9.1", + "solid-js": "^1.8.7", "tslib": "^2.6.2", - "typescript": "^5.2.2", - "vitest": "^0.34.6" + "typescript": "^5.3.3", + "vitest": "^1.1.0" }, "peerDependencies": { "solid-js": "^1.3" }, "dependencies": { - "@babel/generator": "^7.23.0", + "@babel/generator": "^7.23.6", "@babel/helper-module-imports": "^7.22.15", - "@babel/types": "^7.23.0" + "@babel/types": "^7.23.6" } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3252b2c..c115685 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,55 +6,55 @@ settings: dependencies: '@babel/generator': - specifier: ^7.23.0 - version: 7.23.0 + specifier: ^7.23.6 + version: 7.23.6 '@babel/helper-module-imports': specifier: ^7.22.15 version: 7.22.15 '@babel/types': - specifier: ^7.23.0 - version: 7.23.0 + specifier: ^7.23.6 + version: 7.23.6 devDependencies: '@babel/core': - specifier: ^7.23.2 - version: 7.23.2 + specifier: ^7.23.6 + version: 7.23.6 + '@biomejs/biome': + specifier: ^1.4.1 + version: 1.4.1 '@rollup/plugin-node-resolve': specifier: ^15.2.3 - version: 15.2.3(rollup@4.1.4) + version: 15.2.3(rollup@4.9.1) '@rollup/plugin-typescript': specifier: ^11.1.5 - version: 11.1.5(rollup@4.1.4)(tslib@2.6.2)(typescript@5.2.2) + version: 11.1.5(rollup@4.9.1)(tslib@2.6.2)(typescript@5.3.3) '@types/babel__core': - specifier: ^7.20.3 - version: 7.20.3 + specifier: ^7.20.5 + version: 7.20.5 '@types/babel__generator': - specifier: ^7.6.6 - version: 7.6.6 + specifier: ^7.6.8 + version: 7.6.8 '@types/babel__traverse': - specifier: ^7.20.3 - version: 7.20.3 + specifier: ^7.20.4 + version: 7.20.4 '@types/node': - specifier: ^20.8.8 - version: 20.8.8 - prettier: - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^20.10.5 + version: 20.10.5 rollup: - specifier: ^4.1.4 - version: 4.1.4 + specifier: ^4.9.1 + version: 4.9.1 solid-js: - specifier: ^1.8.3 - version: 1.8.3 + specifier: ^1.8.7 + version: 1.8.7 tslib: specifier: ^2.6.2 version: 2.6.2 typescript: - specifier: ^5.2.2 - version: 5.2.2 + specifier: ^5.3.3 + version: 5.3.3 vitest: - specifier: ^0.34.6 - version: 0.34.6 + specifier: ^1.1.0 + version: 1.1.0(@types/node@20.10.5) packages: @@ -66,33 +66,33 @@ packages: '@jridgewell/trace-mapping': 0.3.17 dev: true - /@babel/code-frame@7.23.4: - resolution: {integrity: sha512-r1IONyb6Ia+jYR2vvIDhdWdlTGhqbBoFqLTQidzZ4kepUFH15ejXvFHxCVbtl7BOXIudsIubf4E81xeA3h3IXA==} + /@babel/code-frame@7.23.5: + resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} engines: {node: '>=6.9.0'} dependencies: '@babel/highlight': 7.23.4 chalk: 2.4.2 dev: true - /@babel/compat-data@7.23.3: - resolution: {integrity: sha512-BmR4bWbDIoFJmJ9z2cZ8Gmm2MXgEDgjdWgpKmKWUt54UGFJdlj31ECtbaDvCG/qVdG3AQ1SfpZEs01lUFbzLOQ==} + /@babel/compat-data@7.23.5: + resolution: {integrity: sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==} engines: {node: '>=6.9.0'} dev: true - /@babel/core@7.23.2: - resolution: {integrity: sha512-n7s51eWdaWZ3vGT2tD4T7J6eJs3QoBXydv7vkUM06Bf1cbVD2Kc2UrkzhiQwobfV7NwOnQXYL7UBJ5VPU+RGoQ==} + /@babel/core@7.23.6: + resolution: {integrity: sha512-FxpRyGjrMJXh7X3wGLGhNDCRiwpWEF74sKjTLDJSG5Kyvow3QZaG0Adbqzi9ZrVjTWpsX+2cxWXD71NMg93kdw==} engines: {node: '>=6.9.0'} dependencies: '@ampproject/remapping': 2.2.0 - '@babel/code-frame': 7.23.4 - '@babel/generator': 7.23.0 - '@babel/helper-compilation-targets': 7.22.15 - '@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.2) - '@babel/helpers': 7.23.4 - '@babel/parser': 7.23.4 + '@babel/code-frame': 7.23.5 + '@babel/generator': 7.23.6 + '@babel/helper-compilation-targets': 7.23.6 + '@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.6) + '@babel/helpers': 7.23.6 + '@babel/parser': 7.23.6 '@babel/template': 7.22.15 - '@babel/traverse': 7.23.4 - '@babel/types': 7.23.0 + '@babel/traverse': 7.23.6 + '@babel/types': 7.23.6 convert-source-map: 2.0.0 debug: 4.3.4 gensync: 1.0.0-beta.2 @@ -102,32 +102,22 @@ packages: - supports-color dev: true - /@babel/generator@7.23.0: - resolution: {integrity: sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.0 - '@jridgewell/gen-mapping': 0.3.2 - '@jridgewell/trace-mapping': 0.3.17 - jsesc: 2.5.2 - - /@babel/generator@7.23.4: - resolution: {integrity: sha512-esuS49Cga3HcThFNebGhlgsrVLkvhqvYDTzgjfFFlHJcIfLe5jFmRRfCQ1KuBfc4Jrtn3ndLgKWAKjBE+IraYQ==} + /@babel/generator@7.23.6: + resolution: {integrity: sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.4 + '@babel/types': 7.23.6 '@jridgewell/gen-mapping': 0.3.2 '@jridgewell/trace-mapping': 0.3.17 jsesc: 2.5.2 - dev: true - /@babel/helper-compilation-targets@7.22.15: - resolution: {integrity: sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==} + /@babel/helper-compilation-targets@7.23.6: + resolution: {integrity: sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/compat-data': 7.23.3 - '@babel/helper-validator-option': 7.22.15 - browserslist: 4.22.1 + '@babel/compat-data': 7.23.5 + '@babel/helper-validator-option': 7.23.5 + browserslist: 4.22.2 lru-cache: 5.1.1 semver: 6.3.1 dev: true @@ -142,29 +132,29 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.22.15 - '@babel/types': 7.23.0 + '@babel/types': 7.23.6 dev: true /@babel/helper-hoist-variables@7.22.5: resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.6 dev: true /@babel/helper-module-imports@7.22.15: resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.6 - /@babel/helper-module-transforms@7.23.3(@babel/core@7.23.2): + /@babel/helper-module-transforms@7.23.3(@babel/core@7.23.6): resolution: {integrity: sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.23.2 + '@babel/core': 7.23.6 '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-module-imports': 7.22.15 '@babel/helper-simple-access': 7.22.5 @@ -176,14 +166,14 @@ packages: resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.6 dev: true /@babel/helper-split-export-declaration@7.22.6: resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.6 dev: true /@babel/helper-string-parser@7.23.4: @@ -194,18 +184,18 @@ packages: resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} engines: {node: '>=6.9.0'} - /@babel/helper-validator-option@7.22.15: - resolution: {integrity: sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==} + /@babel/helper-validator-option@7.23.5: + resolution: {integrity: sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==} engines: {node: '>=6.9.0'} dev: true - /@babel/helpers@7.23.4: - resolution: {integrity: sha512-HfcMizYz10cr3h29VqyfGL6ZWIjTwWfvYBMsBVGwpcbhNGe3wQ1ZXZRPzZoAHhd9OqHadHqjQ89iVKINXnbzuw==} + /@babel/helpers@7.23.6: + resolution: {integrity: sha512-wCfsbN4nBidDRhpDhvcKlzHWCTlgJYUUdSJfzXb2NuBssDSIjc3xcb+znA7l+zYsFljAcGM0aFkN40cR3lXiGA==} engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.22.15 - '@babel/traverse': 7.23.4 - '@babel/types': 7.23.4 + '@babel/traverse': 7.23.6 + '@babel/types': 7.23.6 transitivePeerDependencies: - supports-color dev: true @@ -219,68 +209,136 @@ packages: js-tokens: 4.0.0 dev: true - /@babel/parser@7.21.2: - resolution: {integrity: sha512-URpaIJQwEkEC2T9Kn+Ai6Xe/02iNaVCuT/PtoRz3GPVJVDpPd7mLo+VddTbhCRU9TXqW5mSrQfXZyi8kDKOVpQ==} + /@babel/parser@7.23.4: + resolution: {integrity: sha512-vf3Xna6UEprW+7t6EtOmFpHNAuxw3xqPZghy+brsnusscJRW5BMUzzHZc5ICjULee81WeUV2jjakG09MDglJXQ==} engines: {node: '>=6.0.0'} hasBin: true dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.6 dev: true - /@babel/parser@7.23.4: - resolution: {integrity: sha512-vf3Xna6UEprW+7t6EtOmFpHNAuxw3xqPZghy+brsnusscJRW5BMUzzHZc5ICjULee81WeUV2jjakG09MDglJXQ==} + /@babel/parser@7.23.6: + resolution: {integrity: sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==} engines: {node: '>=6.0.0'} hasBin: true dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.6 dev: true /@babel/template@7.22.15: resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/code-frame': 7.23.4 - '@babel/parser': 7.23.4 - '@babel/types': 7.23.0 + '@babel/code-frame': 7.23.5 + '@babel/parser': 7.23.6 + '@babel/types': 7.23.6 dev: true - /@babel/traverse@7.23.4: - resolution: {integrity: sha512-IYM8wSUwunWTB6tFC2dkKZhxbIjHoWemdK+3f8/wq8aKhbUscxD5MX72ubd90fxvFknaLPeGw5ycU84V1obHJg==} + /@babel/traverse@7.23.6: + resolution: {integrity: sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/code-frame': 7.23.4 - '@babel/generator': 7.23.4 + '@babel/code-frame': 7.23.5 + '@babel/generator': 7.23.6 '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-function-name': 7.23.0 '@babel/helper-hoist-variables': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 - '@babel/parser': 7.23.4 - '@babel/types': 7.23.4 + '@babel/parser': 7.23.6 + '@babel/types': 7.23.6 debug: 4.3.4 globals: 11.12.0 transitivePeerDependencies: - supports-color dev: true - /@babel/types@7.23.0: - resolution: {integrity: sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==} + /@babel/types@7.23.6: + resolution: {integrity: sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.23.4 '@babel/helper-validator-identifier': 7.22.20 to-fast-properties: 2.0.0 - /@babel/types@7.23.4: - resolution: {integrity: sha512-7uIFwVYpoplT5jp/kVv6EF93VaJ8H+Yn5IczYiaAi98ajzjfoZfslet/e0sLh+wVBjb2qqIut1b0S26VSafsSQ==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/helper-string-parser': 7.23.4 - '@babel/helper-validator-identifier': 7.22.20 - to-fast-properties: 2.0.0 + /@biomejs/biome@1.4.1: + resolution: {integrity: sha512-JccVAwPbhi37pdxbAGmaOBjUTKEwEjWAhl7rKkVVuXHo4MLASXJ5HR8BTgrImi4/7rTBsGz1tgVD1Kwv1CHGRg==} + engines: {node: '>=14.*'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@biomejs/cli-darwin-arm64': 1.4.1 + '@biomejs/cli-darwin-x64': 1.4.1 + '@biomejs/cli-linux-arm64': 1.4.1 + '@biomejs/cli-linux-x64': 1.4.1 + '@biomejs/cli-win32-arm64': 1.4.1 + '@biomejs/cli-win32-x64': 1.4.1 + dev: true + + /@biomejs/cli-darwin-arm64@1.4.1: + resolution: {integrity: sha512-PZWy2Idndqux38p6AXSDQM2ldRAWi32bvb7bMbTN0ALzpWYMYnxd71ornatumSSJYoNhKmxzDLq+jct7nZJ79w==} + engines: {node: '>=14.*'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@biomejs/cli-darwin-x64@1.4.1: + resolution: {integrity: sha512-soj3BWhnsM1M2JlzR09cibUzG1owJqetwj/Oo7yg0foijo9lNH9XWXZfJBYDKgW/6Fomn+CC2EcUS+hisQzt9g==} + engines: {node: '>=14.*'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@biomejs/cli-linux-arm64@1.4.1: + resolution: {integrity: sha512-YIZqfJUg4F+fPsBTXxgD7EU2E5OAYbmYSl/snf4PevwfQCWE/omOFZv+NnIQmjYj9I7ParDgcJvanoA3/kO0JQ==} + engines: {node: '>=14.*'} + cpu: [arm64] + os: [linux] + requiresBuild: true dev: true + optional: true + + /@biomejs/cli-linux-x64@1.4.1: + resolution: {integrity: sha512-9YOZw3qBd/KUj63A6Hn2zZgzGb2nbESM0qNmeMXgmqinVKM//uc4OgY5TuKITuGjMSvcVxxd4dX1IzYjV9qvNQ==} + engines: {node: '>=14.*'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@biomejs/cli-win32-arm64@1.4.1: + resolution: {integrity: sha512-nWQbvkNKxYn/kCQ0yVF8kCaS3VzaGvtFSmItXiMknU4521LDjJ7tNWH12Gol+pIslrCbd4E1LhJa0a3ThRsBVg==} + engines: {node: '>=14.*'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@biomejs/cli-win32-x64@1.4.1: + resolution: {integrity: sha512-88fR2CQxQ4YLs2BUDuywWYQpUKgU3A3sTezANFc/4LGKQFFLV2yX+F7QAdZVkMHfA+RD9Xg178HomM/6mnTNPA==} + engines: {node: '>=14.*'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true - /@esbuild/android-arm64@0.16.17: - resolution: {integrity: sha512-MIGl6p5sc3RDTLLkYL1MyL8BMRN4tLMRCn+yRJJmEDvYZ2M7tmAf80hx1kbNEUX2KJ50RRtxZ4JHLvCfuB6kBg==} + /@esbuild/aix-ppc64@0.19.10: + resolution: {integrity: sha512-Q+mk96KJ+FZ30h9fsJl+67IjNJm3x2eX+GBWGmocAKgzp27cowCOOqSdscX80s0SpdFXZnIv/+1xD1EctFx96Q==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm64@0.19.10: + resolution: {integrity: sha512-1X4CClKhDgC3by7k8aOWZeBXQX8dHT5QAMCAQDArCLaYfkppoARvh0fit3X2Qs+MXDngKcHv6XXyQCpY0hkK1Q==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -288,8 +346,8 @@ packages: dev: true optional: true - /@esbuild/android-arm@0.16.17: - resolution: {integrity: sha512-N9x1CMXVhtWEAMS7pNNONyA14f71VPQN9Cnavj1XQh6T7bskqiLLrSca4O0Vr8Wdcga943eThxnVp3JLnBMYtw==} + /@esbuild/android-arm@0.19.10: + resolution: {integrity: sha512-7W0bK7qfkw1fc2viBfrtAEkDKHatYfHzr/jKAHNr9BvkYDXPcC6bodtm8AyLJNNuqClLNaeTLuwURt4PRT9d7w==} engines: {node: '>=12'} cpu: [arm] os: [android] @@ -297,8 +355,8 @@ packages: dev: true optional: true - /@esbuild/android-x64@0.16.17: - resolution: {integrity: sha512-a3kTv3m0Ghh4z1DaFEuEDfz3OLONKuFvI4Xqczqx4BqLyuFaFkuaG4j2MtA6fuWEFeC5x9IvqnX7drmRq/fyAQ==} + /@esbuild/android-x64@0.19.10: + resolution: {integrity: sha512-O/nO/g+/7NlitUxETkUv/IvADKuZXyH4BHf/g/7laqKC4i/7whLpB0gvpPc2zpF0q9Q6FXS3TS75QHac9MvVWw==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -306,8 +364,8 @@ packages: dev: true optional: true - /@esbuild/darwin-arm64@0.16.17: - resolution: {integrity: sha512-/2agbUEfmxWHi9ARTX6OQ/KgXnOWfsNlTeLcoV7HSuSTv63E4DqtAc+2XqGw1KHxKMHGZgbVCZge7HXWX9Vn+w==} + /@esbuild/darwin-arm64@0.19.10: + resolution: {integrity: sha512-YSRRs2zOpwypck+6GL3wGXx2gNP7DXzetmo5pHXLrY/VIMsS59yKfjPizQ4lLt5vEI80M41gjm2BxrGZ5U+VMA==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -315,8 +373,8 @@ packages: dev: true optional: true - /@esbuild/darwin-x64@0.16.17: - resolution: {integrity: sha512-2By45OBHulkd9Svy5IOCZt376Aa2oOkiE9QWUK9fe6Tb+WDr8hXL3dpqi+DeLiMed8tVXspzsTAvd0jUl96wmg==} + /@esbuild/darwin-x64@0.19.10: + resolution: {integrity: sha512-alfGtT+IEICKtNE54hbvPg13xGBe4GkVxyGWtzr+yHO7HIiRJppPDhOKq3zstTcVf8msXb/t4eavW3jCDpMSmA==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -324,8 +382,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-arm64@0.16.17: - resolution: {integrity: sha512-mt+cxZe1tVx489VTb4mBAOo2aKSnJ33L9fr25JXpqQqzbUIw/yzIzi+NHwAXK2qYV1lEFp4OoVeThGjUbmWmdw==} + /@esbuild/freebsd-arm64@0.19.10: + resolution: {integrity: sha512-dMtk1wc7FSH8CCkE854GyGuNKCewlh+7heYP/sclpOG6Cectzk14qdUIY5CrKDbkA/OczXq9WesqnPl09mj5dg==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -333,8 +391,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-x64@0.16.17: - resolution: {integrity: sha512-8ScTdNJl5idAKjH8zGAsN7RuWcyHG3BAvMNpKOBaqqR7EbUhhVHOqXRdL7oZvz8WNHL2pr5+eIT5c65kA6NHug==} + /@esbuild/freebsd-x64@0.19.10: + resolution: {integrity: sha512-G5UPPspryHu1T3uX8WiOEUa6q6OlQh6gNl4CO4Iw5PS+Kg5bVggVFehzXBJY6X6RSOMS8iXDv2330VzaObm4Ag==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -342,8 +400,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm64@0.16.17: - resolution: {integrity: sha512-7S8gJnSlqKGVJunnMCrXHU9Q8Q/tQIxk/xL8BqAP64wchPCTzuM6W3Ra8cIa1HIflAvDnNOt2jaL17vaW+1V0g==} + /@esbuild/linux-arm64@0.19.10: + resolution: {integrity: sha512-QxaouHWZ+2KWEj7cGJmvTIHVALfhpGxo3WLmlYfJ+dA5fJB6lDEIg+oe/0//FuyVHuS3l79/wyBxbHr0NgtxJQ==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -351,8 +409,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm@0.16.17: - resolution: {integrity: sha512-iihzrWbD4gIT7j3caMzKb/RsFFHCwqqbrbH9SqUSRrdXkXaygSZCZg1FybsZz57Ju7N/SHEgPyaR0LZ8Zbe9gQ==} + /@esbuild/linux-arm@0.19.10: + resolution: {integrity: sha512-j6gUW5aAaPgD416Hk9FHxn27On28H4eVI9rJ4az7oCGTFW48+LcgNDBN+9f8rKZz7EEowo889CPKyeaD0iw9Kg==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -360,8 +418,8 @@ packages: dev: true optional: true - /@esbuild/linux-ia32@0.16.17: - resolution: {integrity: sha512-kiX69+wcPAdgl3Lonh1VI7MBr16nktEvOfViszBSxygRQqSpzv7BffMKRPMFwzeJGPxcio0pdD3kYQGpqQ2SSg==} + /@esbuild/linux-ia32@0.19.10: + resolution: {integrity: sha512-4ub1YwXxYjj9h1UIZs2hYbnTZBtenPw5NfXCRgEkGb0b6OJ2gpkMvDqRDYIDRjRdWSe/TBiZltm3Y3Q8SN1xNg==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -369,8 +427,8 @@ packages: dev: true optional: true - /@esbuild/linux-loong64@0.16.17: - resolution: {integrity: sha512-dTzNnQwembNDhd654cA4QhbS9uDdXC3TKqMJjgOWsC0yNCbpzfWoXdZvp0mY7HU6nzk5E0zpRGGx3qoQg8T2DQ==} + /@esbuild/linux-loong64@0.19.10: + resolution: {integrity: sha512-lo3I9k+mbEKoxtoIbM0yC/MZ1i2wM0cIeOejlVdZ3D86LAcFXFRdeuZmh91QJvUTW51bOK5W2BznGNIl4+mDaA==} engines: {node: '>=12'} cpu: [loong64] os: [linux] @@ -378,8 +436,8 @@ packages: dev: true optional: true - /@esbuild/linux-mips64el@0.16.17: - resolution: {integrity: sha512-ezbDkp2nDl0PfIUn0CsQ30kxfcLTlcx4Foz2kYv8qdC6ia2oX5Q3E/8m6lq84Dj/6b0FrkgD582fJMIfHhJfSw==} + /@esbuild/linux-mips64el@0.19.10: + resolution: {integrity: sha512-J4gH3zhHNbdZN0Bcr1QUGVNkHTdpijgx5VMxeetSk6ntdt+vR1DqGmHxQYHRmNb77tP6GVvD+K0NyO4xjd7y4A==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -387,8 +445,8 @@ packages: dev: true optional: true - /@esbuild/linux-ppc64@0.16.17: - resolution: {integrity: sha512-dzS678gYD1lJsW73zrFhDApLVdM3cUF2MvAa1D8K8KtcSKdLBPP4zZSLy6LFZ0jYqQdQ29bjAHJDgz0rVbLB3g==} + /@esbuild/linux-ppc64@0.19.10: + resolution: {integrity: sha512-tgT/7u+QhV6ge8wFMzaklOY7KqiyitgT1AUHMApau32ZlvTB/+efeCtMk4eXS+uEymYK249JsoiklZN64xt6oQ==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -396,8 +454,8 @@ packages: dev: true optional: true - /@esbuild/linux-riscv64@0.16.17: - resolution: {integrity: sha512-ylNlVsxuFjZK8DQtNUwiMskh6nT0vI7kYl/4fZgV1llP5d6+HIeL/vmmm3jpuoo8+NuXjQVZxmKuhDApK0/cKw==} + /@esbuild/linux-riscv64@0.19.10: + resolution: {integrity: sha512-0f/spw0PfBMZBNqtKe5FLzBDGo0SKZKvMl5PHYQr3+eiSscfJ96XEknCe+JoOayybWUFQbcJTrk946i3j9uYZA==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -405,8 +463,8 @@ packages: dev: true optional: true - /@esbuild/linux-s390x@0.16.17: - resolution: {integrity: sha512-gzy7nUTO4UA4oZ2wAMXPNBGTzZFP7mss3aKR2hH+/4UUkCOyqmjXiKpzGrY2TlEUhbbejzXVKKGazYcQTZWA/w==} + /@esbuild/linux-s390x@0.19.10: + resolution: {integrity: sha512-pZFe0OeskMHzHa9U38g+z8Yx5FNCLFtUnJtQMpwhS+r4S566aK2ci3t4NCP4tjt6d5j5uo4h7tExZMjeKoehAA==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -414,8 +472,8 @@ packages: dev: true optional: true - /@esbuild/linux-x64@0.16.17: - resolution: {integrity: sha512-mdPjPxfnmoqhgpiEArqi4egmBAMYvaObgn4poorpUaqmvzzbvqbowRllQ+ZgzGVMGKaPkqUmPDOOFQRUFDmeUw==} + /@esbuild/linux-x64@0.19.10: + resolution: {integrity: sha512-SpYNEqg/6pZYoc+1zLCjVOYvxfZVZj6w0KROZ3Fje/QrM3nfvT2llI+wmKSrWuX6wmZeTapbarvuNNK/qepSgA==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -423,8 +481,8 @@ packages: dev: true optional: true - /@esbuild/netbsd-x64@0.16.17: - resolution: {integrity: sha512-/PzmzD/zyAeTUsduZa32bn0ORug+Jd1EGGAUJvqfeixoEISYpGnAezN6lnJoskauoai0Jrs+XSyvDhppCPoKOA==} + /@esbuild/netbsd-x64@0.19.10: + resolution: {integrity: sha512-ACbZ0vXy9zksNArWlk2c38NdKg25+L9pr/mVaj9SUq6lHZu/35nx2xnQVRGLrC1KKQqJKRIB0q8GspiHI3J80Q==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -432,8 +490,8 @@ packages: dev: true optional: true - /@esbuild/openbsd-x64@0.16.17: - resolution: {integrity: sha512-2yaWJhvxGEz2RiftSk0UObqJa/b+rIAjnODJgv2GbGGpRwAfpgzyrg1WLK8rqA24mfZa9GvpjLcBBg8JHkoodg==} + /@esbuild/openbsd-x64@0.19.10: + resolution: {integrity: sha512-PxcgvjdSjtgPMiPQrM3pwSaG4kGphP+bLSb+cihuP0LYdZv1epbAIecHVl5sD3npkfYBZ0ZnOjR878I7MdJDFg==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -441,8 +499,8 @@ packages: dev: true optional: true - /@esbuild/sunos-x64@0.16.17: - resolution: {integrity: sha512-xtVUiev38tN0R3g8VhRfN7Zl42YCJvyBhRKw1RJjwE1d2emWTVToPLNEQj/5Qxc6lVFATDiy6LjVHYhIPrLxzw==} + /@esbuild/sunos-x64@0.19.10: + resolution: {integrity: sha512-ZkIOtrRL8SEJjr+VHjmW0znkPs+oJXhlJbNwfI37rvgeMtk3sxOQevXPXjmAPZPigVTncvFqLMd+uV0IBSEzqA==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -450,8 +508,8 @@ packages: dev: true optional: true - /@esbuild/win32-arm64@0.16.17: - resolution: {integrity: sha512-ga8+JqBDHY4b6fQAmOgtJJue36scANy4l/rL97W+0wYmijhxKetzZdKOJI7olaBaMhWt8Pac2McJdZLxXWUEQw==} + /@esbuild/win32-arm64@0.19.10: + resolution: {integrity: sha512-+Sa4oTDbpBfGpl3Hn3XiUe4f8TU2JF7aX8cOfqFYMMjXp6ma6NJDztl5FDG8Ezx0OjwGikIHw+iA54YLDNNVfw==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -459,8 +517,8 @@ packages: dev: true optional: true - /@esbuild/win32-ia32@0.16.17: - resolution: {integrity: sha512-WnsKaf46uSSF/sZhwnqE4L/F89AYNMiD4YtEcYekBt9Q7nj0DiId2XH2Ng2PHM54qi5oPrQ8luuzGszqi/veig==} + /@esbuild/win32-ia32@0.19.10: + resolution: {integrity: sha512-EOGVLK1oWMBXgfttJdPHDTiivYSjX6jDNaATeNOaCOFEVcfMjtbx7WVQwPSE1eIfCp/CaSF2nSrDtzc4I9f8TQ==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -468,8 +526,8 @@ packages: dev: true optional: true - /@esbuild/win32-x64@0.16.17: - resolution: {integrity: sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q==} + /@esbuild/win32-x64@0.19.10: + resolution: {integrity: sha512-whqLG6Sc70AbU73fFYvuYzaE4MNMBIlR1Y/IrUeOXFrWHxBEjjbZaQ3IXIQS8wJdAzue2GwYZCjOrgrU1oUHoA==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -489,7 +547,7 @@ packages: engines: {node: '>=6.0.0'} dependencies: '@jridgewell/set-array': 1.1.2 - '@jridgewell/sourcemap-codec': 1.4.14 + '@jridgewell/sourcemap-codec': 1.4.15 dev: true /@jridgewell/gen-mapping@0.3.2: @@ -497,7 +555,7 @@ packages: engines: {node: '>=6.0.0'} dependencies: '@jridgewell/set-array': 1.1.2 - '@jridgewell/sourcemap-codec': 1.4.14 + '@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/trace-mapping': 0.3.17 /@jridgewell/resolve-uri@3.1.0: @@ -513,7 +571,6 @@ packages: /@jridgewell/sourcemap-codec@1.4.15: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} - dev: true /@jridgewell/trace-mapping@0.3.17: resolution: {integrity: sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==} @@ -521,7 +578,7 @@ packages: '@jridgewell/resolve-uri': 3.1.0 '@jridgewell/sourcemap-codec': 1.4.14 - /@rollup/plugin-node-resolve@15.2.3(rollup@4.1.4): + /@rollup/plugin-node-resolve@15.2.3(rollup@4.9.1): resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} engines: {node: '>=14.0.0'} peerDependencies: @@ -530,16 +587,16 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2(rollup@4.1.4) + '@rollup/pluginutils': 5.0.2(rollup@4.9.1) '@types/resolve': 1.20.2 deepmerge: 4.3.0 is-builtin-module: 3.2.1 is-module: 1.0.0 resolve: 1.22.1 - rollup: 4.1.4 + rollup: 4.9.1 dev: true - /@rollup/plugin-typescript@11.1.5(rollup@4.1.4)(tslib@2.6.2)(typescript@5.2.2): + /@rollup/plugin-typescript@11.1.5(rollup@4.9.1)(tslib@2.6.2)(typescript@5.3.3): resolution: {integrity: sha512-rnMHrGBB0IUEv69Q8/JGRD/n4/n6b3nfpufUu26axhUcboUzv/twfZU8fIBbTOphRAe0v8EyxzeDpKXqGHfyDA==} engines: {node: '>=14.0.0'} peerDependencies: @@ -552,14 +609,14 @@ packages: tslib: optional: true dependencies: - '@rollup/pluginutils': 5.0.2(rollup@4.1.4) + '@rollup/pluginutils': 5.0.2(rollup@4.9.1) resolve: 1.22.1 - rollup: 4.1.4 + rollup: 4.9.1 tslib: 2.6.2 - typescript: 5.2.2 + typescript: 5.3.3 dev: true - /@rollup/pluginutils@5.0.2(rollup@4.1.4): + /@rollup/pluginutils@5.0.2(rollup@4.9.1): resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==} engines: {node: '>=14.0.0'} peerDependencies: @@ -571,99 +628,107 @@ packages: '@types/estree': 1.0.0 estree-walker: 2.0.2 picomatch: 2.3.1 - rollup: 4.1.4 + rollup: 4.9.1 dev: true - /@rollup/rollup-android-arm-eabi@4.1.4: - resolution: {integrity: sha512-WlzkuFvpKl6CLFdc3V6ESPt7gq5Vrimd2Yv9IzKXdOpgbH4cdDSS1JLiACX8toygihtH5OlxyQzhXOph7Ovlpw==} + /@rollup/rollup-android-arm-eabi@4.9.1: + resolution: {integrity: sha512-6vMdBZqtq1dVQ4CWdhFwhKZL6E4L1dV6jUjuBvsavvNJSppzi6dLBbuV+3+IyUREaj9ZFvQefnQm28v4OCXlig==} cpu: [arm] os: [android] requiresBuild: true dev: true optional: true - /@rollup/rollup-android-arm64@4.1.4: - resolution: {integrity: sha512-D1e+ABe56T9Pq2fD+R3ybe1ylCDzu3tY4Qm2Mj24R9wXNCq35+JbFbOpc2yrroO2/tGhTobmEl2Bm5xfE/n8RA==} + /@rollup/rollup-android-arm64@4.9.1: + resolution: {integrity: sha512-Jto9Fl3YQ9OLsTDWtLFPtaIMSL2kwGyGoVCmPC8Gxvym9TCZm4Sie+cVeblPO66YZsYH8MhBKDMGZ2NDxuk/XQ==} cpu: [arm64] os: [android] requiresBuild: true dev: true optional: true - /@rollup/rollup-darwin-arm64@4.1.4: - resolution: {integrity: sha512-7vTYrgEiOrjxnjsgdPB+4i7EMxbVp7XXtS+50GJYj695xYTTEMn3HZVEvgtwjOUkAP/Q4HDejm4fIAjLeAfhtg==} + /@rollup/rollup-darwin-arm64@4.9.1: + resolution: {integrity: sha512-LtYcLNM+bhsaKAIGwVkh5IOWhaZhjTfNOkGzGqdHvhiCUVuJDalvDxEdSnhFzAn+g23wgsycmZk1vbnaibZwwA==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /@rollup/rollup-darwin-x64@4.1.4: - resolution: {integrity: sha512-eGJVZScKSLZkYjhTAESCtbyTBq9SXeW9+TX36ki5gVhDqJtnQ5k0f9F44jNK5RhAMgIj0Ht9+n6HAgH0gUUyWQ==} + /@rollup/rollup-darwin-x64@4.9.1: + resolution: {integrity: sha512-KyP/byeXu9V+etKO6Lw3E4tW4QdcnzDG/ake031mg42lob5tN+5qfr+lkcT/SGZaH2PdW4Z1NX9GHEkZ8xV7og==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm-gnueabihf@4.1.4: - resolution: {integrity: sha512-HnigYSEg2hOdX1meROecbk++z1nVJDpEofw9V2oWKqOWzTJlJf1UXVbDE6Hg30CapJxZu5ga4fdAQc/gODDkKg==} + /@rollup/rollup-linux-arm-gnueabihf@4.9.1: + resolution: {integrity: sha512-Yqz/Doumf3QTKplwGNrCHe/B2p9xqDghBZSlAY0/hU6ikuDVQuOUIpDP/YcmoT+447tsZTmirmjgG3znvSCR0Q==} cpu: [arm] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm64-gnu@4.1.4: - resolution: {integrity: sha512-TzJ+N2EoTLWkaClV2CUhBlj6ljXofaYzF/R9HXqQ3JCMnCHQZmQnbnZllw7yTDp0OG5whP4gIPozR4QiX+00MQ==} + /@rollup/rollup-linux-arm64-gnu@4.9.1: + resolution: {integrity: sha512-u3XkZVvxcvlAOlQJ3UsD1rFvLWqu4Ef/Ggl40WAVCuogf4S1nJPHh5RTgqYFpCOvuGJ7H5yGHabjFKEZGExk5Q==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm64-musl@4.1.4: - resolution: {integrity: sha512-aVPmNMdp6Dlo2tWkAduAD/5TL/NT5uor290YvjvFvCv0Q3L7tVdlD8MOGDL+oRSw5XKXKAsDzHhUOPUNPRHVTQ==} + /@rollup/rollup-linux-arm64-musl@4.9.1: + resolution: {integrity: sha512-0XSYN/rfWShW+i+qjZ0phc6vZ7UWI8XWNz4E/l+6edFt+FxoEghrJHjX1EY/kcUGCnZzYYRCl31SNdfOi450Aw==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-x64-gnu@4.1.4: - resolution: {integrity: sha512-77Fb79ayiDad0grvVsz4/OB55wJRyw9Ao+GdOBA9XywtHpuq5iRbVyHToGxWquYWlEf6WHFQQnFEttsAzboyKg==} + /@rollup/rollup-linux-riscv64-gnu@4.9.1: + resolution: {integrity: sha512-LmYIO65oZVfFt9t6cpYkbC4d5lKHLYv5B4CSHRpnANq0VZUQXGcCPXHzbCXCz4RQnx7jvlYB1ISVNCE/omz5cw==} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-gnu@4.9.1: + resolution: {integrity: sha512-kr8rEPQ6ns/Lmr/hiw8sEVj9aa07gh1/tQF2Y5HrNCCEPiCBGnBUt9tVusrcBBiJfIt1yNaXN6r1CCmpbFEDpg==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-x64-musl@4.1.4: - resolution: {integrity: sha512-/t6C6niEQTqmQTVTD9TDwUzxG91Mlk69/v0qodIPUnjjB3wR4UA3klg+orR2SU3Ux2Cgf2pWPL9utK80/1ek8g==} + /@rollup/rollup-linux-x64-musl@4.9.1: + resolution: {integrity: sha512-t4QSR7gN+OEZLG0MiCgPqMWZGwmeHhsM4AkegJ0Kiy6TnJ9vZ8dEIwHw1LcZKhbHxTY32hp9eVCMdR3/I8MGRw==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-arm64-msvc@4.1.4: - resolution: {integrity: sha512-ZY5BHHrOPkMbCuGWFNpJH0t18D2LU6GMYKGaqaWTQ3CQOL57Fem4zE941/Ek5pIsVt70HyDXssVEFQXlITI5Gg==} + /@rollup/rollup-win32-arm64-msvc@4.9.1: + resolution: {integrity: sha512-7XI4ZCBN34cb+BH557FJPmh0kmNz2c25SCQeT9OiFWEgf8+dL6ZwJ8f9RnUIit+j01u07Yvrsuu1rZGxJCc51g==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-ia32-msvc@4.1.4: - resolution: {integrity: sha512-XG2mcRfFrJvYyYaQmvCIvgfkaGinfXrpkBuIbJrTl9SaIQ8HumheWTIwkNz2mktCKwZfXHQNpO7RgXLIGQ7HXA==} + /@rollup/rollup-win32-ia32-msvc@4.9.1: + resolution: {integrity: sha512-yE5c2j1lSWOH5jp+Q0qNL3Mdhr8WuqCNVjc6BxbVfS5cAS6zRmdiw7ktb8GNpDCEUJphILY6KACoFoRtKoqNQg==} cpu: [ia32] os: [win32] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-x64-msvc@4.1.4: - resolution: {integrity: sha512-ANFqWYPwkhIqPmXw8vm0GpBEHiPpqcm99jiiAp71DbCSqLDhrtr019C5vhD0Bw4My+LmMvciZq6IsWHqQpl2ZQ==} + /@rollup/rollup-win32-x64-msvc@4.9.1: + resolution: {integrity: sha512-PyJsSsafjmIhVgaI1Zdj7m8BB8mMckFah/xbpplObyHfiXzKcI5UOUXRyOdHW7nz4DpMCuzLnF7v5IWHenCwYA==} cpu: [x64] os: [win32] requiresBuild: true @@ -674,99 +739,89 @@ packages: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true - /@types/babel__core@7.20.3: - resolution: {integrity: sha512-54fjTSeSHwfan8AyHWrKbfBWiEUrNTZsUwPTDSNaaP1QDQIZbeNUg3a59E9D+375MzUw/x1vx2/0F5LBz+AeYA==} + /@types/babel__core@7.20.5: + resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} dependencies: - '@babel/parser': 7.21.2 - '@babel/types': 7.23.0 - '@types/babel__generator': 7.6.6 + '@babel/parser': 7.23.4 + '@babel/types': 7.23.6 + '@types/babel__generator': 7.6.8 '@types/babel__template': 7.4.1 - '@types/babel__traverse': 7.20.3 + '@types/babel__traverse': 7.20.4 dev: true - /@types/babel__generator@7.6.6: - resolution: {integrity: sha512-66BXMKb/sUWbMdBNdMvajU7i/44RkrA3z/Yt1c7R5xejt8qh84iU54yUWCtm0QwGJlDcf/gg4zd/x4mpLAlb/w==} + /@types/babel__generator@7.6.8: + resolution: {integrity: sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.6 dev: true /@types/babel__template@7.4.1: resolution: {integrity: sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==} dependencies: '@babel/parser': 7.23.4 - '@babel/types': 7.23.0 - dev: true - - /@types/babel__traverse@7.20.3: - resolution: {integrity: sha512-Lsh766rGEFbaxMIDH7Qa+Yha8cMVI3qAK6CHt3OR0YfxOIn5Z54iHiyDRycHrBqeIiqGa20Kpsv1cavfBKkRSw==} - dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.6 dev: true - /@types/chai-subset@1.3.3: - resolution: {integrity: sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==} + /@types/babel__traverse@7.20.4: + resolution: {integrity: sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==} dependencies: - '@types/chai': 4.3.11 - dev: true - - /@types/chai@4.3.11: - resolution: {integrity: sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==} + '@babel/types': 7.23.6 dev: true /@types/estree@1.0.0: resolution: {integrity: sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==} dev: true - /@types/node@20.8.8: - resolution: {integrity: sha512-YRsdVxq6OaLfmR9Hy816IMp33xOBjfyOgUd77ehqg96CFywxAPbDbXvAsuN2KVg2HOT8Eh6uAfU+l4WffwPVrQ==} + /@types/node@20.10.5: + resolution: {integrity: sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==} dependencies: - undici-types: 5.25.3 + undici-types: 5.26.5 dev: true /@types/resolve@1.20.2: resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} dev: true - /@vitest/expect@0.34.6: - resolution: {integrity: sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==} + /@vitest/expect@1.1.0: + resolution: {integrity: sha512-9IE2WWkcJo2BR9eqtY5MIo3TPmS50Pnwpm66A6neb2hvk/QSLfPXBz2qdiwUOQkwyFuuXEUj5380CbwfzW4+/w==} dependencies: - '@vitest/spy': 0.34.6 - '@vitest/utils': 0.34.6 + '@vitest/spy': 1.1.0 + '@vitest/utils': 1.1.0 chai: 4.3.10 dev: true - /@vitest/runner@0.34.6: - resolution: {integrity: sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==} + /@vitest/runner@1.1.0: + resolution: {integrity: sha512-zdNLJ00pm5z/uhbWF6aeIJCGMSyTyWImy3Fcp9piRGvueERFlQFbUwCpzVce79OLm2UHk9iwaMSOaU9jVHgNVw==} dependencies: - '@vitest/utils': 0.34.6 - p-limit: 4.0.0 + '@vitest/utils': 1.1.0 + p-limit: 5.0.0 pathe: 1.1.1 dev: true - /@vitest/snapshot@0.34.6: - resolution: {integrity: sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==} + /@vitest/snapshot@1.1.0: + resolution: {integrity: sha512-5O/wyZg09V5qmNmAlUgCBqflvn2ylgsWJRRuPrnHEfDNT6tQpQ8O1isNGgo+VxofISHqz961SG3iVvt3SPK/QQ==} dependencies: magic-string: 0.30.5 pathe: 1.1.1 pretty-format: 29.7.0 dev: true - /@vitest/spy@0.34.6: - resolution: {integrity: sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==} + /@vitest/spy@1.1.0: + resolution: {integrity: sha512-sNOVSU/GE+7+P76qYo+VXdXhXffzWZcYIPQfmkiRxaNCSPiLANvQx5Mx6ZURJ/ndtEkUJEpvKLXqAYTKEY+lTg==} dependencies: tinyspy: 2.2.0 dev: true - /@vitest/utils@0.34.6: - resolution: {integrity: sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==} + /@vitest/utils@1.1.0: + resolution: {integrity: sha512-z+s510fKmYz4Y41XhNs3vcuFTFhcij2YF7F8VQfMEYAAUfqQh0Zfg7+w9xdgFGhPf3tX3TicAe+8BDITk6ampQ==} dependencies: diff-sequences: 29.6.3 - loupe: 2.3.6 + loupe: 2.3.7 pretty-format: 29.7.0 dev: true - /acorn-walk@8.2.0: - resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} + /acorn-walk@8.3.1: + resolution: {integrity: sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==} engines: {node: '>=0.4.0'} dev: true @@ -792,15 +847,15 @@ packages: resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} dev: true - /browserslist@4.22.1: - resolution: {integrity: sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==} + /browserslist@4.22.2: + resolution: {integrity: sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001563 - electron-to-chromium: 1.4.589 - node-releases: 2.0.13 - update-browserslist-db: 1.0.13(browserslist@4.22.1) + caniuse-lite: 1.0.30001570 + electron-to-chromium: 1.4.615 + node-releases: 2.0.14 + update-browserslist-db: 1.0.13(browserslist@4.22.2) dev: true /builtin-modules@3.3.0: @@ -813,8 +868,8 @@ packages: engines: {node: '>=8'} dev: true - /caniuse-lite@1.0.30001563: - resolution: {integrity: sha512-na2WUmOxnwIZtwnFI2CZ/3er0wdNzU7hN+cPYz/z2ajHThnkWjNBOpEPP4n+4r2WPM847JaMotaJE3bnfzjyKw==} + /caniuse-lite@1.0.30001570: + resolution: {integrity: sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw==} dev: true /chai@4.3.10: @@ -859,6 +914,15 @@ packages: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} dev: true + /cross-spawn@7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + dev: true + /csstype@3.1.1: resolution: {integrity: sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==} dev: true @@ -892,38 +956,39 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dev: true - /electron-to-chromium@1.4.589: - resolution: {integrity: sha512-zF6y5v/YfoFIgwf2dDfAqVlPPsyQeWNpEWXbAlDUS8Ax4Z2VoiiZpAPC0Jm9hXEkJm2vIZpwB6rc4KnLTQffbQ==} + /electron-to-chromium@1.4.615: + resolution: {integrity: sha512-/bKPPcgZVUziECqDc+0HkT87+0zhaWSZHNXqF8FLd2lQcptpmUFwoCSWjCdOng9Gdq+afKArPdEg/0ZW461Eng==} dev: true - /esbuild@0.16.17: - resolution: {integrity: sha512-G8LEkV0XzDMNwXKgM0Jwu3nY3lSTwSGY6XbxM9cr9+s0T/qSV1q1JVPBGzm3dcjhCic9+emZDmMffkwgPeOeLg==} + /esbuild@0.19.10: + resolution: {integrity: sha512-S1Y27QGt/snkNYrRcswgRFqZjaTG5a5xM3EQo97uNBnH505pdzSNe/HLBq1v0RO7iK/ngdbhJB6mDAp0OK+iUA==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.16.17 - '@esbuild/android-arm64': 0.16.17 - '@esbuild/android-x64': 0.16.17 - '@esbuild/darwin-arm64': 0.16.17 - '@esbuild/darwin-x64': 0.16.17 - '@esbuild/freebsd-arm64': 0.16.17 - '@esbuild/freebsd-x64': 0.16.17 - '@esbuild/linux-arm': 0.16.17 - '@esbuild/linux-arm64': 0.16.17 - '@esbuild/linux-ia32': 0.16.17 - '@esbuild/linux-loong64': 0.16.17 - '@esbuild/linux-mips64el': 0.16.17 - '@esbuild/linux-ppc64': 0.16.17 - '@esbuild/linux-riscv64': 0.16.17 - '@esbuild/linux-s390x': 0.16.17 - '@esbuild/linux-x64': 0.16.17 - '@esbuild/netbsd-x64': 0.16.17 - '@esbuild/openbsd-x64': 0.16.17 - '@esbuild/sunos-x64': 0.16.17 - '@esbuild/win32-arm64': 0.16.17 - '@esbuild/win32-ia32': 0.16.17 - '@esbuild/win32-x64': 0.16.17 + '@esbuild/aix-ppc64': 0.19.10 + '@esbuild/android-arm': 0.19.10 + '@esbuild/android-arm64': 0.19.10 + '@esbuild/android-x64': 0.19.10 + '@esbuild/darwin-arm64': 0.19.10 + '@esbuild/darwin-x64': 0.19.10 + '@esbuild/freebsd-arm64': 0.19.10 + '@esbuild/freebsd-x64': 0.19.10 + '@esbuild/linux-arm': 0.19.10 + '@esbuild/linux-arm64': 0.19.10 + '@esbuild/linux-ia32': 0.19.10 + '@esbuild/linux-loong64': 0.19.10 + '@esbuild/linux-mips64el': 0.19.10 + '@esbuild/linux-ppc64': 0.19.10 + '@esbuild/linux-riscv64': 0.19.10 + '@esbuild/linux-s390x': 0.19.10 + '@esbuild/linux-x64': 0.19.10 + '@esbuild/netbsd-x64': 0.19.10 + '@esbuild/openbsd-x64': 0.19.10 + '@esbuild/sunos-x64': 0.19.10 + '@esbuild/win32-arm64': 0.19.10 + '@esbuild/win32-ia32': 0.19.10 + '@esbuild/win32-x64': 0.19.10 dev: true /escalade@3.1.1: @@ -940,8 +1005,23 @@ packages: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} dev: true - /fsevents@2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + /execa@8.0.1: + resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} + engines: {node: '>=16.17'} + dependencies: + cross-spawn: 7.0.3 + get-stream: 8.0.1 + human-signals: 5.0.0 + is-stream: 3.0.0 + merge-stream: 2.0.0 + npm-run-path: 5.1.0 + onetime: 6.0.0 + signal-exit: 4.1.0 + strip-final-newline: 3.0.0 + dev: true + + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] requiresBuild: true @@ -961,6 +1041,11 @@ packages: resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} dev: true + /get-stream@8.0.1: + resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} + engines: {node: '>=16'} + dev: true + /globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} @@ -978,6 +1063,11 @@ packages: function-bind: 1.1.1 dev: true + /human-signals@5.0.0: + resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} + engines: {node: '>=16.17.0'} + dev: true + /is-builtin-module@3.2.1: resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} engines: {node: '>=6'} @@ -995,6 +1085,15 @@ packages: resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} dev: true + /is-stream@3.0.0: + resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + + /isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + dev: true + /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} dev: true @@ -1014,13 +1113,23 @@ packages: resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==} dev: true - /local-pkg@0.4.3: - resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} + /local-pkg@0.5.0: + resolution: {integrity: sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==} engines: {node: '>=14'} + dependencies: + mlly: 1.4.2 + pkg-types: 1.0.3 dev: true /loupe@2.3.6: resolution: {integrity: sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==} + deprecated: Please upgrade to 2.3.7 which fixes GHSA-4q6p-r6v2-jvc5 + dependencies: + get-func-name: 2.0.2 + dev: true + + /loupe@2.3.7: + resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} dependencies: get-func-name: 2.0.2 dev: true @@ -1038,6 +1147,15 @@ packages: '@jridgewell/sourcemap-codec': 1.4.15 dev: true + /merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + dev: true + + /mimic-fn@4.0.0: + resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} + engines: {node: '>=12'} + dev: true + /mlly@1.4.2: resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} dependencies: @@ -1051,23 +1169,47 @@ packages: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} dev: true - /nanoid@3.3.4: - resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==} + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true dev: true - /node-releases@2.0.13: - resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==} + /node-releases@2.0.14: + resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} dev: true - /p-limit@4.0.0: - resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} + /npm-run-path@5.1.0: + resolution: {integrity: sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + path-key: 4.0.0 + dev: true + + /onetime@6.0.0: + resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} + engines: {node: '>=12'} + dependencies: + mimic-fn: 4.0.0 + dev: true + + /p-limit@5.0.0: + resolution: {integrity: sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==} + engines: {node: '>=18'} dependencies: yocto-queue: 1.0.0 dev: true + /path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + dev: true + + /path-key@4.0.0: + resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} + engines: {node: '>=12'} + dev: true + /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} dev: true @@ -1097,21 +1239,15 @@ packages: pathe: 1.1.1 dev: true - /postcss@8.4.21: - resolution: {integrity: sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==} + /postcss@8.4.32: + resolution: {integrity: sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanoid: 3.3.4 + nanoid: 3.3.7 picocolors: 1.0.0 source-map-js: 1.0.2 dev: true - /prettier@3.0.3: - resolution: {integrity: sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==} - engines: {node: '>=14'} - hasBin: true - dev: true - /pretty-format@29.7.0: resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -1134,32 +1270,25 @@ packages: supports-preserve-symlinks-flag: 1.0.0 dev: true - /rollup@3.19.0: - resolution: {integrity: sha512-xZzJZlH9Ca6cosfdNGPwl2z7Pby8dTi9TrYLPeg6/j7aUoDOhBd706tCUFvbiBj45h/cS7z/a4gS8xd5Yg0jBw==} - engines: {node: '>=14.18.0', npm: '>=8.0.0'} - hasBin: true - optionalDependencies: - fsevents: 2.3.2 - dev: true - - /rollup@4.1.4: - resolution: {integrity: sha512-U8Yk1lQRKqCkDBip/pMYT+IKaN7b7UesK3fLSTuHBoBJacCE+oBqo/dfG/gkUdQNNB2OBmRP98cn2C2bkYZkyw==} + /rollup@4.9.1: + resolution: {integrity: sha512-pgPO9DWzLoW/vIhlSoDByCzcpX92bKEorbgXuZrqxByte3JFk2xSW2JEeAcyLc9Ru9pqcNNW+Ob7ntsk2oT/Xw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.1.4 - '@rollup/rollup-android-arm64': 4.1.4 - '@rollup/rollup-darwin-arm64': 4.1.4 - '@rollup/rollup-darwin-x64': 4.1.4 - '@rollup/rollup-linux-arm-gnueabihf': 4.1.4 - '@rollup/rollup-linux-arm64-gnu': 4.1.4 - '@rollup/rollup-linux-arm64-musl': 4.1.4 - '@rollup/rollup-linux-x64-gnu': 4.1.4 - '@rollup/rollup-linux-x64-musl': 4.1.4 - '@rollup/rollup-win32-arm64-msvc': 4.1.4 - '@rollup/rollup-win32-ia32-msvc': 4.1.4 - '@rollup/rollup-win32-x64-msvc': 4.1.4 - fsevents: 2.3.2 + '@rollup/rollup-android-arm-eabi': 4.9.1 + '@rollup/rollup-android-arm64': 4.9.1 + '@rollup/rollup-darwin-arm64': 4.9.1 + '@rollup/rollup-darwin-x64': 4.9.1 + '@rollup/rollup-linux-arm-gnueabihf': 4.9.1 + '@rollup/rollup-linux-arm64-gnu': 4.9.1 + '@rollup/rollup-linux-arm64-musl': 4.9.1 + '@rollup/rollup-linux-riscv64-gnu': 4.9.1 + '@rollup/rollup-linux-x64-gnu': 4.9.1 + '@rollup/rollup-linux-x64-musl': 4.9.1 + '@rollup/rollup-win32-arm64-msvc': 4.9.1 + '@rollup/rollup-win32-ia32-msvc': 4.9.1 + '@rollup/rollup-win32-x64-msvc': 4.9.1 + fsevents: 2.3.3 dev: true /semver@6.3.1: @@ -1167,20 +1296,37 @@ packages: hasBin: true dev: true - /seroval@0.11.6: - resolution: {integrity: sha512-Lhy+94CNcNza6d0vM4sQKLsaLaX39q0ELqIBc7DkdiFljI8Q387Yb+xKgLxRWXs7uuHRu/ZcJ64xfVJ0Bj4LPg==} + /seroval@0.15.1: + resolution: {integrity: sha512-OPVtf0qmeC7RW+ScVX+7aOS+xoIM7pWcZ0jOWg2aTZigCydgRB04adfteBRbecZnnrO1WuGQ+C3tLeBBzX2zSQ==} engines: {node: '>=10'} dev: true + /shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + dependencies: + shebang-regex: 3.0.0 + dev: true + + /shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + dev: true + /siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} dev: true - /solid-js@1.8.3: - resolution: {integrity: sha512-S7ztgPI6X4tUaWmhZe3aDx0E9F6FGxXVU8NsocrPqqUbxHoFi8eTPlDMcenOlXuo2ITQ97j2URaj0StfJci4KQ==} + /signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + dev: true + + /solid-js@1.8.7: + resolution: {integrity: sha512-9dzrSVieh2zj3SnJ02II6xZkonR6c+j/91b7XZUNcC6xSaldlqjjGh98F1fk5cRJ8ZTkzqF5fPIWDxEOs6QZXA==} dependencies: csstype: 3.1.1 - seroval: 0.11.6 + seroval: 0.15.1 dev: true /source-map-js@1.0.2: @@ -1196,8 +1342,13 @@ packages: resolution: {integrity: sha512-JGUEaALvL0Mf6JCfYnJOTcobY+Nc7sG/TemDRBqCA0wEr4DER7zDchaaixTlmOxAjG1uRJmX82EQcxwTQTkqVA==} dev: true - /strip-literal@1.0.1: - resolution: {integrity: sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==} + /strip-final-newline@3.0.0: + resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} + engines: {node: '>=12'} + dev: true + + /strip-literal@1.3.0: + resolution: {integrity: sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==} dependencies: acorn: 8.11.2 dev: true @@ -1218,8 +1369,8 @@ packages: resolution: {integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==} dev: true - /tinypool@0.7.0: - resolution: {integrity: sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==} + /tinypool@0.8.1: + resolution: {integrity: sha512-zBTCK0cCgRROxvs9c0CGK838sPkeokNGdQVUUwHAbynHFlmyJYj825f/oRs528HaIJ97lo0pLIlDUzwN+IorWg==} engines: {node: '>=14.0.0'} dev: true @@ -1241,8 +1392,8 @@ packages: engines: {node: '>=4'} dev: true - /typescript@5.2.2: - resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} + /typescript@5.3.3: + resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} engines: {node: '>=14.17'} hasBin: true dev: true @@ -1251,35 +1402,35 @@ packages: resolution: {integrity: sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==} dev: true - /undici-types@5.25.3: - resolution: {integrity: sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==} + /undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} dev: true - /update-browserslist-db@1.0.13(browserslist@4.22.1): + /update-browserslist-db@1.0.13(browserslist@4.22.2): resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} hasBin: true peerDependencies: browserslist: '>= 4.21.0' dependencies: - browserslist: 4.22.1 + browserslist: 4.22.2 escalade: 3.1.1 picocolors: 1.0.0 dev: true - /vite-node@0.34.6(@types/node@20.8.8): - resolution: {integrity: sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==} - engines: {node: '>=v14.18.0'} + /vite-node@1.1.0(@types/node@20.10.5): + resolution: {integrity: sha512-jV48DDUxGLEBdHCQvxL1mEh7+naVy+nhUUUaPAZLd3FJgXuxQiewHcfeZebbJ6onDqNGkP4r3MhQ342PRlG81Q==} + engines: {node: ^18.0.0 || >=20.0.0} hasBin: true dependencies: cac: 6.7.14 debug: 4.3.4 - mlly: 1.4.2 pathe: 1.1.1 picocolors: 1.0.0 - vite: 4.1.1(@types/node@20.8.8) + vite: 5.0.10(@types/node@20.10.5) transitivePeerDependencies: - '@types/node' - less + - lightningcss - sass - stylus - sugarss @@ -1287,13 +1438,14 @@ packages: - terser dev: true - /vite@4.1.1(@types/node@20.8.8): - resolution: {integrity: sha512-LM9WWea8vsxhr782r9ntg+bhSFS06FJgCvvB0+8hf8UWtvaiDagKYWXndjfX6kGl74keHJUcpzrQliDXZlF5yg==} - engines: {node: ^14.18.0 || >=16.0.0} + /vite@5.0.10(@types/node@20.10.5): + resolution: {integrity: sha512-2P8J7WWgmc355HUMlFrwofacvr98DAjoE52BfdbwQtyLH06XKwaL/FMnmKM2crF0iX4MpmMKoDlNCB1ok7zHCw==} + engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: - '@types/node': '>= 14' + '@types/node': ^18.0.0 || >=20.0.0 less: '*' + lightningcss: ^1.21.0 sass: '*' stylus: '*' sugarss: '*' @@ -1303,6 +1455,8 @@ packages: optional: true less: optional: true + lightningcss: + optional: true sass: optional: true stylus: @@ -1312,31 +1466,30 @@ packages: terser: optional: true dependencies: - '@types/node': 20.8.8 - esbuild: 0.16.17 - postcss: 8.4.21 - resolve: 1.22.1 - rollup: 3.19.0 + '@types/node': 20.10.5 + esbuild: 0.19.10 + postcss: 8.4.32 + rollup: 4.9.1 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true - /vitest@0.34.6: - resolution: {integrity: sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==} - engines: {node: '>=v14.18.0'} + /vitest@1.1.0(@types/node@20.10.5): + resolution: {integrity: sha512-oDFiCrw7dd3Jf06HoMtSRARivvyjHJaTxikFxuqJjO76U436PqlVw1uLn7a8OSPrhSfMGVaRakKpA2lePdw79A==} + engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' - '@vitest/browser': '*' - '@vitest/ui': '*' + '@types/node': ^18.0.0 || >=20.0.0 + '@vitest/browser': ^1.0.0 + '@vitest/ui': ^1.0.0 happy-dom: '*' jsdom: '*' - playwright: '*' - safaridriver: '*' - webdriverio: '*' peerDependenciesMeta: '@edge-runtime/vm': optional: true + '@types/node': + optional: true '@vitest/browser': optional: true '@vitest/ui': @@ -1345,39 +1498,32 @@ packages: optional: true jsdom: optional: true - playwright: - optional: true - safaridriver: - optional: true - webdriverio: - optional: true dependencies: - '@types/chai': 4.3.11 - '@types/chai-subset': 1.3.3 - '@types/node': 20.8.8 - '@vitest/expect': 0.34.6 - '@vitest/runner': 0.34.6 - '@vitest/snapshot': 0.34.6 - '@vitest/spy': 0.34.6 - '@vitest/utils': 0.34.6 - acorn: 8.11.2 - acorn-walk: 8.2.0 + '@types/node': 20.10.5 + '@vitest/expect': 1.1.0 + '@vitest/runner': 1.1.0 + '@vitest/snapshot': 1.1.0 + '@vitest/spy': 1.1.0 + '@vitest/utils': 1.1.0 + acorn-walk: 8.3.1 cac: 6.7.14 chai: 4.3.10 debug: 4.3.4 - local-pkg: 0.4.3 + execa: 8.0.1 + local-pkg: 0.5.0 magic-string: 0.30.5 pathe: 1.1.1 picocolors: 1.0.0 std-env: 3.5.0 - strip-literal: 1.0.1 + strip-literal: 1.3.0 tinybench: 2.5.1 - tinypool: 0.7.0 - vite: 4.1.1(@types/node@20.8.8) - vite-node: 0.34.6(@types/node@20.8.8) + tinypool: 0.8.1 + vite: 5.0.10(@types/node@20.10.5) + vite-node: 1.1.0(@types/node@20.10.5) why-is-node-running: 2.2.2 transitivePeerDependencies: - less + - lightningcss - sass - stylus - sugarss @@ -1385,6 +1531,14 @@ packages: - terser dev: true + /which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + dependencies: + isexe: 2.0.0 + dev: true + /why-is-node-running@2.2.2: resolution: {integrity: sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==} engines: {node: '>=8'} diff --git a/rollup.config.js b/rollup.config.js index e419cec..18d673c 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,35 +1,41 @@ -import nodeResolve from "@rollup/plugin-node-resolve"; -import typescript from '@rollup/plugin-typescript' +import nodeResolve from '@rollup/plugin-node-resolve'; +import typescript from '@rollup/plugin-typescript'; export default [ { input: 'src/runtime/index.ts', - output: [{ - file: 'dist/solid-refresh.cjs', - format: 'cjs' - }, { - file: 'dist/solid-refresh.mjs', - format: 'es' - }], + output: [ + { + file: 'dist/solid-refresh.cjs', + format: 'cjs', + }, + { + file: 'dist/solid-refresh.mjs', + format: 'es', + }, + ], external: ['solid-js'], - plugins: [ - nodeResolve(), - typescript(), - ] + plugins: [nodeResolve(), typescript()], }, { input: 'src/babel/index.ts', - output: [{ - file: './dist/babel.cjs', - format: 'cjs', - }, { - file: './dist/babel.mjs', - format: 'es' - }], - external: ['@babel/core', '@babel/types', '@babel/helper-module-imports', '@babel/generator', 'crypto'], - plugins: [ - nodeResolve(), - typescript(), - ] - } -]; \ No newline at end of file + output: [ + { + file: './dist/babel.cjs', + format: 'cjs', + }, + { + file: './dist/babel.mjs', + format: 'es', + }, + ], + external: [ + '@babel/core', + '@babel/types', + '@babel/helper-module-imports', + '@babel/generator', + 'crypto', + ], + plugins: [nodeResolve(), typescript()], + }, +]; diff --git a/src/babel/index.ts b/src/babel/index.ts index df12d1d..33e8ceb 100644 --- a/src/babel/index.ts +++ b/src/babel/index.ts @@ -66,10 +66,14 @@ const IMPORTS = { refresh: '$$refresh', component: '$$component', context: '$$context', - decline: '$$decline' + decline: '$$decline', }; -function getSolidRefreshIdentifier(state: State, path: babel.NodePath, name: string): t.Identifier { +function getSolidRefreshIdentifier( + state: State, + path: babel.NodePath, + name: string, +): t.Identifier { const target = `${name}`; const current = state.hooks.get(target); if (current) { @@ -86,7 +90,7 @@ function getHotIdentifier(state: State): t.MemberExpression { if (isESMHMR(bundler)) { return t.memberExpression( t.memberExpression(t.identifier('import'), t.identifier('meta')), - t.identifier('hot') + t.identifier('hot'), ); } // webpack 5 uses `import.meta.webpackHot` @@ -94,20 +98,27 @@ function getHotIdentifier(state: State): t.MemberExpression { if (bundler === 'webpack5' || bundler === 'rspack-esm') { return t.memberExpression( t.memberExpression(t.identifier('import'), t.identifier('meta')), - t.identifier('webpackHot') + t.identifier('webpackHot'), ); } // `module.hot` is the default. return t.memberExpression(t.identifier('module'), t.identifier('hot')); } -function generateViteRequirement(state: State, statements: t.Statement[], pathToHot: t.Expression) { +function generateViteRequirement( + state: State, + statements: t.Statement[], + pathToHot: t.Expression, +) { if (state.opts.bundler === 'vite') { // Vite requires that the owner module has an `import.meta.hot.accept()` call statements.push( t.expressionStatement( - t.callExpression(t.memberExpression(pathToHot, t.identifier('accept')), []) - ) + t.callExpression( + t.memberExpression(pathToHot, t.identifier('accept')), + [], + ), + ), ); } } @@ -116,11 +127,11 @@ function getHMRDeclineCall(state: State, path: babel.NodePath) { const pathToHot = getHotIdentifier(state); const statements = [ t.expressionStatement( - t.callExpression(getSolidRefreshIdentifier(state, path, IMPORTS.decline), [ - t.stringLiteral(state.opts.bundler ?? 'standard'), - pathToHot - ]) - ) + t.callExpression( + getSolidRefreshIdentifier(state, path, IMPORTS.decline), + [t.stringLiteral(state.opts.bundler ?? 'standard'), pathToHot], + ), + ), ]; generateViteRequirement(state, statements, pathToHot); @@ -150,23 +161,29 @@ function createRegistry(state: State, path: babel.NodePath): t.Identifier { program.push({ id: identifier, kind: 'const', - init: t.callExpression(getSolidRefreshIdentifier(state, path, IMPORTS.registry), []) + init: t.callExpression( + getSolidRefreshIdentifier(state, path, IMPORTS.registry), + [], + ), }); const pathToHot = getHotIdentifier(state); const statements: t.Statement[] = [ t.expressionStatement( - t.callExpression(getSolidRefreshIdentifier(state, path, IMPORTS.refresh), [ - t.stringLiteral(state.opts.bundler ?? 'standard'), - pathToHot, - identifier - ]) - ) + t.callExpression( + getSolidRefreshIdentifier(state, path, IMPORTS.refresh), + [ + t.stringLiteral(state.opts.bundler ?? 'standard'), + pathToHot, + identifier, + ], + ), + ), ]; generateViteRequirement(state, statements, pathToHot); (program.path as babel.NodePath).pushContainer('body', [ - t.ifStatement(pathToHot, t.blockStatement(statements)) + t.ifStatement(pathToHot, t.blockStatement(statements)), ]); state.hooks.set(REGISTRY, identifier); return identifier; @@ -178,7 +195,11 @@ function createSignatureValue(node: t.Node): string { return result; } -function isForeignBinding(source: babel.NodePath, current: babel.NodePath, name: string): boolean { +function isForeignBinding( + source: babel.NodePath, + current: babel.NodePath, + name: string, +): boolean { if (source === current) { return true; } @@ -202,37 +223,15 @@ function isInTypescript(path: babel.NodePath): boolean { return false; } -function isIdentifierReserved(node: t.Identifier) { - switch (node.name) { - case 'undefined': - case 'NaN': - case 'Infinity': - return true; - default: - return false; - } -} - function getBindings(path: babel.NodePath): t.Identifier[] { const identifiers = new Set(); path.traverse({ - Expression(p) { + ReferencedIdentifier(p) { // Check identifiers that aren't in a TS expression - if (t.isIdentifier(p.node) && !isIdentifierReserved(p.node) && !isInTypescript(p) && isForeignBinding(path, p, p.node.name)) { + if (!isInTypescript(p) && isForeignBinding(path, p, p.node.name)) { identifiers.add(p.node.name); } - // for the JSX, only use JSXMemberExpression's object - // as a foreign binding - if (t.isJSXElement(p.node) && t.isJSXMemberExpression(p.node.openingElement.name)) { - let base: t.JSXMemberExpression | t.JSXIdentifier = p.node.openingElement.name; - while (t.isJSXMemberExpression(base)) { - base = base.object; - } - if (isForeignBinding(path, p, base.name)) { - identifiers.add(base.name); - } - } - } + }, }); const collected = []; for (const identifier of identifiers) { @@ -249,8 +248,18 @@ interface ImportIdentity { } const IMPORT_IDENTITIES: ImportIdentity[] = [ - { type: 'createContext', name: 'createContext', kind: 'named', source: 'solid-js' }, - { type: 'createContext', name: 'createContext', kind: 'named',source: 'solid-js/web' }, + { + type: 'createContext', + name: 'createContext', + kind: 'named', + source: 'solid-js', + }, + { + type: 'createContext', + name: 'createContext', + kind: 'named', + source: 'solid-js/web', + }, { type: 'render', name: 'render', kind: 'named', source: 'solid-js/web' }, { type: 'render', name: 'hydrate', kind: 'named', source: 'solid-js/web' }, ]; @@ -261,55 +270,58 @@ function getImportSpecifierName(specifier: t.ImportSpecifier): string { return specifier.imported.name; case 'StringLiteral': return specifier.imported.value; - default: - return ''; } } function registerImportSpecifier( state: State, - p: babel.NodePath, + id: ImportIdentity, + specifier: + | t.ImportDefaultSpecifier + | t.ImportNamespaceSpecifier + | t.ImportSpecifier, ) { - let id: ImportIdentity; - let specifier: (babel.types.ImportDefaultSpecifier | babel.types.ImportNamespaceSpecifier | babel.types.ImportSpecifier); + switch (specifier.type) { + case 'ImportDefaultSpecifier': { + if (id.kind === 'default') { + state.registrations.identifiers.set(specifier.local, id); + } + break; + } + case 'ImportSpecifier': { + if ( + (id.kind === 'named' && + getImportSpecifierName(specifier) === id.name) || + (id.kind === 'default' && + getImportSpecifierName(specifier) === 'default') + ) { + state.registrations.identifiers.set(specifier.local, id); + } + break; + } + case 'ImportNamespaceSpecifier': { + let current = state.registrations.namespaces.get(specifier.local); + if (!current) { + current = []; + } + current.push(id); + state.registrations.namespaces.set(specifier.local, current); + break; + } + default: + break; + } +} +function registerImportSpecifiers( + state: State, + p: babel.NodePath, +) { for (let i = 0, len = state.imports.length; i < len; i++) { - id = state.imports[i]; + const id = state.imports[i]; if (p.node.source.value === id.source) { for (let k = 0, klen = p.node.specifiers.length; k < klen; k++) { - specifier = p.node.specifiers[k]; - - switch (specifier.type) { - case 'ImportDefaultSpecifier': - if (id.kind === 'default') { - state.registrations.identifiers.set(specifier.local, id); - } - break; - case 'ImportSpecifier': - if ( - ( - id.kind === 'named' - && getImportSpecifierName(specifier) === id.name - ) - || ( - id.kind === 'default' - && getImportSpecifierName(specifier) === 'default' - ) - ) { - state.registrations.identifiers.set(specifier.local, id); - } - break; - case 'ImportNamespaceSpecifier': - let current = state.registrations.namespaces.get(specifier.local); - if (!current) { - current = []; - } - current.push(id); - state.registrations.namespaces.set(specifier.local, current); - break; - default: - break; - } + registerImportSpecifier(state, id, p.node.specifiers[k]); } } } @@ -319,19 +331,18 @@ function captureIdentifiers(state: State, path: babel.NodePath) { path.traverse({ ImportDeclaration(p) { if (p.node.importKind === 'value') { - registerImportSpecifier(state, p); + registerImportSpecifiers(state, p); } - } + }, }); } -type TypeCheck = K extends ((node: t.Expression) => node is infer U extends t.Expression) - ? U - : never; +type TypeFilter = (node: t.Expression) => node is K; +type TypeCheck = K extends TypeFilter ? U : never; function unwrapExpression boolean>( node: t.Expression, - key: K + key: K, ): TypeCheck | undefined { switch (node.type) { case 'ParenthesizedExpression': @@ -343,11 +354,71 @@ function unwrapExpression boolean>( case 'TSTypeAssertion': return unwrapExpression(node.expression, key); default: - if (key(node)) { - return node as TypeCheck; + return key(node) ? (node as TypeCheck) : undefined; + } +} + +function isIdentifierValidCallee( + state: State, + path: babel.NodePath, + callee: t.Identifier, + target: ImportIdentity['type'], +): boolean { + const binding = path.scope.getBindingIdentifier(callee.name); + if (binding) { + const result = state.registrations.identifiers.get(binding); + if (result && result.type === target) { + return true; + } + } + return false; +} + +function isPropertyValidCallee( + result: ImportIdentity[], + target: ImportIdentity['type'], + propName: string, +): boolean { + for (let i = 0, len = result.length; i < len; i++) { + const registration = result[i]; + if (registration.type === target) { + if (registration.kind === 'default') { + if (propName === 'default') { + return true; + } + } else if ( + registration.kind === 'named' && + registration.name === propName + ) { + return true; } - return undefined; + } } + return false; +} + +function isMemberExpressionValidCallee( + state: State, + path: babel.NodePath, + member: t.MemberExpression, + target: ImportIdentity['type'], +): boolean { + if (!t.isIdentifier(member.property)) { + return false; + } + const trueObject = unwrapExpression(member.object, t.isIdentifier); + if (!trueObject) { + return false; + } + const binding = path.scope.getBindingIdentifier(trueObject.name); + if (!binding) { + return false; + } + const result = state.registrations.namespaces.get(binding); + if (!result) { + return false; + } + return isPropertyValidCallee(result, target, member.property.name); } function isValidCallee( @@ -361,39 +432,11 @@ function isValidCallee( } const trueCallee = unwrapExpression(callee, t.isIdentifier); if (trueCallee) { - const binding = path.scope.getBindingIdentifier(trueCallee.name); - if (binding) { - const result = state.registrations.identifiers.get(binding); - if (result && result.type === target) { - return true; - } - } - return false; + return isIdentifierValidCallee(state, path, trueCallee, target); } const trueMember = unwrapExpression(callee, t.isMemberExpression); - if (trueMember && !trueMember.computed && t.isIdentifier(trueMember.property)) { - const trueObject = unwrapExpression(trueMember.object, t.isIdentifier); - if (trueObject) { - const binding = path.scope.getBindingIdentifier(trueObject.name); - if (binding) { - const result = state.registrations.namespaces.get(binding); - if (result) { - const propName = trueMember.property.name; - for (let i = 0, len = result.length; i < len; i++) { - const registration = result[i]; - if (registration.type === target) { - if (registration.kind === 'default') { - if (propName === 'default') { - return true; - } - } else if (registration.kind === 'named' && registration.name === propName) { - return true; - } - } - } - } - } - } + if (trueMember && !trueMember.computed) { + return isMemberExpressionValidCallee(state, path, trueMember, target); } return false; @@ -418,29 +461,37 @@ function checkValidRenderCall(path: babel.NodePath): boolean { function fixRenderCalls(state: State, path: babel.NodePath) { path.traverse({ ExpressionStatement(p) { - const trueCallExpr = unwrapExpression(p.node.expression, t.isCallExpression); + const trueCallExpr = unwrapExpression( + p.node.expression, + t.isCallExpression, + ); if ( trueCallExpr && checkValidRenderCall(p) && - (isValidCallee(state, p, trueCallExpr, 'render')) + isValidCallee(state, p, trueCallExpr, 'render') ) { // Replace with variable declaration const id = p.scope.generateUidIdentifier('cleanup'); p.replaceWith( - t.variableDeclaration('const', [t.variableDeclarator(id, p.node.expression)]) + t.variableDeclaration('const', [ + t.variableDeclarator(id, p.node.expression), + ]), ); const pathToHot = getHotIdentifier(state); p.insertAfter( t.ifStatement( pathToHot, t.expressionStatement( - t.callExpression(t.memberExpression(pathToHot, t.identifier('dispose')), [id]) - ) - ) + t.callExpression( + t.memberExpression(pathToHot, t.identifier('dispose')), + [id], + ), + ), + ), ); p.skip(); } - } + }, }); } @@ -449,29 +500,35 @@ function wrapComponent( path: babel.NodePath, identifier: t.Identifier, component: t.FunctionExpression | t.ArrowFunctionExpression, - original: t.Node = component + original: t.Node = component, ) { const statementPath = getStatementPath(path); if (statementPath) { const registry = createRegistry(state, statementPath); const hotName = t.stringLiteral(identifier.name); - const componentCall = getSolidRefreshIdentifier(state, statementPath, IMPORTS.component); + const componentCall = getSolidRefreshIdentifier( + state, + statementPath, + IMPORTS.component, + ); const properties: t.ObjectProperty[] = []; if (state.filename && original.loc) { const filePath = getFile(state.filename); properties.push( t.objectProperty( t.identifier('location'), - t.stringLiteral(`${filePath}:${original.loc.start.line}:${original.loc.start.column}`) - ) + t.stringLiteral( + `${filePath}:${original.loc.start.line}:${original.loc.start.column}`, + ), + ), ); } if (state.granular) { properties.push( t.objectProperty( t.identifier('signature'), - t.stringLiteral(createSignatureValue(component)) - ) + t.stringLiteral(createSignatureValue(component)), + ), ); const dependencies = getBindings(path); if (dependencies.length) { @@ -484,22 +541,22 @@ function wrapComponent( properties.push( t.objectProperty( t.identifier('dependencies'), - t.objectExpression(dependencyKeys) - ) + t.objectExpression(dependencyKeys), + ), ); } return t.callExpression(componentCall, [ registry, hotName, component, - t.objectExpression(properties) + t.objectExpression(properties), ]); } return t.callExpression(componentCall, [ registry, hotName, component, - ...(properties.length ? [t.objectExpression(properties)] : []) + ...(properties.length ? [t.objectExpression(properties)] : []), ]); } return component; @@ -509,19 +566,138 @@ function wrapContext( state: State, path: babel.NodePath, identifier: t.Identifier, - context: t.CallExpression + context: t.CallExpression, ) { const statementPath = getStatementPath(path); if (statementPath) { const registry = createRegistry(state, statementPath); const hotName = t.stringLiteral(identifier.name); - const contextCall = getSolidRefreshIdentifier(state, statementPath, IMPORTS.context); + const contextCall = getSolidRefreshIdentifier( + state, + statementPath, + IMPORTS.context, + ); return t.callExpression(contextCall, [registry, hotName, context]); } return context; } +function setupProgram(state: State, path: babel.NodePath): void { + let shouldSkip = false; + const comments = state.file.ast.comments; + if (comments) { + for (let i = 0; i < comments.length; i++) { + const comment = comments[i].value; + if (/^\s*@refresh granular\s*$/.test(comment)) { + state.granular = true; + break; + } + if (/^\s*@refresh skip\s*$/.test(comment)) { + state.processed = true; + shouldSkip = true; + break; + } + if (/^\s*@refresh reload\s*$/.test(comment)) { + state.processed = true; + path.pushContainer('body', getHMRDeclineCall(state, path)); + break; + } + } + } + + captureIdentifiers(state, path); + if (!shouldSkip && (state.opts.fixRender ?? true)) { + fixRenderCalls(state, path); + } +} + +function transformExportNamedDeclaration( + state: State, + path: babel.NodePath, +): void { + if (state.processed) { + return; + } + const decl = path.node.declaration; + // Check if declaration is FunctionDeclaration + if ( + t.isFunctionDeclaration(decl) && + !(decl.generator || decl.async) && + // Might be component-like, but the only valid components + // have zero or one parameter + decl.params.length < 2 + ) { + // Check if the declaration has an identifier, and then check + // if the name is component-ish + if (decl.id && isComponentishName(decl.id.name)) { + path.node.declaration = t.variableDeclaration('const', [ + t.variableDeclarator( + decl.id, + wrapComponent( + state, + path, + decl.id, + t.functionExpression(decl.id, decl.params, decl.body), + decl, + ), + ), + ]); + } + } +} + +function isStatementTopLevel(path: babel.NodePath): boolean { + const programParent = path.scope.getProgramParent(); + const blockParent = path.scope.getBlockParent(); + + return programParent === blockParent; +} + +function transformVariableDeclarator( + state: State, + path: babel.NodePath, +): void { + if (state.processed) { + return; + } + if ( + path.parentPath.isVariableDeclaration() && + !isStatementTopLevel(path.parentPath) + ) { + return; + } + const identifier = path.node.id; + const init = path.node.init; + if (!(init && t.isIdentifier(identifier))) { + return; + } + if (isComponentishName(identifier.name)) { + const trueFuncExpr = + unwrapExpression(init, t.isFunctionExpression) || + unwrapExpression(init, t.isArrowFunctionExpression); + // Check for valid FunctionExpression or ArrowFunctionExpression + if ( + trueFuncExpr && + // Must not be async or generator + !(trueFuncExpr.async || trueFuncExpr.generator) && + // Might be component-like, but the only valid components + // have zero or one parameter + trueFuncExpr.params.length < 2 + ) { + path.node.init = wrapComponent(state, path, identifier, trueFuncExpr); + } + } + // For `createContext` calls + const trueCallExpr = unwrapExpression(init, t.isCallExpression); + if ( + trueCallExpr && + isValidCallee(state, path, trueCallExpr, 'createContext') + ) { + path.node.init = wrapContext(state, path, identifier, trueCallExpr); + } +} + export default function solidRefreshPlugin(): babel.PluginObj { return { name: 'Solid Refresh', @@ -531,114 +707,28 @@ export default function solidRefreshPlugin(): babel.PluginObj { this.granular = false; this.registrations = { identifiers: new Map(), - namespaces: new Map() + namespaces: new Map(), }; - this.imports = [ - ...IMPORT_IDENTITIES, - ...(this.opts.imports || []), - ]; + this.imports = [...IMPORT_IDENTITIES, ...(this.opts.imports || [])]; }, visitor: { Program(path, state) { - let shouldSkip = false; - const comments = state.file.ast.comments; - if (comments) { - for (let i = 0; i < comments.length; i++) { - const comment = comments[i].value; - if (/^\s*@refresh granular\s*$/.test(comment)) { - state.granular = true; - break; - } - if (/^\s*@refresh skip\s*$/.test(comment)) { - state.processed = true; - shouldSkip = true; - break; - } - if (/^\s*@refresh reload\s*$/.test(comment)) { - state.processed = true; - path.pushContainer('body', getHMRDeclineCall(state, path)); - break; - } - } - } - - captureIdentifiers(state, path); - if (!shouldSkip && (state.opts.fixRender ?? true)) { - fixRenderCalls(state, path); - } + setupProgram(state, path); }, ExportNamedDeclaration(path, state) { - if (state.processed) { - return; - } - const decl = path.node.declaration; - // Check if declaration is FunctionDeclaration - if ( - t.isFunctionDeclaration(decl) && - !(decl.generator || decl.async) && - // Might be component-like, but the only valid components - // have zero or one parameter - decl.params.length < 2 - ) { - // Check if the declaration has an identifier, and then check - // if the name is component-ish - if (decl.id && isComponentishName(decl.id.name)) { - path.node.declaration = t.variableDeclaration('const', [ - t.variableDeclarator( - decl.id, - wrapComponent( - state, - path, - decl.id, - t.functionExpression(decl.id, decl.params, decl.body), - decl - ) - ) - ]); - } - } + transformExportNamedDeclaration(state, path); }, VariableDeclarator(path, state) { - if (state.processed) { - return; - } - const grandParentNode = path.parentPath?.parentPath?.node; - // Check if the parent of the VariableDeclaration - // is either a Program or an ExportNamedDeclaration - if (t.isProgram(grandParentNode) || t.isExportNamedDeclaration(grandParentNode)) { - const identifier = path.node.id; - const init = path.node.init; - if (!init || !t.isIdentifier(identifier)) { - return; - } - if (isComponentishName(identifier.name)) { - const trueFuncExpr = - unwrapExpression(init, t.isFunctionExpression) || - unwrapExpression(init, t.isArrowFunctionExpression); - // Check for valid FunctionExpression or ArrowFunctionExpression - if ( - trueFuncExpr && - // Must not be async or generator - !(trueFuncExpr.async || trueFuncExpr.generator) && - // Might be component-like, but the only valid components - // have zero or one parameter - trueFuncExpr.params.length < 2 - ) { - path.node.init = wrapComponent(state, path, identifier, trueFuncExpr); - } - } - // For `createContext` calls - const trueCallExpr = unwrapExpression(init, t.isCallExpression); - if (trueCallExpr && isValidCallee(state, path, trueCallExpr, 'createContext')) { - path.node.init = wrapContext(state, path, identifier, trueCallExpr); - } - } + transformVariableDeclarator(state, path); }, FunctionDeclaration(path, state) { if (state.processed) { return; } - if (path.parentPath.isProgram() || path.parentPath.isExportDefaultDeclaration()) { + if ( + path.parentPath.isProgram() || + path.parentPath.isExportDefaultDeclaration() + ) { const decl = path.node; // Check if declaration is FunctionDeclaration if ( @@ -656,20 +746,26 @@ export default function solidRefreshPlugin(): babel.PluginObj { path, decl.id, t.functionExpression(decl.id, decl.params, decl.body), - decl + decl, ); - const newDecl = t.variableDeclaration('var', [t.variableDeclarator(decl.id, replacement)]); + const newDecl = t.variableDeclaration('var', [ + t.variableDeclarator(decl.id, replacement), + ]); if (path.parentPath.isExportDefaultDeclaration()) { - path.parentPath.insertBefore( - newDecl, - ); + const parent = path.parentPath + .parentPath as babel.NodePath; + const first = parent.get('body')[0]; + first.insertBefore(newDecl); path.replaceWith(decl.id); } else { - path.replaceWith(newDecl); + const parent = path.parentPath as babel.NodePath; + const first = parent.get('body')[0]; + first.insertBefore(newDecl); + path.remove(); } } } - } - } + }, + }, }; } diff --git a/src/babel/xxhash32.ts b/src/babel/xxhash32.ts index b009eac..c61e5c3 100644 --- a/src/babel/xxhash32.ts +++ b/src/babel/xxhash32.ts @@ -19,12 +19,13 @@ function toUtf8(text: string): Uint8Array { } else if (c < 0xd800 || c >= 0xe000) { bytes.push(0xe0 | (c >> 12), 0x80 | ((c >> 6) & 0x3f), 0x80 | (c & 0x3f)); } else { - const cp = 0x10000 + (((c & 0x3ff) << 10) | (text.charCodeAt(++i) & 0x3ff)); + const cp = + 0x10000 + (((c & 0x3ff) << 10) | (text.charCodeAt(++i) & 0x3ff)); bytes.push( 0xf0 | ((cp >> 18) & 0x7), 0x80 | ((cp >> 12) & 0x3f), 0x80 | ((cp >> 6) & 0x3f), - 0x80 | (cp & 0x3f) + 0x80 | (cp & 0x3f), ); } } @@ -64,7 +65,7 @@ export function xxHash32(buffer: Uint8Array | string, seed = 0): number { (seed + PRIME32_1 + PRIME32_2) & 0xffffffff, (seed + PRIME32_2) & 0xffffffff, (seed + 0) & 0xffffffff, - (seed - PRIME32_1) & 0xffffffff + (seed - PRIME32_1) & 0xffffffff, ]; /* @@ -150,7 +151,9 @@ export function xxHash32(buffer: Uint8Array | string, seed = 0): number { const laneP = laneN0 * PRIME32_3 + ((laneN1 * PRIME32_3) << 16); acc = (acc + laneP) & 0xffffffff; acc = (acc << 17) | (acc >>> 15); - acc = ((acc & 0xffff) * PRIME32_4 + (((acc >>> 16) * PRIME32_4) << 16)) & 0xffffffff; + acc = + ((acc & 0xffff) * PRIME32_4 + (((acc >>> 16) * PRIME32_4) << 16)) & + 0xffffffff; } /* @@ -168,7 +171,9 @@ export function xxHash32(buffer: Uint8Array | string, seed = 0): number { const lane = b[offset]; acc = acc + lane * PRIME32_5; acc = (acc << 11) | (acc >>> 21); - acc = ((acc & 0xffff) * PRIME32_1 + (((acc >>> 16) * PRIME32_1) << 16)) & 0xffffffff; + acc = + ((acc & 0xffff) * PRIME32_1 + (((acc >>> 16) * PRIME32_1) << 16)) & + 0xffffffff; } /* @@ -185,9 +190,13 @@ export function xxHash32(buffer: Uint8Array | string, seed = 0): number { */ acc = acc ^ (acc >>> 15); - acc = (((acc & 0xffff) * PRIME32_2) & 0xffffffff) + (((acc >>> 16) * PRIME32_2) << 16); + acc = + (((acc & 0xffff) * PRIME32_2) & 0xffffffff) + + (((acc >>> 16) * PRIME32_2) << 16); acc = acc ^ (acc >>> 13); - acc = (((acc & 0xffff) * PRIME32_3) & 0xffffffff) + (((acc >>> 16) * PRIME32_3) << 16); + acc = + (((acc & 0xffff) * PRIME32_3) & 0xffffffff) + + (((acc >>> 16) * PRIME32_3) << 16); acc = acc ^ (acc >>> 16); // turn any negatives back into a positive number; diff --git a/src/runtime/create-proxy.ts b/src/runtime/create-proxy.ts index b7abf89..f918d85 100644 --- a/src/runtime/create-proxy.ts +++ b/src/runtime/create-proxy.ts @@ -5,19 +5,23 @@ export interface BaseComponent

{ (props: P): JSX.Element; } -function setComponentProperty

(component: BaseComponent

, key: string, value: string) { +function setComponentProperty

( + component: BaseComponent

, + key: string, + value: string, +) { const descriptor = Object.getOwnPropertyDescriptor(component, key); if (descriptor) { Object.defineProperty(component, key, { ...descriptor, - value + value, }); } else { Object.defineProperty(component, key, { value, writable: false, enumerable: false, - configurable: true + configurable: true, }); } } @@ -25,7 +29,7 @@ function setComponentProperty

(component: BaseComponent

, key: string, value export default function createProxy, P>( source: Accessor, name: string, - location?: string + location?: string, ): (props: P) => JSX.Element { const refreshName = `[solid-refresh]${name}`; function HMRComp(props: P): JSX.Element { @@ -40,8 +44,8 @@ export default function createProxy, P>( return undefined; }, { - name: refreshName - } + name: refreshName, + }, ) as unknown as JSX.Element; } // no $DEVCOMP means it did not go through devComponent so source() is a regular function, not a component @@ -63,6 +67,6 @@ export default function createProxy, P>( set(_, property, value) { source()[property as keyof C] = value; return true; - } + }, }); } diff --git a/src/runtime/index.ts b/src/runtime/index.ts index c04e39c..ed1a6f3 100644 --- a/src/runtime/index.ts +++ b/src/runtime/index.ts @@ -43,7 +43,7 @@ export interface Registry { export function $$registry(): Registry { return { components: new Map(), - contexts: new Map() + contexts: new Map(), }; } @@ -51,31 +51,39 @@ export function $$component

( registry: Registry, id: string, component: (props: P) => JSX.Element, - options: ComponentOptions = {} + options: ComponentOptions = {}, ): (props: P) => JSX.Element { const [comp, setComp] = createSignal(component, { internal: true }); - const proxy = createProxy<(props: P) => JSX.Element, P>(comp, id, options.location); + const proxy = createProxy<(props: P) => JSX.Element, P>( + comp, + id, + options.location, + ); registry.components.set(id, { id, component, proxy, update: setComp, - ...options + ...options, }); return proxy; } -export function $$context(registry: Registry, id: string, context: Context): Context { +export function $$context( + registry: Registry, + id: string, + context: Context, +): Context { registry.contexts.set(id, { id, - context + context, }); return context; } function patchComponent

( oldData: ComponentRegistrationData

, - newData: ComponentRegistrationData

+ newData: ComponentRegistrationData

, ) { // Check if incoming module has signature if (newData.signature) { @@ -104,7 +112,10 @@ function patchComponent

( } function patchComponents(oldData: Registry, newData: Registry) { - const components = new Set([...oldData.components.keys(), ...newData.components.keys()]); + const components = new Set([ + ...oldData.components.keys(), + ...newData.components.keys(), + ]); for (const key of components) { const oldComponent = oldData.components.get(key); const newComponent = newData.components.get(key); @@ -123,14 +134,20 @@ function patchComponents(oldData: Registry, newData: Registry) { return false; } -function patchContext(oldData: ContextRegistrationData, newData: ContextRegistrationData) { +function patchContext( + oldData: ContextRegistrationData, + newData: ContextRegistrationData, +) { oldData.context.defaultValue = newData.context.defaultValue; newData.context.id = oldData.context.id; newData.context.Provider = oldData.context.Provider; } function patchContexts(oldData: Registry, newData: Registry) { - const contexts = new Set([...oldData.contexts.keys(), ...newData.contexts.keys()]); + const contexts = new Set([ + ...oldData.contexts.keys(), + ...newData.contexts.keys(), + ]); for (const key of contexts) { const oldContext = oldData.contexts.get(key); const newContext = newData.contexts.get(key); @@ -151,7 +168,10 @@ function patchContexts(oldData: Registry, newData: Registry) { function patchRegistry(oldRegistry: Registry, newRegistry: Registry) { const shouldInvalidateByContext = patchContexts(oldRegistry, newRegistry); - const shouldInvalidateByComponents = patchComponents(oldRegistry, newRegistry); + const shouldInvalidateByComponents = patchComponents( + oldRegistry, + newRegistry, + ); // In the future we may add other HMR features here return shouldInvalidateByComponents || shouldInvalidateByContext; } @@ -179,12 +199,16 @@ interface StandardHot { } type ESMDecline = [type: ESMRuntimeType, hot: ESMHot, inline?: boolean]; -type StandardDecline = [type: StandardRuntimeType, hot: StandardHot, inline?: boolean]; +type StandardDecline = [ + type: StandardRuntimeType, + hot: StandardHot, + inline?: boolean, +]; type Decline = ESMDecline | StandardDecline; export function $$decline(...[type, hot, inline]: Decline) { switch (type) { - case 'esm': + case 'esm': { // Snowpack's ESM assumes invalidate as a normal page reload // decline should be better if (inline) { @@ -193,7 +217,8 @@ export function $$decline(...[type, hot, inline]: Decline) { hot.decline(); } break; - case 'vite': + } + case 'vite': { // Vite is no-op on decline, just call invalidate if (inline) { hot.invalidate(); @@ -203,15 +228,17 @@ export function $$decline(...[type, hot, inline]: Decline) { }); } break; + } case 'rspack-esm': - case 'webpack5': + case 'webpack5': { if (inline) { hot.invalidate!(); } else { hot.decline!(); } break; - case 'standard': + } + case 'standard': { // Some implementations do not have decline/invalidate if (inline) { if (hot.invalidate) { @@ -231,6 +258,7 @@ export function $$decline(...[type, hot, inline]: Decline) { }); } break; + } } } @@ -245,7 +273,7 @@ function shouldWarnAndDecline() { if (!warned) { console.warn( - "To use solid-refresh, you need to use the dev build of SolidJS. Make sure your build system supports package.json conditional exports and has the 'development' condition turned on." + "To use solid-refresh, you need to use the dev build of SolidJS. Make sure your build system supports package.json conditional exports and has the 'development' condition turned on.", ); warned = true; } @@ -260,7 +288,10 @@ function $$refreshESM(type: ESMRuntimeType, hot: ESMHot, registry: Registry) { hot.data[SOLID_REFRESH_PREV] = registry; hot.accept(mod => { - if (mod == null || patchRegistry(hot.data[SOLID_REFRESH], hot.data[SOLID_REFRESH_PREV])) { + if ( + mod == null || + patchRegistry(hot.data[SOLID_REFRESH], hot.data[SOLID_REFRESH_PREV]) + ) { hot.invalidate(); } }); @@ -270,7 +301,11 @@ function $$refreshESM(type: ESMRuntimeType, hot: ESMHot, registry: Registry) { } } -function $$refreshStandard(type: StandardRuntimeType, hot: StandardHot, registry: Registry) { +function $$refreshStandard( + type: StandardRuntimeType, + hot: StandardHot, + registry: Registry, +) { if (shouldWarnAndDecline()) { $$decline(type, hot); } else { @@ -288,20 +323,26 @@ function $$refreshStandard(type: StandardRuntimeType, hot: StandardHot, registry } type ESMRefresh = [type: ESMRuntimeType, hot: ESMHot, registry: Registry]; -type StandardRefresh = [type: StandardRuntimeType, hot: StandardHot, registry: Registry]; +type StandardRefresh = [ + type: StandardRuntimeType, + hot: StandardHot, + registry: Registry, +]; type Refresh = ESMRefresh | StandardRefresh; export function $$refresh(...[type, hot, registry]: Refresh) { switch (type) { case 'esm': - case 'vite': + case 'vite': { $$refreshESM(type, hot, registry); break; + } case 'standard': case 'webpack5': - case 'rspack-esm': + case 'rspack-esm': { $$refreshStandard(type, hot, registry); break; + } } } diff --git a/src/runtime/is-list-updated.ts b/src/runtime/is-list-updated.ts index 4b84915..cd91d8d 100644 --- a/src/runtime/is-list-updated.ts +++ b/src/runtime/is-list-updated.ts @@ -1,34 +1,42 @@ +function isListUpdatedInternal( + a: Record, + b: Record, +): boolean { + const aKeys = Object.keys(a); + const bKeys = Object.keys(b); + // Check if both objects has the same amount of keys + if (aKeys.length !== bKeys.length) { + return true; + } + // Merge keys + const keys = new Set([...aKeys, ...bKeys]); + // Now check if merged keys has the same amount of keys as the other two + // for example: { a, b } and { a, c } produces { a, b, c } + if (keys.size !== aKeys.length) { + return true; + } + // Now compare each items + for (const key of keys) { + // This covers NaN. No need for Object.is since it's extreme for -0 + if (a[key] !== b[key] || (a[key] !== a[key] && b[key] !== b[key])) { + return true; + } + } + return false; +} + export default function isListUpdated( a: Record | undefined, - b: Record | undefined + b: Record | undefined, ): boolean { + if (a && b) { + return isListUpdatedInternal(a, b); + } if (a == null && b != null) { return true; } if (a != null && b == null) { return true; } - if (a && b) { - const aKeys = Object.keys(a); - const bKeys = Object.keys(b); - // Check if both objects has the same amount of keys - if (aKeys.length !== bKeys.length) { - return true; - } - // Merge keys - const keys = new Set([...aKeys, ...bKeys]); - // Now check if merged keys has the same amount of keys as the other two - // for example: { a, b } and { a, c } produces { a, b, c } - if (keys.size !== aKeys.length) { - return true; - } - // Now compare each items - for (const key of keys) { - // This covers NaN. No need for Object.is since it's extreme for -0 - if (a[key] !== b[key] || (a[key] !== a[key] && b[key] !== b[key])) { - return true; - } - } - } return false; } diff --git a/tests/__snapshots__/esm.test.ts.snap b/tests/__snapshots__/esm.test.ts.snap index c68b14e..7abb255 100644 --- a/tests/__snapshots__/esm.test.ts.snap +++ b/tests/__snapshots__/esm.test.ts.snap @@ -1,13 +1,44 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`esm > Context API > should not support VariableDeclaration that is not top-level 1`] = ` +"import { createContext } from 'solid-js'; +if (someCond) { + const Example = createContext(); +}" +`; + +exports[`esm > Context API > should support ExportNamedDeclaration 1`] = ` +"import { $$context as _$$context } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; +const _REGISTRY = _$$registry(); +import { createContext } from 'solid-js'; +export const Example = _$$context(_REGISTRY, "Example", createContext()); +if (import.meta.hot) { + _$$refresh("esm", import.meta.hot, _REGISTRY); +}" +`; + +exports[`esm > Context API > should support top-level VariableDeclaration 1`] = ` +"import { $$context as _$$context } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; +const _REGISTRY = _$$registry(); +import { createContext } from 'solid-js'; +const Example = _$$context(_REGISTRY, "Example", createContext()); +if (import.meta.hot) { + _$$refresh("esm", import.meta.hot, _REGISTRY); +}" +`; + exports[`esm > ExportDefaultDeclaration w/ FunctionExpression > should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload export default function Foo() { return

Foo

; } if (import.meta.hot) { - _$$decline(\\"esm\\", import.meta.hot); + _$$decline("esm", import.meta.hot); }" `; @@ -31,107 +62,107 @@ exports[`esm > ExportDefaultDeclaration w/ FunctionExpression > should skip Expo `; exports[`esm > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:21\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:21", + signature: "83fbb41" }); // @refresh granular export default Foo; if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const example = 'Foo'; -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:21\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:21", + signature: "c479f38e", dependencies: { example } }); +// @refresh granular +const example = 'Foo'; export default Foo; if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const Example = createContext(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:21\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:21", + signature: "f8fa9630", dependencies: { Example } }); +// @refresh granular +const Example = createContext(); export default Foo; if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:21\\" + location: "example.jsx:2:21" }); export default Foo; if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +var Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:21\\" + location: "example.jsx:2:21" }); export default Foo; if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > ExportNamedDeclaration w/ FunctionExpression > should skip ExportNamedDeclaration w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload export function Foo() { return

Foo

; } if (import.meta.hot) { - _$$decline(\\"esm\\", import.meta.hot); + _$$decline("esm", import.meta.hot); }" `; @@ -143,17 +174,17 @@ export function Foo() { `; exports[`esm > ExportNamedDeclaration w/ FunctionExpression > should skip ExportNamedDeclaration w/ FunctionExpression with invalid Component name 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; @@ -164,102 +195,102 @@ exports[`esm > ExportNamedDeclaration w/ FunctionExpression > should skip Export `; exports[`esm > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:13\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:13", + signature: "83fbb41" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:13\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:13", + signature: "c479f38e", dependencies: { example } }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:13\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:13", + signature: "f8fa9630", dependencies: { Example } }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > FunctionDeclaration > should skip FunctionDeclaration with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload function Foo() { return

Foo

; } if (import.meta.hot) { - _$$decline(\\"esm\\", import.meta.hot); + _$$decline("esm", import.meta.hot); }" `; @@ -283,102 +314,101 @@ exports[`esm > FunctionDeclaration > should skip FunctionDeclaration with valid `; exports[`esm > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; // @refresh granular const _REGISTRY = _$$registry(); -// @refresh granular -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:6\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:6", + signature: "83fbb41" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const example = 'Foo'; -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:6\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:6", + signature: "c479f38e", dependencies: { example } }); +// @refresh granular +const example = 'Foo'; if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const Example = createContext(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:6\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:6", + signature: "f8fa9630", dependencies: { Example } }); +// @refresh granular +const Example = createContext(); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > FunctionDeclaration > should transform FunctionDeclaration with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:6\\" + location: "example.jsx:2:6" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > FunctionDeclaration > should transform FunctionDeclaration with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +var Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:6\\" + location: "example.jsx:2:6" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > VariableDeclarator > ArrowFunctionExpression > should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload const Foo = () => { return

Foo

; }; if (import.meta.hot) { - _$$decline(\\"esm\\", import.meta.hot); + _$$decline("esm", import.meta.hot); }" `; @@ -402,102 +432,102 @@ exports[`esm > VariableDeclarator > ArrowFunctionExpression > should skip Variab `; exports[`esm > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

Foo

; }, { - location: \\"example.jsx:3:20\\", - signature: \\"dd474849\\" + location: "example.jsx:3:20", + signature: "dd474849" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

{example}

; }, { - location: \\"example.jsx:4:20\\", - signature: \\"42ac2326\\", + location: "example.jsx:4:20", + signature: "42ac2326", dependencies: { example } }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return Foo; }, { - location: \\"example.jsx:4:20\\", - signature: \\"23378462\\", + location: "example.jsx:4:20", + signature: "23378462", dependencies: { Example } }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", props => { +const Foo = _$$component(_REGISTRY, "Foo", props => { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > VariableDeclarator > FunctionExpression > should skip VariableDeclarator w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload const Foo = function () { return

Foo

; }; if (import.meta.hot) { - _$$decline(\\"esm\\", import.meta.hot); + _$$decline("esm", import.meta.hot); }" `; @@ -521,96 +551,96 @@ exports[`esm > VariableDeclarator > FunctionExpression > should skip VariableDec `; exports[`esm > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

Foo

; }, { - location: \\"example.jsx:3:20\\", - signature: \\"a8bc6ac4\\" + location: "example.jsx:3:20", + signature: "a8bc6ac4" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

{example}

; }, { - location: \\"example.jsx:4:20\\", - signature: \\"2264ba41\\", + location: "example.jsx:4:20", + signature: "2264ba41", dependencies: { example } }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return Foo; }, { - location: \\"example.jsx:4:20\\", - signature: \\"b3df1897\\", + location: "example.jsx:4:20", + signature: "b3df1897", dependencies: { Example } }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function (props) { +const Foo = _$$component(_REGISTRY, "Foo", function (props) { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); + _$$refresh("esm", import.meta.hot, _REGISTRY); }" `; exports[`esm > fix render > @refresh reload > should work 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload import { render } from 'solid-js/web'; if (root) { @@ -618,7 +648,7 @@ if (root) { if (import.meta.hot) import.meta.hot.dispose(_cleanup); } if (import.meta.hot) { - _$$decline(\\"esm\\", import.meta.hot); + _$$decline("esm", import.meta.hot); }" `; @@ -653,15 +683,3 @@ if (root) { if (import.meta.hot) import.meta.hot.dispose(_cleanup); }" `; - -exports[`esm > should support Context API 1`] = ` -"import { $$context as _$$context } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; -const _REGISTRY = _$$registry(); -import { createContext } from 'solid-js'; -const Example = _$$context(_REGISTRY, \\"Example\\", createContext()); -if (import.meta.hot) { - _$$refresh(\\"esm\\", import.meta.hot, _REGISTRY); -}" -`; diff --git a/tests/__snapshots__/rspack-esm.test.ts.snap b/tests/__snapshots__/rspack-esm.test.ts.snap index 81083f4..28e1d34 100644 --- a/tests/__snapshots__/rspack-esm.test.ts.snap +++ b/tests/__snapshots__/rspack-esm.test.ts.snap @@ -1,13 +1,44 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`rspack-esm > Context API > should not support VariableDeclaration that is not top-level 1`] = ` +"import { createContext } from 'solid-js'; +if (someCond) { + const Example = createContext(); +}" +`; + +exports[`rspack-esm > Context API > should support ExportNamedDeclaration 1`] = ` +"import { $$context as _$$context } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; +const _REGISTRY = _$$registry(); +import { createContext } from 'solid-js'; +export const Example = _$$context(_REGISTRY, "Example", createContext()); +if (import.meta.webpackHot) { + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); +}" +`; + +exports[`rspack-esm > Context API > should support top-level VariableDeclaration 1`] = ` +"import { $$context as _$$context } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; +const _REGISTRY = _$$registry(); +import { createContext } from 'solid-js'; +const Example = _$$context(_REGISTRY, "Example", createContext()); +if (import.meta.webpackHot) { + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); +}" +`; + exports[`rspack-esm > ExportDefaultDeclaration w/ FunctionExpression > should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload export default function Foo() { return

Foo

; } if (import.meta.webpackHot) { - _$$decline(\\"rspack-esm\\", import.meta.webpackHot); + _$$decline("rspack-esm", import.meta.webpackHot); }" `; @@ -31,107 +62,107 @@ exports[`rspack-esm > ExportDefaultDeclaration w/ FunctionExpression > should sk `; exports[`rspack-esm > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:21\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:21", + signature: "83fbb41" }); // @refresh granular export default Foo; if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const example = 'Foo'; -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:21\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:21", + signature: "c479f38e", dependencies: { example } }); +// @refresh granular +const example = 'Foo'; export default Foo; if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const Example = createContext(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:21\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:21", + signature: "f8fa9630", dependencies: { Example } }); +// @refresh granular +const Example = createContext(); export default Foo; if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:21\\" + location: "example.jsx:2:21" }); export default Foo; if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +var Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:21\\" + location: "example.jsx:2:21" }); export default Foo; if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > ExportNamedDeclaration w/ FunctionExpression > should skip ExportNamedDeclaration w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload export function Foo() { return

Foo

; } if (import.meta.webpackHot) { - _$$decline(\\"rspack-esm\\", import.meta.webpackHot); + _$$decline("rspack-esm", import.meta.webpackHot); }" `; @@ -143,17 +174,17 @@ export function Foo() { `; exports[`rspack-esm > ExportNamedDeclaration w/ FunctionExpression > should skip ExportNamedDeclaration w/ FunctionExpression with invalid Component name 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; @@ -164,102 +195,102 @@ exports[`rspack-esm > ExportNamedDeclaration w/ FunctionExpression > should skip `; exports[`rspack-esm > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:13\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:13", + signature: "83fbb41" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:13\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:13", + signature: "c479f38e", dependencies: { example } }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:13\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:13", + signature: "f8fa9630", dependencies: { Example } }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > FunctionDeclaration > should skip FunctionDeclaration with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload function Foo() { return

Foo

; } if (import.meta.webpackHot) { - _$$decline(\\"rspack-esm\\", import.meta.webpackHot); + _$$decline("rspack-esm", import.meta.webpackHot); }" `; @@ -283,102 +314,101 @@ exports[`rspack-esm > FunctionDeclaration > should skip FunctionDeclaration with `; exports[`rspack-esm > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; // @refresh granular const _REGISTRY = _$$registry(); -// @refresh granular -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:6\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:6", + signature: "83fbb41" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const example = 'Foo'; -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:6\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:6", + signature: "c479f38e", dependencies: { example } }); +// @refresh granular +const example = 'Foo'; if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const Example = createContext(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:6\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:6", + signature: "f8fa9630", dependencies: { Example } }); +// @refresh granular +const Example = createContext(); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > FunctionDeclaration > should transform FunctionDeclaration with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:6\\" + location: "example.jsx:2:6" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > FunctionDeclaration > should transform FunctionDeclaration with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +var Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:6\\" + location: "example.jsx:2:6" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > VariableDeclarator > ArrowFunctionExpression > should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload const Foo = () => { return

Foo

; }; if (import.meta.webpackHot) { - _$$decline(\\"rspack-esm\\", import.meta.webpackHot); + _$$decline("rspack-esm", import.meta.webpackHot); }" `; @@ -402,102 +432,102 @@ exports[`rspack-esm > VariableDeclarator > ArrowFunctionExpression > should skip `; exports[`rspack-esm > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

Foo

; }, { - location: \\"example.jsx:3:20\\", - signature: \\"dd474849\\" + location: "example.jsx:3:20", + signature: "dd474849" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

{example}

; }, { - location: \\"example.jsx:4:20\\", - signature: \\"42ac2326\\", + location: "example.jsx:4:20", + signature: "42ac2326", dependencies: { example } }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return Foo; }, { - location: \\"example.jsx:4:20\\", - signature: \\"23378462\\", + location: "example.jsx:4:20", + signature: "23378462", dependencies: { Example } }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", props => { +const Foo = _$$component(_REGISTRY, "Foo", props => { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > VariableDeclarator > FunctionExpression > should skip VariableDeclarator w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload const Foo = function () { return

Foo

; }; if (import.meta.webpackHot) { - _$$decline(\\"rspack-esm\\", import.meta.webpackHot); + _$$decline("rspack-esm", import.meta.webpackHot); }" `; @@ -521,96 +551,96 @@ exports[`rspack-esm > VariableDeclarator > FunctionExpression > should skip Vari `; exports[`rspack-esm > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

Foo

; }, { - location: \\"example.jsx:3:20\\", - signature: \\"a8bc6ac4\\" + location: "example.jsx:3:20", + signature: "a8bc6ac4" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

{example}

; }, { - location: \\"example.jsx:4:20\\", - signature: \\"2264ba41\\", + location: "example.jsx:4:20", + signature: "2264ba41", dependencies: { example } }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return Foo; }, { - location: \\"example.jsx:4:20\\", - signature: \\"b3df1897\\", + location: "example.jsx:4:20", + signature: "b3df1897", dependencies: { Example } }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function (props) { +const Foo = _$$component(_REGISTRY, "Foo", function (props) { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("rspack-esm", import.meta.webpackHot, _REGISTRY); }" `; exports[`rspack-esm > fix render > @refresh reload > should work 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload import { render } from 'solid-js/web'; if (root) { @@ -618,7 +648,7 @@ if (root) { if (import.meta.webpackHot) import.meta.webpackHot.dispose(_cleanup); } if (import.meta.webpackHot) { - _$$decline(\\"rspack-esm\\", import.meta.webpackHot); + _$$decline("rspack-esm", import.meta.webpackHot); }" `; @@ -653,15 +683,3 @@ if (root) { if (import.meta.webpackHot) import.meta.webpackHot.dispose(_cleanup); }" `; - -exports[`rspack-esm > should support Context API 1`] = ` -"import { $$context as _$$context } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; -const _REGISTRY = _$$registry(); -import { createContext } from 'solid-js'; -const Example = _$$context(_REGISTRY, \\"Example\\", createContext()); -if (import.meta.webpackHot) { - _$$refresh(\\"rspack-esm\\", import.meta.webpackHot, _REGISTRY); -}" -`; diff --git a/tests/__snapshots__/standard.test.ts.snap b/tests/__snapshots__/standard.test.ts.snap index 32f2f3c..9386a11 100644 --- a/tests/__snapshots__/standard.test.ts.snap +++ b/tests/__snapshots__/standard.test.ts.snap @@ -1,13 +1,44 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`vite > Context API > should not support VariableDeclaration that is not top-level 1`] = ` +"import { createContext } from 'solid-js'; +if (someCond) { + const Example = createContext(); +}" +`; + +exports[`vite > Context API > should support ExportNamedDeclaration 1`] = ` +"import { $$context as _$$context } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; +const _REGISTRY = _$$registry(); +import { createContext } from 'solid-js'; +export const Example = _$$context(_REGISTRY, "Example", createContext()); +if (module.hot) { + _$$refresh("standard", module.hot, _REGISTRY); +}" +`; + +exports[`vite > Context API > should support top-level VariableDeclaration 1`] = ` +"import { $$context as _$$context } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; +const _REGISTRY = _$$registry(); +import { createContext } from 'solid-js'; +const Example = _$$context(_REGISTRY, "Example", createContext()); +if (module.hot) { + _$$refresh("standard", module.hot, _REGISTRY); +}" +`; + exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload export default function Foo() { return

Foo

; } if (module.hot) { - _$$decline(\\"standard\\", module.hot); + _$$decline("standard", module.hot); }" `; @@ -31,107 +62,107 @@ exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should skip Exp `; exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:21\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:21", + signature: "83fbb41" }); // @refresh granular export default Foo; if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const example = 'Foo'; -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:21\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:21", + signature: "c479f38e", dependencies: { example } }); +// @refresh granular +const example = 'Foo'; export default Foo; if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const Example = createContext(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:21\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:21", + signature: "f8fa9630", dependencies: { Example } }); +// @refresh granular +const Example = createContext(); export default Foo; if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:21\\" + location: "example.jsx:2:21" }); export default Foo; if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +var Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:21\\" + location: "example.jsx:2:21" }); export default Foo; if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should skip ExportNamedDeclaration w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload export function Foo() { return

Foo

; } if (module.hot) { - _$$decline(\\"standard\\", module.hot); + _$$decline("standard", module.hot); }" `; @@ -143,17 +174,17 @@ export function Foo() { `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should skip ExportNamedDeclaration w/ FunctionExpression with invalid Component name 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; @@ -164,102 +195,102 @@ exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should skip Expor `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:13\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:13", + signature: "83fbb41" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:13\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:13", + signature: "c479f38e", dependencies: { example } }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:13\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:13", + signature: "f8fa9630", dependencies: { Example } }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > FunctionDeclaration > should skip FunctionDeclaration with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload function Foo() { return

Foo

; } if (module.hot) { - _$$decline(\\"standard\\", module.hot); + _$$decline("standard", module.hot); }" `; @@ -283,102 +314,101 @@ exports[`vite > FunctionDeclaration > should skip FunctionDeclaration with valid `; exports[`vite > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; // @refresh granular const _REGISTRY = _$$registry(); -// @refresh granular -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:6\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:6", + signature: "83fbb41" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const example = 'Foo'; -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:6\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:6", + signature: "c479f38e", dependencies: { example } }); +// @refresh granular +const example = 'Foo'; if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const Example = createContext(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:6\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:6", + signature: "f8fa9630", dependencies: { Example } }); +// @refresh granular +const Example = createContext(); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > FunctionDeclaration > should transform FunctionDeclaration with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:6\\" + location: "example.jsx:2:6" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > FunctionDeclaration > should transform FunctionDeclaration with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +var Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:6\\" + location: "example.jsx:2:6" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload const Foo = () => { return

Foo

; }; if (module.hot) { - _$$decline(\\"standard\\", module.hot); + _$$decline("standard", module.hot); }" `; @@ -402,102 +432,102 @@ exports[`vite > VariableDeclarator > ArrowFunctionExpression > should skip Varia `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

Foo

; }, { - location: \\"example.jsx:3:20\\", - signature: \\"dd474849\\" + location: "example.jsx:3:20", + signature: "dd474849" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

{example}

; }, { - location: \\"example.jsx:4:20\\", - signature: \\"42ac2326\\", + location: "example.jsx:4:20", + signature: "42ac2326", dependencies: { example } }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return Foo; }, { - location: \\"example.jsx:4:20\\", - signature: \\"23378462\\", + location: "example.jsx:4:20", + signature: "23378462", dependencies: { Example } }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", props => { +const Foo = _$$component(_REGISTRY, "Foo", props => { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > VariableDeclarator > FunctionExpression > should skip VariableDeclarator w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload const Foo = function () { return

Foo

; }; if (module.hot) { - _$$decline(\\"standard\\", module.hot); + _$$decline("standard", module.hot); }" `; @@ -521,96 +551,96 @@ exports[`vite > VariableDeclarator > FunctionExpression > should skip VariableDe `; exports[`vite > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

Foo

; }, { - location: \\"example.jsx:3:20\\", - signature: \\"a8bc6ac4\\" + location: "example.jsx:3:20", + signature: "a8bc6ac4" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

{example}

; }, { - location: \\"example.jsx:4:20\\", - signature: \\"2264ba41\\", + location: "example.jsx:4:20", + signature: "2264ba41", dependencies: { example } }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return Foo; }, { - location: \\"example.jsx:4:20\\", - signature: \\"b3df1897\\", + location: "example.jsx:4:20", + signature: "b3df1897", dependencies: { Example } }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function (props) { +const Foo = _$$component(_REGISTRY, "Foo", function (props) { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); + _$$refresh("standard", module.hot, _REGISTRY); }" `; exports[`vite > fix render > @refresh reload > should work 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload import { render } from 'solid-js/web'; if (root) { @@ -618,7 +648,7 @@ if (root) { if (module.hot) module.hot.dispose(_cleanup); } if (module.hot) { - _$$decline(\\"standard\\", module.hot); + _$$decline("standard", module.hot); }" `; @@ -653,15 +683,3 @@ if (root) { if (module.hot) module.hot.dispose(_cleanup); }" `; - -exports[`vite > should support Context API 1`] = ` -"import { $$context as _$$context } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; -const _REGISTRY = _$$registry(); -import { createContext } from 'solid-js'; -const Example = _$$context(_REGISTRY, \\"Example\\", createContext()); -if (module.hot) { - _$$refresh(\\"standard\\", module.hot, _REGISTRY); -}" -`; diff --git a/tests/__snapshots__/vite.test.ts.snap b/tests/__snapshots__/vite.test.ts.snap index 8830b2b..dc4ac18 100644 --- a/tests/__snapshots__/vite.test.ts.snap +++ b/tests/__snapshots__/vite.test.ts.snap @@ -1,13 +1,46 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`vite > Context API > should not support VariableDeclaration that is not top-level 1`] = ` +"import { createContext } from 'solid-js'; +if (someCond) { + const Example = createContext(); +}" +`; + +exports[`vite > Context API > should support ExportNamedDeclaration 1`] = ` +"import { $$context as _$$context } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; +const _REGISTRY = _$$registry(); +import { createContext } from 'solid-js'; +export const Example = _$$context(_REGISTRY, "Example", createContext()); +if (import.meta.hot) { + _$$refresh("vite", import.meta.hot, _REGISTRY); + import.meta.hot.accept(); +}" +`; + +exports[`vite > Context API > should support top-level VariableDeclaration 1`] = ` +"import { $$context as _$$context } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; +const _REGISTRY = _$$registry(); +import { createContext } from 'solid-js'; +const Example = _$$context(_REGISTRY, "Example", createContext()); +if (import.meta.hot) { + _$$refresh("vite", import.meta.hot, _REGISTRY); + import.meta.hot.accept(); +}" +`; + exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload export default function Foo() { return

Foo

; } if (import.meta.hot) { - _$$decline(\\"vite\\", import.meta.hot); + _$$decline("vite", import.meta.hot); import.meta.hot.accept(); }" `; @@ -32,112 +65,112 @@ exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should skip Exp `; exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:21\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:21", + signature: "83fbb41" }); // @refresh granular export default Foo; if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const example = 'Foo'; -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:21\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:21", + signature: "c479f38e", dependencies: { example } }); +// @refresh granular +const example = 'Foo'; export default Foo; if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const Example = createContext(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:21\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:21", + signature: "f8fa9630", dependencies: { Example } }); +// @refresh granular +const Example = createContext(); export default Foo; if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:21\\" + location: "example.jsx:2:21" }); export default Foo; if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +var Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:21\\" + location: "example.jsx:2:21" }); export default Foo; if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should skip ExportNamedDeclaration w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload export function Foo() { return

Foo

; } if (import.meta.hot) { - _$$decline(\\"vite\\", import.meta.hot); + _$$decline("vite", import.meta.hot); import.meta.hot.accept(); }" `; @@ -150,17 +183,17 @@ export function Foo() { `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should skip ExportNamedDeclaration w/ FunctionExpression with invalid Component name 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; @@ -172,107 +205,107 @@ exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should skip Expor `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:13\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:13", + signature: "83fbb41" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:13\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:13", + signature: "c479f38e", dependencies: { example } }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:13\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:13", + signature: "f8fa9630", dependencies: { Example } }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > FunctionDeclaration > should skip FunctionDeclaration with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload function Foo() { return

Foo

; } if (import.meta.hot) { - _$$decline(\\"vite\\", import.meta.hot); + _$$decline("vite", import.meta.hot); import.meta.hot.accept(); }" `; @@ -297,107 +330,106 @@ exports[`vite > FunctionDeclaration > should skip FunctionDeclaration with valid `; exports[`vite > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; // @refresh granular const _REGISTRY = _$$registry(); -// @refresh granular -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:6\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:6", + signature: "83fbb41" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const example = 'Foo'; -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:6\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:6", + signature: "c479f38e", dependencies: { example } }); +// @refresh granular +const example = 'Foo'; if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const Example = createContext(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:6\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:6", + signature: "f8fa9630", dependencies: { Example } }); +// @refresh granular +const Example = createContext(); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > FunctionDeclaration > should transform FunctionDeclaration with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:6\\" + location: "example.jsx:2:6" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > FunctionDeclaration > should transform FunctionDeclaration with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +var Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:6\\" + location: "example.jsx:2:6" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload const Foo = () => { return

Foo

; }; if (import.meta.hot) { - _$$decline(\\"vite\\", import.meta.hot); + _$$decline("vite", import.meta.hot); import.meta.hot.accept(); }" `; @@ -422,107 +454,107 @@ exports[`vite > VariableDeclarator > ArrowFunctionExpression > should skip Varia `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

Foo

; }, { - location: \\"example.jsx:3:20\\", - signature: \\"dd474849\\" + location: "example.jsx:3:20", + signature: "dd474849" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

{example}

; }, { - location: \\"example.jsx:4:20\\", - signature: \\"42ac2326\\", + location: "example.jsx:4:20", + signature: "42ac2326", dependencies: { example } }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return Foo; }, { - location: \\"example.jsx:4:20\\", - signature: \\"23378462\\", + location: "example.jsx:4:20", + signature: "23378462", dependencies: { Example } }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", props => { +const Foo = _$$component(_REGISTRY, "Foo", props => { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > VariableDeclarator > FunctionExpression > should skip VariableDeclarator w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload const Foo = function () { return

Foo

; }; if (import.meta.hot) { - _$$decline(\\"vite\\", import.meta.hot); + _$$decline("vite", import.meta.hot); import.meta.hot.accept(); }" `; @@ -547,101 +579,101 @@ exports[`vite > VariableDeclarator > FunctionExpression > should skip VariableDe `; exports[`vite > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

Foo

; }, { - location: \\"example.jsx:3:20\\", - signature: \\"a8bc6ac4\\" + location: "example.jsx:3:20", + signature: "a8bc6ac4" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

{example}

; }, { - location: \\"example.jsx:4:20\\", - signature: \\"2264ba41\\", + location: "example.jsx:4:20", + signature: "2264ba41", dependencies: { example } }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return Foo; }, { - location: \\"example.jsx:4:20\\", - signature: \\"b3df1897\\", + location: "example.jsx:4:20", + signature: "b3df1897", dependencies: { Example } }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function (props) { +const Foo = _$$component(_REGISTRY, "Foo", function (props) { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); + _$$refresh("vite", import.meta.hot, _REGISTRY); import.meta.hot.accept(); }" `; exports[`vite > fix render > @refresh reload > should work 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload import { render } from 'solid-js/web'; if (root) { @@ -649,7 +681,7 @@ if (root) { if (import.meta.hot) import.meta.hot.dispose(_cleanup); } if (import.meta.hot) { - _$$decline(\\"vite\\", import.meta.hot); + _$$decline("vite", import.meta.hot); import.meta.hot.accept(); }" `; @@ -685,16 +717,3 @@ if (root) { if (import.meta.hot) import.meta.hot.dispose(_cleanup); }" `; - -exports[`vite > should support Context API 1`] = ` -"import { $$context as _$$context } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; -const _REGISTRY = _$$registry(); -import { createContext } from 'solid-js'; -const Example = _$$context(_REGISTRY, \\"Example\\", createContext()); -if (import.meta.hot) { - _$$refresh(\\"vite\\", import.meta.hot, _REGISTRY); - import.meta.hot.accept(); -}" -`; diff --git a/tests/__snapshots__/webpack5.test.ts.snap b/tests/__snapshots__/webpack5.test.ts.snap index 56017fd..0b9a558 100644 --- a/tests/__snapshots__/webpack5.test.ts.snap +++ b/tests/__snapshots__/webpack5.test.ts.snap @@ -1,13 +1,44 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`webpack5 > Context API > should not support VariableDeclaration that is not top-level 1`] = ` +"import { createContext } from 'solid-js'; +if (someCond) { + const Example = createContext(); +}" +`; + +exports[`webpack5 > Context API > should support ExportNamedDeclaration 1`] = ` +"import { $$context as _$$context } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; +const _REGISTRY = _$$registry(); +import { createContext } from 'solid-js'; +export const Example = _$$context(_REGISTRY, "Example", createContext()); +if (import.meta.webpackHot) { + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); +}" +`; + +exports[`webpack5 > Context API > should support top-level VariableDeclaration 1`] = ` +"import { $$context as _$$context } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; +const _REGISTRY = _$$registry(); +import { createContext } from 'solid-js'; +const Example = _$$context(_REGISTRY, "Example", createContext()); +if (import.meta.webpackHot) { + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); +}" +`; + exports[`webpack5 > ExportDefaultDeclaration w/ FunctionExpression > should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload export default function Foo() { return

Foo

; } if (import.meta.webpackHot) { - _$$decline(\\"webpack5\\", import.meta.webpackHot); + _$$decline("webpack5", import.meta.webpackHot); }" `; @@ -31,107 +62,107 @@ exports[`webpack5 > ExportDefaultDeclaration w/ FunctionExpression > should skip `; exports[`webpack5 > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:21\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:21", + signature: "83fbb41" }); // @refresh granular export default Foo; if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const example = 'Foo'; -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:21\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:21", + signature: "c479f38e", dependencies: { example } }); +// @refresh granular +const example = 'Foo'; export default Foo; if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const Example = createContext(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:21\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:21", + signature: "f8fa9630", dependencies: { Example } }); +// @refresh granular +const Example = createContext(); export default Foo; if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:21\\" + location: "example.jsx:2:21" }); export default Foo; if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > ExportDefaultDeclaration w/ FunctionExpression > should transform ExportDefaultDeclaration w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +var Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:21\\" + location: "example.jsx:2:21" }); export default Foo; if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > ExportNamedDeclaration w/ FunctionExpression > should skip ExportNamedDeclaration w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload export function Foo() { return

Foo

; } if (import.meta.webpackHot) { - _$$decline(\\"webpack5\\", import.meta.webpackHot); + _$$decline("webpack5", import.meta.webpackHot); }" `; @@ -143,17 +174,17 @@ export function Foo() { `; exports[`webpack5 > ExportNamedDeclaration w/ FunctionExpression > should skip ExportNamedDeclaration w/ FunctionExpression with invalid Component name 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; @@ -164,102 +195,102 @@ exports[`webpack5 > ExportNamedDeclaration w/ FunctionExpression > should skip E `; exports[`webpack5 > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:13\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:13", + signature: "83fbb41" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:13\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:13", + signature: "c479f38e", dependencies: { example } }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:13\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:13", + signature: "f8fa9630", dependencies: { Example } }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > ExportNamedDeclaration w/ FunctionExpression > should transform ExportNamedDeclaration w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -export const Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +export const Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:13\\" + location: "example.jsx:2:13" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > FunctionDeclaration > should skip FunctionDeclaration with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload function Foo() { return

Foo

; } if (import.meta.webpackHot) { - _$$decline(\\"webpack5\\", import.meta.webpackHot); + _$$decline("webpack5", import.meta.webpackHot); }" `; @@ -283,102 +314,101 @@ exports[`webpack5 > FunctionDeclaration > should skip FunctionDeclaration with v `; exports[`webpack5 > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; // @refresh granular const _REGISTRY = _$$registry(); -// @refresh granular -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:3:6\\", - signature: \\"83fbb41\\" + location: "example.jsx:3:6", + signature: "83fbb41" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const example = 'Foo'; -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

{example}

; }, { - location: \\"example.jsx:4:6\\", - signature: \\"c479f38e\\", + location: "example.jsx:4:6", + signature: "c479f38e", dependencies: { example } }); +// @refresh granular +const example = 'Foo'; if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > FunctionDeclaration > should transform FunctionDeclaration with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -// @refresh granular -const Example = createContext(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return Foo; }, { - location: \\"example.jsx:4:6\\", - signature: \\"f8fa9630\\", + location: "example.jsx:4:6", + signature: "f8fa9630", dependencies: { Example } }); +// @refresh granular +const Example = createContext(); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > FunctionDeclaration > should transform FunctionDeclaration with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo() { +var Foo = _$$component(_REGISTRY, "Foo", function Foo() { return

Foo

; }, { - location: \\"example.jsx:2:6\\" + location: "example.jsx:2:6" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > FunctionDeclaration > should transform FunctionDeclaration with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -var Foo = _$$component(_REGISTRY, \\"Foo\\", function Foo(props) { +var Foo = _$$component(_REGISTRY, "Foo", function Foo(props) { return

Foo

; }, { - location: \\"example.jsx:2:6\\" + location: "example.jsx:2:6" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > VariableDeclarator > ArrowFunctionExpression > should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload const Foo = () => { return

Foo

; }; if (import.meta.webpackHot) { - _$$decline(\\"webpack5\\", import.meta.webpackHot); + _$$decline("webpack5", import.meta.webpackHot); }" `; @@ -402,102 +432,102 @@ exports[`webpack5 > VariableDeclarator > ArrowFunctionExpression > should skip V `; exports[`webpack5 > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

Foo

; }, { - location: \\"example.jsx:3:20\\", - signature: \\"dd474849\\" + location: "example.jsx:3:20", + signature: "dd474849" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

{example}

; }, { - location: \\"example.jsx:4:20\\", - signature: \\"42ac2326\\", + location: "example.jsx:4:20", + signature: "42ac2326", dependencies: { example } }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return Foo; }, { - location: \\"example.jsx:4:20\\", - signature: \\"23378462\\", + location: "example.jsx:4:20", + signature: "23378462", dependencies: { Example } }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", () => { +const Foo = _$$component(_REGISTRY, "Foo", () => { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > VariableDeclarator > ArrowFunctionExpression > should transform VariableDeclarator w/ ArrowFunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", props => { +const Foo = _$$component(_REGISTRY, "Foo", props => { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > VariableDeclarator > FunctionExpression > should skip VariableDeclarator w/ FunctionExpression with @refresh reload 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload const Foo = function () { return

Foo

; }; if (import.meta.webpackHot) { - _$$decline(\\"webpack5\\", import.meta.webpackHot); + _$$decline("webpack5", import.meta.webpackHot); }" `; @@ -521,96 +551,96 @@ exports[`webpack5 > VariableDeclarator > FunctionExpression > should skip Variab `; exports[`webpack5 > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

Foo

; }, { - location: \\"example.jsx:3:20\\", - signature: \\"a8bc6ac4\\" + location: "example.jsx:3:20", + signature: "a8bc6ac4" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const example = 'Foo'; -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

{example}

; }, { - location: \\"example.jsx:4:20\\", - signature: \\"2264ba41\\", + location: "example.jsx:4:20", + signature: "2264ba41", dependencies: { example } }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with @refresh granular 3`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); // @refresh granular const Example = createContext(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return Foo; }, { - location: \\"example.jsx:4:20\\", - signature: \\"b3df1897\\", + location: "example.jsx:4:20", + signature: "b3df1897", dependencies: { Example } }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with valid Component name and params 1`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function () { +const Foo = _$$component(_REGISTRY, "Foo", function () { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > VariableDeclarator > FunctionExpression > should transform VariableDeclarator w/ FunctionExpression with valid Component name and params 2`] = ` -"import { $$component as _$$component } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; +"import { $$component as _$$component } from "solid-refresh"; +import { $$refresh as _$$refresh } from "solid-refresh"; +import { $$registry as _$$registry } from "solid-refresh"; const _REGISTRY = _$$registry(); -const Foo = _$$component(_REGISTRY, \\"Foo\\", function (props) { +const Foo = _$$component(_REGISTRY, "Foo", function (props) { return

Foo

; }, { - location: \\"example.jsx:2:20\\" + location: "example.jsx:2:20" }); if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); + _$$refresh("webpack5", import.meta.webpackHot, _REGISTRY); }" `; exports[`webpack5 > fix render > @refresh reload > should work 1`] = ` -"import { $$decline as _$$decline } from \\"solid-refresh\\"; +"import { $$decline as _$$decline } from "solid-refresh"; // @refresh reload import { render } from 'solid-js/web'; if (root) { @@ -618,7 +648,7 @@ if (root) { if (import.meta.webpackHot) import.meta.webpackHot.dispose(_cleanup); } if (import.meta.webpackHot) { - _$$decline(\\"webpack5\\", import.meta.webpackHot); + _$$decline("webpack5", import.meta.webpackHot); }" `; @@ -653,15 +683,3 @@ if (root) { if (import.meta.webpackHot) import.meta.webpackHot.dispose(_cleanup); }" `; - -exports[`webpack5 > should support Context API 1`] = ` -"import { $$context as _$$context } from \\"solid-refresh\\"; -import { $$refresh as _$$refresh } from \\"solid-refresh\\"; -import { $$registry as _$$registry } from \\"solid-refresh\\"; -const _REGISTRY = _$$registry(); -import { createContext } from 'solid-js'; -const Example = _$$context(_REGISTRY, \\"Example\\", createContext()); -if (import.meta.webpackHot) { - _$$refresh(\\"webpack5\\", import.meta.webpackHot, _REGISTRY); -}" -`; diff --git a/tests/esm.test.ts b/tests/esm.test.ts index 200e798..4e6ef72 100644 --- a/tests/esm.test.ts +++ b/tests/esm.test.ts @@ -6,9 +6,9 @@ async function transform(code: string) { const result = await babel.transformAsync(code, { plugins: [[plugin, { bundler: 'esm' }]], parserOpts: { - plugins: ['jsx', 'typescript'] + plugins: ['jsx', 'typescript'], }, - filename: 'example.jsx' + filename: 'example.jsx', }); if (result && result.code) { @@ -25,14 +25,14 @@ describe('esm', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with valid Component name and >1 params', async () => { @@ -41,7 +41,7 @@ describe('esm', () => { function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with invalid Component name', async () => { @@ -50,7 +50,7 @@ describe('esm', () => { function foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with @refresh skip', async () => { @@ -60,7 +60,7 @@ describe('esm', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with @refresh reload', async () => { @@ -70,7 +70,7 @@ describe('esm', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform FunctionDeclaration with @refresh granular', async () => { @@ -80,7 +80,7 @@ describe('esm', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -89,7 +89,7 @@ describe('esm', () => { function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -98,7 +98,7 @@ describe('esm', () => { function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -110,14 +110,14 @@ describe('esm', () => { const Foo = function () { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` const Foo = function (props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -126,7 +126,7 @@ describe('esm', () => { const Foo = function (a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with invalid Component name', async () => { @@ -135,7 +135,7 @@ describe('esm', () => { const foo = function () { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with @refresh skip', async () => { @@ -145,7 +145,7 @@ describe('esm', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with @refresh reload', async () => { @@ -155,7 +155,7 @@ describe('esm', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform VariableDeclarator w/ FunctionExpression with @refresh granular', async () => { @@ -165,7 +165,7 @@ describe('esm', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -174,7 +174,7 @@ describe('esm', () => { const Foo = function() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -183,7 +183,7 @@ describe('esm', () => { const Foo = function() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -194,14 +194,14 @@ describe('esm', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` const Foo = (props) => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with valid Component name and >1 params', async () => { @@ -210,7 +210,7 @@ describe('esm', () => { const Foo = (a, b) => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with invalid Component name', async () => { @@ -219,7 +219,7 @@ describe('esm', () => { const foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh skip', async () => { @@ -229,7 +229,7 @@ describe('esm', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh reload', async () => { @@ -239,7 +239,7 @@ describe('esm', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular', async () => { @@ -249,7 +249,7 @@ describe('esm', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -258,7 +258,7 @@ describe('esm', () => { const Foo = () => { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -267,7 +267,7 @@ describe('esm', () => { const Foo = () => { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -279,14 +279,14 @@ describe('esm', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` export function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -295,7 +295,7 @@ describe('esm', () => { export function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with invalid Component name', async () => { @@ -304,7 +304,7 @@ describe('esm', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with @refresh skip', async () => { @@ -314,7 +314,7 @@ describe('esm', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with @refresh reload', async () => { @@ -324,7 +324,7 @@ describe('esm', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular', async () => { @@ -334,7 +334,7 @@ describe('esm', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -343,7 +343,7 @@ describe('esm', () => { export function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -352,7 +352,7 @@ describe('esm', () => { export function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -363,14 +363,14 @@ describe('esm', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` export default function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -379,7 +379,7 @@ describe('esm', () => { export default function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with invalid Component name', async () => { @@ -388,7 +388,7 @@ describe('esm', () => { export default function foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh skip', async () => { @@ -398,7 +398,7 @@ describe('esm', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh reload', async () => { @@ -408,7 +408,7 @@ describe('esm', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular', async () => { @@ -418,7 +418,7 @@ describe('esm', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -427,7 +427,7 @@ describe('esm', () => { export default function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -436,18 +436,40 @@ describe('esm', () => { export default function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); - it('should support Context API', async () => { - expect( - await transform(` - import { createContext } from 'solid-js'; - - const Example = createContext(); - `) - ).toMatchSnapshot(); + describe('Context API', () => { + it('should support top-level VariableDeclaration', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + const Example = createContext(); + `), + ).toMatchSnapshot(); + }); + it('should support ExportNamedDeclaration', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + export const Example = createContext(); + `), + ).toMatchSnapshot(); + }); + it('should not support VariableDeclaration that is not top-level', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + if (someCond) { + const Example = createContext(); + } + `), + ).toMatchSnapshot(); + }); }); describe('fix render', () => { describe('import specifiers', () => { @@ -457,7 +479,7 @@ describe('esm', () => { import { render } from 'solid-js/web'; render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportSpecifier + aliased Identifier', async () => { @@ -466,7 +488,7 @@ describe('esm', () => { import { render as Render } from 'solid-js/web'; Render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportSpecifier + aliased Identifier from StringLiteral', async () => { @@ -475,7 +497,7 @@ describe('esm', () => { import { 'render' as Render } from 'solid-js/web'; Render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportNamespaceSpecifier', async () => { @@ -484,11 +506,11 @@ describe('esm', () => { import * as solidWeb from 'solid-js/web'; solidWeb.render(() => , root); - `) + `), ).toMatchSnapshot(); }); }); - describe('top-level statements', async () => { + describe('top-level statements', () => { it('should work with IfStatement', async () => { expect( await transform(` @@ -497,7 +519,7 @@ describe('esm', () => { if (root) { render(() => , root); } - `) + `), ).toMatchSnapshot(); }); }); @@ -511,7 +533,7 @@ describe('esm', () => { if (root) { render(() => , root); } - `) + `), ).toMatchSnapshot(); }); }); diff --git a/tests/rspack-esm.test.ts b/tests/rspack-esm.test.ts index 86f432e..d8ba60f 100644 --- a/tests/rspack-esm.test.ts +++ b/tests/rspack-esm.test.ts @@ -6,9 +6,9 @@ async function transform(code: string) { const result = await babel.transformAsync(code, { plugins: [[plugin, { bundler: 'rspack-esm' }]], parserOpts: { - plugins: ['jsx', 'typescript'] + plugins: ['jsx', 'typescript'], }, - filename: 'example.jsx' + filename: 'example.jsx', }); if (result && result.code) { @@ -25,14 +25,14 @@ describe('rspack-esm', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with valid Component name and >1 params', async () => { @@ -41,7 +41,7 @@ describe('rspack-esm', () => { function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with invalid Component name', async () => { @@ -50,7 +50,7 @@ describe('rspack-esm', () => { function foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with @refresh skip', async () => { @@ -60,7 +60,7 @@ describe('rspack-esm', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with @refresh reload', async () => { @@ -70,7 +70,7 @@ describe('rspack-esm', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform FunctionDeclaration with @refresh granular', async () => { @@ -80,7 +80,7 @@ describe('rspack-esm', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -89,7 +89,7 @@ describe('rspack-esm', () => { function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -98,7 +98,7 @@ describe('rspack-esm', () => { function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -110,14 +110,14 @@ describe('rspack-esm', () => { const Foo = function () { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` const Foo = function (props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -126,7 +126,7 @@ describe('rspack-esm', () => { const Foo = function (a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with invalid Component name', async () => { @@ -135,7 +135,7 @@ describe('rspack-esm', () => { const foo = function () { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with @refresh skip', async () => { @@ -145,7 +145,7 @@ describe('rspack-esm', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with @refresh reload', async () => { @@ -155,7 +155,7 @@ describe('rspack-esm', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform VariableDeclarator w/ FunctionExpression with @refresh granular', async () => { @@ -165,7 +165,7 @@ describe('rspack-esm', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -174,7 +174,7 @@ describe('rspack-esm', () => { const Foo = function() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -183,7 +183,7 @@ describe('rspack-esm', () => { const Foo = function() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -194,14 +194,14 @@ describe('rspack-esm', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` const Foo = (props) => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with valid Component name and >1 params', async () => { @@ -210,7 +210,7 @@ describe('rspack-esm', () => { const Foo = (a, b) => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with invalid Component name', async () => { @@ -219,7 +219,7 @@ describe('rspack-esm', () => { const foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh skip', async () => { @@ -229,7 +229,7 @@ describe('rspack-esm', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh reload', async () => { @@ -239,7 +239,7 @@ describe('rspack-esm', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular', async () => { @@ -249,7 +249,7 @@ describe('rspack-esm', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -258,7 +258,7 @@ describe('rspack-esm', () => { const Foo = () => { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -267,7 +267,7 @@ describe('rspack-esm', () => { const Foo = () => { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -279,14 +279,14 @@ describe('rspack-esm', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` export function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -295,7 +295,7 @@ describe('rspack-esm', () => { export function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with invalid Component name', async () => { @@ -304,7 +304,7 @@ describe('rspack-esm', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with @refresh skip', async () => { @@ -314,7 +314,7 @@ describe('rspack-esm', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with @refresh reload', async () => { @@ -324,7 +324,7 @@ describe('rspack-esm', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular', async () => { @@ -334,7 +334,7 @@ describe('rspack-esm', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -343,7 +343,7 @@ describe('rspack-esm', () => { export function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -352,7 +352,7 @@ describe('rspack-esm', () => { export function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -363,14 +363,14 @@ describe('rspack-esm', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` export default function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -379,7 +379,7 @@ describe('rspack-esm', () => { export default function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with invalid Component name', async () => { @@ -388,7 +388,7 @@ describe('rspack-esm', () => { export default function foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh skip', async () => { @@ -398,7 +398,7 @@ describe('rspack-esm', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh reload', async () => { @@ -408,7 +408,7 @@ describe('rspack-esm', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular', async () => { @@ -418,7 +418,7 @@ describe('rspack-esm', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -427,7 +427,7 @@ describe('rspack-esm', () => { export default function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -436,18 +436,40 @@ describe('rspack-esm', () => { export default function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); - it('should support Context API', async () => { - expect( - await transform(` - import { createContext } from 'solid-js'; - - const Example = createContext(); - `) - ).toMatchSnapshot(); + describe('Context API', () => { + it('should support top-level VariableDeclaration', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + const Example = createContext(); + `), + ).toMatchSnapshot(); + }); + it('should support ExportNamedDeclaration', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + export const Example = createContext(); + `), + ).toMatchSnapshot(); + }); + it('should not support VariableDeclaration that is not top-level', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + if (someCond) { + const Example = createContext(); + } + `), + ).toMatchSnapshot(); + }); }); describe('fix render', () => { describe('import specifiers', () => { @@ -457,7 +479,7 @@ describe('rspack-esm', () => { import { render } from 'solid-js/web'; render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportSpecifier + aliased Identifier', async () => { @@ -466,7 +488,7 @@ describe('rspack-esm', () => { import { render as Render } from 'solid-js/web'; Render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportSpecifier + aliased Identifier from StringLiteral', async () => { @@ -475,7 +497,7 @@ describe('rspack-esm', () => { import { 'render' as Render } from 'solid-js/web'; Render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportNamespaceSpecifier', async () => { @@ -484,11 +506,11 @@ describe('rspack-esm', () => { import * as solidWeb from 'solid-js/web'; solidWeb.render(() => , root); - `) + `), ).toMatchSnapshot(); }); }); - describe('top-level statements', async () => { + describe('top-level statements', () => { it('should work with IfStatement', async () => { expect( await transform(` @@ -497,7 +519,7 @@ describe('rspack-esm', () => { if (root) { render(() => , root); } - `) + `), ).toMatchSnapshot(); }); }); @@ -511,7 +533,7 @@ describe('rspack-esm', () => { if (root) { render(() => , root); } - `) + `), ).toMatchSnapshot(); }); }); diff --git a/tests/standard.test.ts b/tests/standard.test.ts index 7e527d3..33507bc 100644 --- a/tests/standard.test.ts +++ b/tests/standard.test.ts @@ -6,9 +6,9 @@ async function transform(code: string) { const result = await babel.transformAsync(code, { plugins: [[plugin, { bundler: 'standard' }]], parserOpts: { - plugins: ['jsx', 'typescript'] + plugins: ['jsx', 'typescript'], }, - filename: 'example.jsx' + filename: 'example.jsx', }); if (result && result.code) { @@ -25,14 +25,14 @@ describe('vite', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with valid Component name and >1 params', async () => { @@ -41,7 +41,7 @@ describe('vite', () => { function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with invalid Component name', async () => { @@ -50,7 +50,7 @@ describe('vite', () => { function foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with @refresh skip', async () => { @@ -60,7 +60,7 @@ describe('vite', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with @refresh reload', async () => { @@ -70,7 +70,7 @@ describe('vite', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform FunctionDeclaration with @refresh granular', async () => { @@ -80,7 +80,7 @@ describe('vite', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -89,7 +89,7 @@ describe('vite', () => { function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -98,7 +98,7 @@ describe('vite', () => { function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -110,14 +110,14 @@ describe('vite', () => { const Foo = function () { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` const Foo = function (props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -126,7 +126,7 @@ describe('vite', () => { const Foo = function (a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with invalid Component name', async () => { @@ -135,7 +135,7 @@ describe('vite', () => { const foo = function () { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with @refresh skip', async () => { @@ -145,7 +145,7 @@ describe('vite', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with @refresh reload', async () => { @@ -155,7 +155,7 @@ describe('vite', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform VariableDeclarator w/ FunctionExpression with @refresh granular', async () => { @@ -165,7 +165,7 @@ describe('vite', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -174,7 +174,7 @@ describe('vite', () => { const Foo = function() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -183,7 +183,7 @@ describe('vite', () => { const Foo = function() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -194,14 +194,14 @@ describe('vite', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` const Foo = (props) => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with valid Component name and >1 params', async () => { @@ -210,7 +210,7 @@ describe('vite', () => { const Foo = (a, b) => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with invalid Component name', async () => { @@ -219,7 +219,7 @@ describe('vite', () => { const foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh skip', async () => { @@ -229,7 +229,7 @@ describe('vite', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh reload', async () => { @@ -239,7 +239,7 @@ describe('vite', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular', async () => { @@ -249,7 +249,7 @@ describe('vite', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -258,7 +258,7 @@ describe('vite', () => { const Foo = () => { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -267,7 +267,7 @@ describe('vite', () => { const Foo = () => { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -279,14 +279,14 @@ describe('vite', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` export function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -295,7 +295,7 @@ describe('vite', () => { export function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with invalid Component name', async () => { @@ -304,7 +304,7 @@ describe('vite', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with @refresh skip', async () => { @@ -314,7 +314,7 @@ describe('vite', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with @refresh reload', async () => { @@ -324,7 +324,7 @@ describe('vite', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular', async () => { @@ -334,7 +334,7 @@ describe('vite', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -343,7 +343,7 @@ describe('vite', () => { export function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -352,7 +352,7 @@ describe('vite', () => { export function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -363,14 +363,14 @@ describe('vite', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` export default function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -379,7 +379,7 @@ describe('vite', () => { export default function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with invalid Component name', async () => { @@ -388,7 +388,7 @@ describe('vite', () => { export default function foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh skip', async () => { @@ -398,7 +398,7 @@ describe('vite', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh reload', async () => { @@ -408,7 +408,7 @@ describe('vite', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular', async () => { @@ -418,7 +418,7 @@ describe('vite', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -427,7 +427,7 @@ describe('vite', () => { export default function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -436,18 +436,40 @@ describe('vite', () => { export default function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); - it('should support Context API', async () => { - expect( - await transform(` - import { createContext } from 'solid-js'; - - const Example = createContext(); - `) - ).toMatchSnapshot(); + describe('Context API', () => { + it('should support top-level VariableDeclaration', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + const Example = createContext(); + `), + ).toMatchSnapshot(); + }); + it('should support ExportNamedDeclaration', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + export const Example = createContext(); + `), + ).toMatchSnapshot(); + }); + it('should not support VariableDeclaration that is not top-level', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + if (someCond) { + const Example = createContext(); + } + `), + ).toMatchSnapshot(); + }); }); describe('fix render', () => { describe('import specifiers', () => { @@ -457,7 +479,7 @@ describe('vite', () => { import { render } from 'solid-js/web'; render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportSpecifier + aliased Identifier', async () => { @@ -466,7 +488,7 @@ describe('vite', () => { import { render as Render } from 'solid-js/web'; Render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportSpecifier + aliased Identifier from StringLiteral', async () => { @@ -475,7 +497,7 @@ describe('vite', () => { import { 'render' as Render } from 'solid-js/web'; Render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportNamespaceSpecifier', async () => { @@ -484,11 +506,11 @@ describe('vite', () => { import * as solidWeb from 'solid-js/web'; solidWeb.render(() => , root); - `) + `), ).toMatchSnapshot(); }); }); - describe('top-level statements', async () => { + describe('top-level statements', () => { it('should work with IfStatement', async () => { expect( await transform(` @@ -497,7 +519,7 @@ describe('vite', () => { if (root) { render(() => , root); } - `) + `), ).toMatchSnapshot(); }); }); @@ -511,7 +533,7 @@ describe('vite', () => { if (root) { render(() => , root); } - `) + `), ).toMatchSnapshot(); }); }); diff --git a/tests/vite.test.ts b/tests/vite.test.ts index 7b00683..dc09d58 100644 --- a/tests/vite.test.ts +++ b/tests/vite.test.ts @@ -6,9 +6,9 @@ async function transform(code: string) { const result = await babel.transformAsync(code, { plugins: [[plugin, { bundler: 'vite' }]], parserOpts: { - plugins: ['jsx', 'typescript'] + plugins: ['jsx', 'typescript'], }, - filename: 'example.jsx' + filename: 'example.jsx', }); if (result && result.code) { @@ -25,14 +25,14 @@ describe('vite', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with valid Component name and >1 params', async () => { @@ -41,7 +41,7 @@ describe('vite', () => { function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with invalid Component name', async () => { @@ -50,7 +50,7 @@ describe('vite', () => { function foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with @refresh skip', async () => { @@ -60,7 +60,7 @@ describe('vite', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with @refresh reload', async () => { @@ -70,7 +70,7 @@ describe('vite', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform FunctionDeclaration with @refresh granular', async () => { @@ -80,7 +80,7 @@ describe('vite', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -89,7 +89,7 @@ describe('vite', () => { function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -98,7 +98,7 @@ describe('vite', () => { function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -110,14 +110,14 @@ describe('vite', () => { const Foo = function () { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` const Foo = function (props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -126,7 +126,7 @@ describe('vite', () => { const Foo = function (a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with invalid Component name', async () => { @@ -135,7 +135,7 @@ describe('vite', () => { const foo = function () { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with @refresh skip', async () => { @@ -145,7 +145,7 @@ describe('vite', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with @refresh reload', async () => { @@ -155,7 +155,7 @@ describe('vite', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform VariableDeclarator w/ FunctionExpression with @refresh granular', async () => { @@ -165,7 +165,7 @@ describe('vite', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -174,7 +174,7 @@ describe('vite', () => { const Foo = function() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -183,7 +183,7 @@ describe('vite', () => { const Foo = function() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -194,14 +194,14 @@ describe('vite', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` const Foo = (props) => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with valid Component name and >1 params', async () => { @@ -210,7 +210,7 @@ describe('vite', () => { const Foo = (a, b) => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with invalid Component name', async () => { @@ -219,7 +219,7 @@ describe('vite', () => { const foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh skip', async () => { @@ -229,7 +229,7 @@ describe('vite', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh reload', async () => { @@ -239,7 +239,7 @@ describe('vite', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular', async () => { @@ -249,7 +249,7 @@ describe('vite', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -258,7 +258,7 @@ describe('vite', () => { const Foo = () => { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -267,7 +267,7 @@ describe('vite', () => { const Foo = () => { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -279,14 +279,14 @@ describe('vite', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` export function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -295,7 +295,7 @@ describe('vite', () => { export function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with invalid Component name', async () => { @@ -304,7 +304,7 @@ describe('vite', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with @refresh skip', async () => { @@ -314,7 +314,7 @@ describe('vite', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with @refresh reload', async () => { @@ -324,7 +324,7 @@ describe('vite', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular', async () => { @@ -334,7 +334,7 @@ describe('vite', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -343,7 +343,7 @@ describe('vite', () => { export function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -352,7 +352,7 @@ describe('vite', () => { export function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -363,14 +363,14 @@ describe('vite', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` export default function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -379,7 +379,7 @@ describe('vite', () => { export default function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with invalid Component name', async () => { @@ -388,7 +388,7 @@ describe('vite', () => { export default function foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh skip', async () => { @@ -398,7 +398,7 @@ describe('vite', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh reload', async () => { @@ -408,7 +408,7 @@ describe('vite', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular', async () => { @@ -418,7 +418,7 @@ describe('vite', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -427,7 +427,7 @@ describe('vite', () => { export default function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -436,18 +436,40 @@ describe('vite', () => { export default function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); - it('should support Context API', async () => { - expect( - await transform(` - import { createContext } from 'solid-js'; - - const Example = createContext(); - `) - ).toMatchSnapshot(); + describe('Context API', () => { + it('should support top-level VariableDeclaration', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + const Example = createContext(); + `), + ).toMatchSnapshot(); + }); + it('should support ExportNamedDeclaration', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + export const Example = createContext(); + `), + ).toMatchSnapshot(); + }); + it('should not support VariableDeclaration that is not top-level', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + if (someCond) { + const Example = createContext(); + } + `), + ).toMatchSnapshot(); + }); }); describe('fix render', () => { describe('import specifiers', () => { @@ -457,7 +479,7 @@ describe('vite', () => { import { render } from 'solid-js/web'; render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportSpecifier + aliased Identifier', async () => { @@ -466,7 +488,7 @@ describe('vite', () => { import { render as Render } from 'solid-js/web'; Render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportSpecifier + aliased Identifier from StringLiteral', async () => { @@ -475,7 +497,7 @@ describe('vite', () => { import { 'render' as Render } from 'solid-js/web'; Render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportNamespaceSpecifier', async () => { @@ -484,11 +506,11 @@ describe('vite', () => { import * as solidWeb from 'solid-js/web'; solidWeb.render(() => , root); - `) + `), ).toMatchSnapshot(); }); }); - describe('top-level statements', async () => { + describe('top-level statements', () => { it('should work with IfStatement', async () => { expect( await transform(` @@ -497,7 +519,7 @@ describe('vite', () => { if (root) { render(() => , root); } - `) + `), ).toMatchSnapshot(); }); }); @@ -511,7 +533,7 @@ describe('vite', () => { if (root) { render(() => , root); } - `) + `), ).toMatchSnapshot(); }); }); diff --git a/tests/webpack5.test.ts b/tests/webpack5.test.ts index 7c67470..d5c0bc9 100644 --- a/tests/webpack5.test.ts +++ b/tests/webpack5.test.ts @@ -6,9 +6,9 @@ async function transform(code: string) { const result = await babel.transformAsync(code, { plugins: [[plugin, { bundler: 'webpack5' }]], parserOpts: { - plugins: ['jsx', 'typescript'] + plugins: ['jsx', 'typescript'], }, - filename: 'example.jsx' + filename: 'example.jsx', }); if (result && result.code) { @@ -25,14 +25,14 @@ describe('webpack5', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with valid Component name and >1 params', async () => { @@ -41,7 +41,7 @@ describe('webpack5', () => { function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with invalid Component name', async () => { @@ -50,7 +50,7 @@ describe('webpack5', () => { function foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with @refresh skip', async () => { @@ -60,7 +60,7 @@ describe('webpack5', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip FunctionDeclaration with @refresh reload', async () => { @@ -70,7 +70,7 @@ describe('webpack5', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform FunctionDeclaration with @refresh granular', async () => { @@ -80,7 +80,7 @@ describe('webpack5', () => { function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -89,7 +89,7 @@ describe('webpack5', () => { function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -98,7 +98,7 @@ describe('webpack5', () => { function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -110,14 +110,14 @@ describe('webpack5', () => { const Foo = function () { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` const Foo = function (props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -126,7 +126,7 @@ describe('webpack5', () => { const Foo = function (a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with invalid Component name', async () => { @@ -135,7 +135,7 @@ describe('webpack5', () => { const foo = function () { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with @refresh skip', async () => { @@ -145,7 +145,7 @@ describe('webpack5', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ FunctionExpression with @refresh reload', async () => { @@ -155,7 +155,7 @@ describe('webpack5', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform VariableDeclarator w/ FunctionExpression with @refresh granular', async () => { @@ -165,7 +165,7 @@ describe('webpack5', () => { const Foo = function() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -174,7 +174,7 @@ describe('webpack5', () => { const Foo = function() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -183,7 +183,7 @@ describe('webpack5', () => { const Foo = function() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -194,14 +194,14 @@ describe('webpack5', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` const Foo = (props) => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with valid Component name and >1 params', async () => { @@ -210,7 +210,7 @@ describe('webpack5', () => { const Foo = (a, b) => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with invalid Component name', async () => { @@ -219,7 +219,7 @@ describe('webpack5', () => { const foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh skip', async () => { @@ -229,7 +229,7 @@ describe('webpack5', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip VariableDeclarator w/ ArrowFunctionExpression with @refresh reload', async () => { @@ -239,7 +239,7 @@ describe('webpack5', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform VariableDeclarator w/ ArrowFunctionExpression with @refresh granular', async () => { @@ -249,7 +249,7 @@ describe('webpack5', () => { const Foo = () => { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -258,7 +258,7 @@ describe('webpack5', () => { const Foo = () => { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -267,7 +267,7 @@ describe('webpack5', () => { const Foo = () => { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -279,14 +279,14 @@ describe('webpack5', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` export function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -295,7 +295,7 @@ describe('webpack5', () => { export function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with invalid Component name', async () => { @@ -304,7 +304,7 @@ describe('webpack5', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with @refresh skip', async () => { @@ -314,7 +314,7 @@ describe('webpack5', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportNamedDeclaration w/ FunctionExpression with @refresh reload', async () => { @@ -324,7 +324,7 @@ describe('webpack5', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform ExportNamedDeclaration w/ FunctionExpression with @refresh granular', async () => { @@ -334,7 +334,7 @@ describe('webpack5', () => { export function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -343,7 +343,7 @@ describe('webpack5', () => { export function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -352,7 +352,7 @@ describe('webpack5', () => { export function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); @@ -363,14 +363,14 @@ describe('webpack5', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` export default function Foo(props) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with valid Component name and >1 params', async () => { @@ -379,7 +379,7 @@ describe('webpack5', () => { export default function Foo(a, b) { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with invalid Component name', async () => { @@ -388,7 +388,7 @@ describe('webpack5', () => { export default function foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh skip', async () => { @@ -398,7 +398,7 @@ describe('webpack5', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should skip ExportDefaultDeclaration w/ FunctionExpression with @refresh reload', async () => { @@ -408,7 +408,7 @@ describe('webpack5', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); }); it('should transform ExportDefaultDeclaration w/ FunctionExpression with @refresh granular', async () => { @@ -418,7 +418,7 @@ describe('webpack5', () => { export default function Foo() { return

Foo

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -427,7 +427,7 @@ describe('webpack5', () => { export default function Foo() { return

{example}

; } - `) + `), ).toMatchSnapshot(); expect( await transform(` @@ -436,18 +436,40 @@ describe('webpack5', () => { export default function Foo() { return Foo; } - `) + `), ).toMatchSnapshot(); }); }); - it('should support Context API', async () => { - expect( - await transform(` - import { createContext } from 'solid-js'; - - const Example = createContext(); - `) - ).toMatchSnapshot(); + describe('Context API', () => { + it('should support top-level VariableDeclaration', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + const Example = createContext(); + `), + ).toMatchSnapshot(); + }); + it('should support ExportNamedDeclaration', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + export const Example = createContext(); + `), + ).toMatchSnapshot(); + }); + it('should not support VariableDeclaration that is not top-level', async () => { + expect( + await transform(` + import { createContext } from 'solid-js'; + + if (someCond) { + const Example = createContext(); + } + `), + ).toMatchSnapshot(); + }); }); describe('fix render', () => { describe('import specifiers', () => { @@ -457,7 +479,7 @@ describe('webpack5', () => { import { render } from 'solid-js/web'; render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportSpecifier + aliased Identifier', async () => { @@ -466,7 +488,7 @@ describe('webpack5', () => { import { render as Render } from 'solid-js/web'; Render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportSpecifier + aliased Identifier from StringLiteral', async () => { @@ -475,7 +497,7 @@ describe('webpack5', () => { import { 'render' as Render } from 'solid-js/web'; Render(() => , root); - `) + `), ).toMatchSnapshot(); }); it('should work with ImportNamespaceSpecifier', async () => { @@ -484,11 +506,11 @@ describe('webpack5', () => { import * as solidWeb from 'solid-js/web'; solidWeb.render(() => , root); - `) + `), ).toMatchSnapshot(); }); }); - describe('top-level statements', async () => { + describe('top-level statements', () => { it('should work with IfStatement', async () => { expect( await transform(` @@ -497,7 +519,7 @@ describe('webpack5', () => { if (root) { render(() => , root); } - `) + `), ).toMatchSnapshot(); }); }); @@ -511,7 +533,7 @@ describe('webpack5', () => { if (root) { render(() => , root); } - `) + `), ).toMatchSnapshot(); }); }); diff --git a/tsconfig.json b/tsconfig.json index bc488b2..3f37f22 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,10 +1,17 @@ - - { - "exclude": ["node_modules", "tests"], - "include": ["src"], +{ + "exclude": [ + "node_modules", + "tests" + ], + "include": [ + "src" + ], "compilerOptions": { "module": "ESNext", - "lib": ["ESNext", "DOM"], + "lib": [ + "ESNext", + "DOM" + ], "importHelpers": true, "sourceMap": true, "rootDir": "./", @@ -18,6 +25,8 @@ "esModuleInterop": true, "target": "ES2017", "declaration": true, - "outDir": "types" + "outDir": "types", + "useDefineForClassFields": false, + "declarationMap": true } -} +} \ No newline at end of file