@aamini/config 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vitest.shared.mjs +1 -1
- package/dist/vitest.shared.mjs.map +1 -1
- package/package.json +9 -6
- package/vitest.shared.ts +1 -1
package/dist/vitest.shared.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.shared.mjs","names":[],"sources":["../vitest.shared.ts"],"sourcesContent":["import tailwindcss from '@tailwindcss/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport { playwright } from '@vitest/browser-playwright'\nimport { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { Plugin } from 'vite'\nimport svgr from 'vite-plugin-svgr'\nimport {\n\tdefineConfig,\n\tmergeConfig,\n\ttype TestProjectConfiguration,\n\ttype TestProjectInlineConfiguration,\n\ttype ViteUserConfig,\n} from 'vitest/config'\n\nconst HANDLER_LOCATIONS = [\n\t'__mocks__/handlers.ts',\n\t'__mocks__/handlers.js',\n\t'src/mocks/handlers.ts',\n\t'src/mocks/handlers.js',\n]\n\nconst STYLES_LOCATIONS = ['src/styles.css', 'src/index.css', 'src/app.css']\n\nfunction mswHandlersPlugin(): Plugin {\n\tconst virtualModuleId = '@test/handlers'\n\tconst resolvedVirtualModuleId = '\\0' + virtualModuleId\n\n\treturn {\n\t\tname: 'msw-handlers-resolver',\n\t\tresolveId(id) {\n\t\t\tif (id === virtualModuleId) {\n\t\t\t\treturn resolvedVirtualModuleId\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t\tload(id) {\n\t\t\tif (id === resolvedVirtualModuleId) {\n\t\t\t\tconst cwd = process.cwd()\n\t\t\t\tfor (const location of HANDLER_LOCATIONS) {\n\t\t\t\t\tconst fullPath = resolve(cwd, location)\n\t\t\t\t\tif (existsSync(fullPath)) {\n\t\t\t\t\t\treturn `export { default } from '${fullPath}'`\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`No MSW handlers found. Expected one of:\\n${HANDLER_LOCATIONS.map((l) => ` - ${resolve(cwd, l)}`).join('\\n')}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t}\n}\n\nfunction stylesPlugin(): Plugin {\n\tconst virtualModuleId = '@test/styles'\n\tconst resolvedVirtualModuleId = '\\0' + virtualModuleId\n\n\treturn {\n\t\tname: 'styles-resolver',\n\t\tresolveId(id) {\n\t\t\tif (id === virtualModuleId) {\n\t\t\t\treturn resolvedVirtualModuleId\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t\tload(id) {\n\t\t\tif (id === resolvedVirtualModuleId) {\n\t\t\t\tconst cwd = process.cwd()\n\t\t\t\tfor (const location of STYLES_LOCATIONS) {\n\t\t\t\t\tconst fullPath = resolve(cwd, location)\n\t\t\t\t\tif (existsSync(fullPath)) {\n\t\t\t\t\t\treturn `import '${fullPath}'`\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`No styles file found. Expected one of:\\n${STYLES_LOCATIONS.map((l) => ` - ${resolve(cwd, l)}`).join('\\n')}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t}\n}\n\nconst stylesSetup =
|
|
1
|
+
{"version":3,"file":"vitest.shared.mjs","names":[],"sources":["../vitest.shared.ts"],"sourcesContent":["import tailwindcss from '@tailwindcss/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport { playwright } from '@vitest/browser-playwright'\nimport { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { Plugin } from 'vite'\nimport svgr from 'vite-plugin-svgr'\nimport {\n\tdefineConfig,\n\tmergeConfig,\n\ttype TestProjectConfiguration,\n\ttype TestProjectInlineConfiguration,\n\ttype ViteUserConfig,\n} from 'vitest/config'\n\nconst HANDLER_LOCATIONS = [\n\t'__mocks__/handlers.ts',\n\t'__mocks__/handlers.js',\n\t'src/mocks/handlers.ts',\n\t'src/mocks/handlers.js',\n]\n\nconst STYLES_LOCATIONS = ['src/styles.css', 'src/index.css', 'src/app.css']\n\nfunction mswHandlersPlugin(): Plugin {\n\tconst virtualModuleId = '@test/handlers'\n\tconst resolvedVirtualModuleId = '\\0' + virtualModuleId\n\n\treturn {\n\t\tname: 'msw-handlers-resolver',\n\t\tresolveId(id) {\n\t\t\tif (id === virtualModuleId) {\n\t\t\t\treturn resolvedVirtualModuleId\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t\tload(id) {\n\t\t\tif (id === resolvedVirtualModuleId) {\n\t\t\t\tconst cwd = process.cwd()\n\t\t\t\tfor (const location of HANDLER_LOCATIONS) {\n\t\t\t\t\tconst fullPath = resolve(cwd, location)\n\t\t\t\t\tif (existsSync(fullPath)) {\n\t\t\t\t\t\treturn `export { default } from '${fullPath}'`\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`No MSW handlers found. Expected one of:\\n${HANDLER_LOCATIONS.map((l) => ` - ${resolve(cwd, l)}`).join('\\n')}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t}\n}\n\nfunction stylesPlugin(): Plugin {\n\tconst virtualModuleId = '@test/styles'\n\tconst resolvedVirtualModuleId = '\\0' + virtualModuleId\n\n\treturn {\n\t\tname: 'styles-resolver',\n\t\tresolveId(id) {\n\t\t\tif (id === virtualModuleId) {\n\t\t\t\treturn resolvedVirtualModuleId\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t\tload(id) {\n\t\t\tif (id === resolvedVirtualModuleId) {\n\t\t\t\tconst cwd = process.cwd()\n\t\t\t\tfor (const location of STYLES_LOCATIONS) {\n\t\t\t\t\tconst fullPath = resolve(cwd, location)\n\t\t\t\t\tif (existsSync(fullPath)) {\n\t\t\t\t\t\treturn `import '${fullPath}'`\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`No styles file found. Expected one of:\\n${STYLES_LOCATIONS.map((l) => ` - ${resolve(cwd, l)}`).join('\\n')}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\t}\n}\n\nconst stylesSetup = '@aamini/config/setup/styles'\n\nfunction asPlugins(plugins: unknown[]): NonNullable<ViteUserConfig['plugins']> {\n\treturn plugins as NonNullable<ViteUserConfig['plugins']>\n}\n\nfunction mergeProjectConfig(\n\tbase: TestProjectConfiguration,\n\toverrides: TestProjectConfiguration = {},\n): TestProjectConfiguration {\n\treturn mergeConfig(\n\t\tbase as Record<string, any>,\n\t\toverrides as Record<string, any>,\n\t) as TestProjectConfiguration\n}\n\n// Auto-detect app-level vitest.setup.ts for custom setup (e.g., MSW server)\nconst localSetup = resolve(process.cwd(), 'vitest.setup.ts')\nconst hasLocalSetup = existsSync(localSetup)\n\ninterface ProjectOverrides {\n\tserver?: TestProjectConfiguration\n\tbrowser?: TestProjectConfiguration\n}\n\nexport const createBaseConfig = (\n\toverrides: TestProjectInlineConfiguration,\n\tprojectOverrides: ProjectOverrides = {},\n) =>\n\tmergeConfig(\n\t\tdefineConfig({\n\t\t\tresolve: {\n\t\t\t\ttsconfigPaths: true,\n\t\t\t},\n\t\t\tplugins: asPlugins([\n\t\t\t\ttailwindcss(),\n\t\t\t\tviteReact({\n\t\t\t\t\tbabel: {\n\t\t\t\t\t\tplugins: ['babel-plugin-react-compiler'],\n\t\t\t\t\t},\n\t\t\t\t} as Parameters<typeof viteReact>[0]),\n\t\t\t\tsvgr({\n\t\t\t\t\tinclude: '**/*.svg',\n\t\t\t\t\tsvgrOptions: { exportType: 'default' },\n\t\t\t\t}),\n\t\t\t]),\n\t\t\ttest: {\n\t\t\t\tpassWithNoTests: true,\n\t\t\t\tprojects: [\n\t\t\t\t\t{\n\t\t\t\t\t\textends: true,\n\t\t\t\t\t\ttest: {\n\t\t\t\t\t\t\tname: 'unit',\n\t\t\t\t\t\t\tinclude: ['src/**/*.test.unit.ts'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tmergeProjectConfig(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\textends: true,\n\t\t\t\t\t\t\tplugins: [mswHandlersPlugin()],\n\t\t\t\t\t\t\ttest: {\n\t\t\t\t\t\t\t\tname: 'server',\n\t\t\t\t\t\t\t\tinclude: ['src/**/*.test.ts'],\n\t\t\t\t\t\t\t\ttestTimeout: 30_000,\n\t\t\t\t\t\t\t\tfileParallelism: false,\n\t\t\t\t\t\t\t\tsetupFiles: hasLocalSetup ? [localSetup] : [],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} satisfies TestProjectConfiguration,\n\t\t\t\t\t\tprojectOverrides.server ?? {},\n\t\t\t\t\t),\n\t\t\t\t\tmergeProjectConfig(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\textends: true,\n\t\t\t\t\t\t\tplugins: [mswHandlersPlugin(), stylesPlugin()],\n\t\t\t\t\t\t\ttest: {\n\t\t\t\t\t\t\t\tname: 'browser',\n\t\t\t\t\t\t\t\tinclude: ['src/**/*.test.tsx', 'tests/**/*.test.tsx'],\n\t\t\t\t\t\t\t\tsetupFiles: [stylesSetup],\n\t\t\t\t\t\t\t\tbrowser: {\n\t\t\t\t\t\t\t\t\tinstances: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tbrowser: 'chromium',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\tprovider: playwright(),\n\t\t\t\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\t\t\t\theadless: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} satisfies TestProjectConfiguration,\n\t\t\t\t\t\tprojectOverrides.browser ?? {},\n\t\t\t\t\t),\n\t\t\t\t],\n\t\t\t},\n\t\t}),\n\t\toverrides,\n\t)\n\nexport const baseConfig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,WAAW,WAAW;AAO5C,MAAa,oBACZ,WACA,mBAAqC,EAAE,KAEvC,YACC,aAAa;CACZ,SAAS,EACR,eAAe,MACf;CACD,SAAS,UAAU;EAClB,aAAa;EACb,UAAU,EACT,OAAO,EACN,SAAS,CAAC,8BAA8B,EACxC,EACD,CAAoC;EACrC,KAAK;GACJ,SAAS;GACT,aAAa,EAAE,YAAY,WAAW;GACtC,CAAC;EACF,CAAC;CACF,MAAM;EACL,iBAAiB;EACjB,UAAU;GACT;IACC,SAAS;IACT,MAAM;KACL,MAAM;KACN,SAAS,CAAC,wBAAwB;KAClC;IACD;GACD,mBACC;IACC,SAAS;IACT,SAAS,CAAC,mBAAmB,CAAC;IAC9B,MAAM;KACL,MAAM;KACN,SAAS,CAAC,mBAAmB;KAC7B,aAAa;KACb,iBAAiB;KACjB,YAAY,gBAAgB,CAAC,WAAW,GAAG,EAAE;KAC7C;IACD,EACD,iBAAiB,UAAU,EAAE,CAC7B;GACD,mBACC;IACC,SAAS;IACT,SAAS,CAAC,mBAAmB,EAAE,cAAc,CAAC;IAC9C,MAAM;KACL,MAAM;KACN,SAAS,CAAC,qBAAqB,sBAAsB;KACrD,YAAY,CAAC,YAAY;KACzB,SAAS;MACR,WAAW,CACV,EACC,SAAS,YACT,CACD;MACD,UAAU,YAAY;MACtB,SAAS;MACT,UAAU;MACV;KACD;IACD,EACD,iBAAiB,WAAW,EAAE,CAC9B;GACD;EACD;CACD,CAAC,EACF,UACA;AAEF,MAAa,aAAa,iBAAiB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aamini/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/
|
|
8
|
+
"url": "https://github.com/aria-amini/toolkit",
|
|
9
9
|
"directory": "packages/config"
|
|
10
10
|
},
|
|
11
|
-
"
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/aria-amini/toolkit/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/aria-amini/toolkit/tree/main/packages/config#readme",
|
|
12
15
|
"publishConfig": {
|
|
13
16
|
"access": "public"
|
|
14
17
|
},
|
|
@@ -33,9 +36,9 @@
|
|
|
33
36
|
"default": "./dist/playwright.shared.config.mjs"
|
|
34
37
|
},
|
|
35
38
|
"./vitest": {
|
|
36
|
-
"types": "./dist/
|
|
37
|
-
"import": "./dist/
|
|
38
|
-
"default": "./dist/
|
|
39
|
+
"types": "./dist/vitest.shared.d.mts",
|
|
40
|
+
"import": "./dist/vitest.shared.mjs",
|
|
41
|
+
"default": "./dist/vitest.shared.mjs"
|
|
39
42
|
},
|
|
40
43
|
"./test/*": {
|
|
41
44
|
"types": "./dist/test/*.d.mts",
|
package/vitest.shared.ts
CHANGED
|
@@ -82,7 +82,7 @@ function stylesPlugin(): Plugin {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
const stylesSetup =
|
|
85
|
+
const stylesSetup = '@aamini/config/setup/styles'
|
|
86
86
|
|
|
87
87
|
function asPlugins(plugins: unknown[]): NonNullable<ViteUserConfig['plugins']> {
|
|
88
88
|
return plugins as NonNullable<ViteUserConfig['plugins']>
|