@aamini/config 0.0.13 → 0.0.15
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/{playwright.shared.config.d.mts → playwright.d.mts} +2 -3
- package/dist/{playwright.shared.config.mjs → playwright.mjs} +2 -3
- package/dist/playwright.mjs.map +1 -0
- package/dist/setup/styles.mjs +0 -1
- package/dist/test/browser.d.mts +7 -2
- package/dist/test/browser.mjs +5 -3
- package/dist/test/browser.mjs.map +1 -1
- package/dist/test/db.d.mts +34 -7
- package/dist/test/db.mjs +29 -15
- package/dist/test/db.mjs.map +1 -1
- package/dist/test/server.d.mts +7 -3
- package/dist/test/server.mjs +3 -4
- package/dist/test/server.mjs.map +1 -1
- package/dist/test/visual-page.d.mts +18 -24
- package/dist/test/visual-page.mjs +16 -10
- package/dist/test/visual-page.mjs.map +1 -1
- package/dist/vite.d.mts +81 -0
- package/dist/vite.mjs +211 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +38 -45
- package/tsconfig/tsconfig.tanstack.json +1 -1
- package/dist/internal-Dshd0hdM.mjs +0 -22
- package/dist/internal-Dshd0hdM.mjs.map +0 -1
- package/dist/playwright.shared.config.mjs.map +0 -1
- package/dist/test/database.d.mts +0 -22
- package/dist/test/database.mjs +0 -18
- package/dist/test/database.mjs.map +0 -1
- package/dist/test/playwright.d.mts +0 -7
- package/dist/test/playwright.mjs +0 -15
- package/dist/test/playwright.mjs.map +0 -1
- package/dist/test/postgres.d.mts +0 -14
- package/dist/test/postgres.mjs +0 -25
- package/dist/test/postgres.mjs.map +0 -1
- package/dist/vite.shared.d.mts +0 -379
- package/dist/vite.shared.mjs +0 -302
- package/dist/vite.shared.mjs.map +0 -1
- package/dist/vitest.shared.d.mts +0 -12
- package/dist/vitest.shared.mjs +0 -122
- package/dist/vitest.shared.mjs.map +0 -1
- package/msw.ts +0 -5
- package/playwright.shared.config.ts +0 -71
- package/setup/styles.ts +0 -4
- package/test/browser.ts +0 -44
- package/test/database.ts +0 -38
- package/test/db.ts +0 -86
- package/test/internal.ts +0 -45
- package/test/playwright.ts +0 -17
- package/test/postgres.ts +0 -43
- package/test/server.ts +0 -43
- package/test/visual-page.ts +0 -57
- package/tsconfig/tsconfig.astro.json +0 -34
- package/tsconfig/tsconfig.react.json +0 -16
- package/virtual-modules.d.ts +0 -6
- package/vite.config.ts +0 -53
- package/vite.shared.ts +0 -411
- package/vitest.shared.ts +0 -183
package/dist/vite.mjs
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { nitro } from "nitro/vite";
|
|
2
|
+
import { devtools } from "@tanstack/devtools-vite";
|
|
3
|
+
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
|
|
4
|
+
import viteReact, { reactCompilerPreset } from "@vitejs/plugin-react";
|
|
5
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
6
|
+
import babel from "@rolldown/plugin-babel";
|
|
7
|
+
import svgr from "vite-plugin-svgr";
|
|
8
|
+
import { resolve } from "node:path";
|
|
9
|
+
import { mergeConfig } from "vite-plus";
|
|
10
|
+
import { playwright } from "vite-plus/test/browser-playwright";
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
12
|
+
//#region src/plugins/virtual-modules.ts
|
|
13
|
+
const HANDLER_LOCATIONS = [
|
|
14
|
+
"__mocks__/handlers.ts",
|
|
15
|
+
"__mocks__/handlers.js",
|
|
16
|
+
"src/mocks/handlers.ts",
|
|
17
|
+
"src/mocks/handlers.js"
|
|
18
|
+
];
|
|
19
|
+
const STYLES_LOCATIONS = [
|
|
20
|
+
"src/styles.css",
|
|
21
|
+
"src/index.css",
|
|
22
|
+
"src/app.css"
|
|
23
|
+
];
|
|
24
|
+
function createVirtualFilePlugin({ locations, moduleId, name, sideEffectOnly = false }) {
|
|
25
|
+
const resolvedModuleId = `\0${moduleId}`;
|
|
26
|
+
let root = process.cwd();
|
|
27
|
+
return {
|
|
28
|
+
name,
|
|
29
|
+
configResolved(config) {
|
|
30
|
+
root = config.root;
|
|
31
|
+
},
|
|
32
|
+
resolveId(id) {
|
|
33
|
+
if (id === moduleId) return resolvedModuleId;
|
|
34
|
+
},
|
|
35
|
+
load(id) {
|
|
36
|
+
if (id !== resolvedModuleId) return void 0;
|
|
37
|
+
for (const location of locations) {
|
|
38
|
+
const fullPath = resolve(root, location);
|
|
39
|
+
if (existsSync(fullPath)) {
|
|
40
|
+
if (sideEffectOnly) return `import ${JSON.stringify(fullPath)}`;
|
|
41
|
+
return `export { default } from ${JSON.stringify(fullPath)}`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
throw new Error(`No file found for ${moduleId}. Expected one of:\n${locations.map((location) => ` - ${resolve(root, location)}`).join("\n")}`);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function createMswHandlersPlugin() {
|
|
49
|
+
return createVirtualFilePlugin({
|
|
50
|
+
locations: HANDLER_LOCATIONS,
|
|
51
|
+
moduleId: "@test/handlers",
|
|
52
|
+
name: "aamini-msw-handlers"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function createStylesPlugin() {
|
|
56
|
+
return createVirtualFilePlugin({
|
|
57
|
+
locations: STYLES_LOCATIONS,
|
|
58
|
+
moduleId: "@test/styles",
|
|
59
|
+
name: "aamini-test-styles",
|
|
60
|
+
sideEffectOnly: true
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const workspaceConfig = {
|
|
64
|
+
fmt: {
|
|
65
|
+
singleQuote: true,
|
|
66
|
+
semi: false,
|
|
67
|
+
useTabs: true,
|
|
68
|
+
experimentalTailwindcss: {},
|
|
69
|
+
printWidth: 80,
|
|
70
|
+
experimentalSortPackageJson: false,
|
|
71
|
+
proseWrap: "always",
|
|
72
|
+
ignorePatterns: [
|
|
73
|
+
"**/.output",
|
|
74
|
+
"**/dist/**",
|
|
75
|
+
"pnpm-lock.yaml",
|
|
76
|
+
"**/routeTree.gen.ts"
|
|
77
|
+
],
|
|
78
|
+
overrides: [{
|
|
79
|
+
files: ["*.{yaml,yml}"],
|
|
80
|
+
options: { useTabs: false }
|
|
81
|
+
}]
|
|
82
|
+
},
|
|
83
|
+
lint: {
|
|
84
|
+
plugins: [
|
|
85
|
+
"eslint",
|
|
86
|
+
"unicorn",
|
|
87
|
+
"typescript",
|
|
88
|
+
"oxc",
|
|
89
|
+
"react",
|
|
90
|
+
"react-perf",
|
|
91
|
+
"import",
|
|
92
|
+
"jsdoc",
|
|
93
|
+
"jsx-a11y",
|
|
94
|
+
"node",
|
|
95
|
+
"promise"
|
|
96
|
+
],
|
|
97
|
+
categories: {},
|
|
98
|
+
options: {
|
|
99
|
+
typeAware: true,
|
|
100
|
+
typeCheck: true
|
|
101
|
+
},
|
|
102
|
+
rules: {
|
|
103
|
+
"no-empty-pattern": "off",
|
|
104
|
+
"no-console": ["error", { allow: ["warn", "error"] }]
|
|
105
|
+
},
|
|
106
|
+
settings: {
|
|
107
|
+
"jsx-a11y": {
|
|
108
|
+
components: {},
|
|
109
|
+
attributes: {}
|
|
110
|
+
},
|
|
111
|
+
react: {
|
|
112
|
+
formComponents: [],
|
|
113
|
+
linkComponents: []
|
|
114
|
+
},
|
|
115
|
+
jsdoc: {
|
|
116
|
+
ignorePrivate: false,
|
|
117
|
+
ignoreInternal: false,
|
|
118
|
+
ignoreReplacesDocs: true,
|
|
119
|
+
overrideReplacesDocs: true,
|
|
120
|
+
augmentsExtendsReplacesDocs: false,
|
|
121
|
+
implementsReplacesDocs: false,
|
|
122
|
+
exemptDestructuredRootsFromChecks: false,
|
|
123
|
+
tagNamePreference: {}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
env: { builtin: true },
|
|
127
|
+
globals: {},
|
|
128
|
+
ignorePatterns: ["**/dist/**"]
|
|
129
|
+
},
|
|
130
|
+
staged: { "*.{js,ts,tsx}": "vp check --fix" }
|
|
131
|
+
};
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/vite.ts
|
|
134
|
+
const stylesSetup = "@aamini/config/setup/styles";
|
|
135
|
+
const createAppConfig = ({ root = process.cwd(), projectOverrides } = {}) => ({
|
|
136
|
+
root,
|
|
137
|
+
resolve: {
|
|
138
|
+
tsconfigPaths: true,
|
|
139
|
+
dedupe: ["react", "react-dom"],
|
|
140
|
+
alias: [
|
|
141
|
+
{
|
|
142
|
+
find: "@/mocks",
|
|
143
|
+
replacement: resolve(root, "__mocks__")
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
find: "@",
|
|
147
|
+
replacement: resolve(root, "src")
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
find: "@tests",
|
|
151
|
+
replacement: resolve(root, "tests")
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
plugins: [
|
|
156
|
+
tanstackStart(),
|
|
157
|
+
...process.env.VITEST === "true" ? [] : [devtools({ injectSource: { enabled: false } }), nitro()],
|
|
158
|
+
tailwindcss(),
|
|
159
|
+
viteReact(),
|
|
160
|
+
babel({ presets: [reactCompilerPreset()] }),
|
|
161
|
+
svgr({
|
|
162
|
+
include: "**/*.svg",
|
|
163
|
+
svgrOptions: { exportType: "default" }
|
|
164
|
+
})
|
|
165
|
+
],
|
|
166
|
+
fmt: workspaceConfig.fmt,
|
|
167
|
+
lint: workspaceConfig.lint,
|
|
168
|
+
staged: workspaceConfig.staged,
|
|
169
|
+
test: {
|
|
170
|
+
passWithNoTests: true,
|
|
171
|
+
projects: [
|
|
172
|
+
{
|
|
173
|
+
extends: true,
|
|
174
|
+
test: {
|
|
175
|
+
name: "unit",
|
|
176
|
+
include: ["src/**/*.test.unit.ts"]
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
mergeConfig({
|
|
180
|
+
extends: true,
|
|
181
|
+
plugins: [createMswHandlersPlugin()],
|
|
182
|
+
test: {
|
|
183
|
+
name: "server",
|
|
184
|
+
include: ["src/**/*.test.ts"],
|
|
185
|
+
testTimeout: 3e4,
|
|
186
|
+
fileParallelism: false
|
|
187
|
+
}
|
|
188
|
+
}, projectOverrides?.server ?? {}),
|
|
189
|
+
mergeConfig({
|
|
190
|
+
extends: true,
|
|
191
|
+
plugins: [createMswHandlersPlugin(), createStylesPlugin()],
|
|
192
|
+
test: {
|
|
193
|
+
name: "browser",
|
|
194
|
+
include: ["src/**/*.test.tsx", "tests/**/*.test.tsx"],
|
|
195
|
+
setupFiles: [stylesSetup],
|
|
196
|
+
browser: {
|
|
197
|
+
instances: [{ browser: "chromium" }],
|
|
198
|
+
provider: playwright(),
|
|
199
|
+
enabled: true,
|
|
200
|
+
headless: true
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}, projectOverrides?.browser ?? {})
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
const viteConfig = createAppConfig;
|
|
208
|
+
//#endregion
|
|
209
|
+
export { createAppConfig, viteConfig, workspaceConfig };
|
|
210
|
+
|
|
211
|
+
//# sourceMappingURL=vite.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.mjs","names":[],"sources":["../src/plugins/virtual-modules.ts","../src/workspace.ts","../src/vite.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { Plugin } from 'vite'\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 createVirtualFilePlugin({\n\tlocations,\n\tmoduleId,\n\tname,\n\tsideEffectOnly = false,\n}: {\n\tlocations: string[]\n\tmoduleId: string\n\tname: string\n\tsideEffectOnly?: boolean\n}): Plugin {\n\tconst resolvedModuleId = `\\0${moduleId}`\n\tlet root = process.cwd()\n\n\treturn {\n\t\tname,\n\t\tconfigResolved(config) {\n\t\t\troot = config.root\n\t\t},\n\t\tresolveId(id) {\n\t\t\tif (id === moduleId) return resolvedModuleId\n\t\t\treturn undefined\n\t\t},\n\t\tload(id) {\n\t\t\tif (id !== resolvedModuleId) return undefined\n\n\t\t\tfor (const location of locations) {\n\t\t\t\tconst fullPath = resolve(root, location)\n\t\t\t\tif (existsSync(fullPath)) {\n\t\t\t\t\tif (sideEffectOnly) return `import ${JSON.stringify(fullPath)}`\n\t\t\t\t\treturn `export { default } from ${JSON.stringify(fullPath)}`\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthrow new Error(\n\t\t\t\t`No file found for ${moduleId}. Expected one of:\\n${locations\n\t\t\t\t\t.map((location) => ` - ${resolve(root, location)}`)\n\t\t\t\t\t.join('\\n')}`,\n\t\t\t)\n\t\t},\n\t}\n}\n\nexport function createMswHandlersPlugin() {\n\treturn createVirtualFilePlugin({\n\t\tlocations: HANDLER_LOCATIONS,\n\t\tmoduleId: '@test/handlers',\n\t\tname: 'aamini-msw-handlers',\n\t})\n}\n\nexport function createStylesPlugin() {\n\treturn createVirtualFilePlugin({\n\t\tlocations: STYLES_LOCATIONS,\n\t\tmoduleId: '@test/styles',\n\t\tname: 'aamini-test-styles',\n\t\tsideEffectOnly: true,\n\t})\n}\n","const fmt = {\n\tsingleQuote: true,\n\tsemi: false,\n\tuseTabs: true,\n\texperimentalTailwindcss: {},\n\tprintWidth: 80,\n\texperimentalSortPackageJson: false,\n\tproseWrap: 'always',\n\tignorePatterns: [\n\t\t'**/.output',\n\t\t'**/dist/**',\n\t\t'pnpm-lock.yaml',\n\t\t'**/routeTree.gen.ts',\n\t],\n\toverrides: [\n\t\t{\n\t\t\tfiles: ['*.{yaml,yml}'],\n\t\t\toptions: { useTabs: false },\n\t\t},\n\t],\n}\n\nconst lint = {\n\tplugins: [\n\t\t'eslint',\n\t\t'unicorn',\n\t\t'typescript',\n\t\t'oxc',\n\t\t'react',\n\t\t'react-perf',\n\t\t'import',\n\t\t'jsdoc',\n\t\t'jsx-a11y',\n\t\t'node',\n\t\t'promise',\n\t],\n\tcategories: {},\n\toptions: {\n\t\ttypeAware: true,\n\t\ttypeCheck: true,\n\t},\n\trules: {\n\t\t'no-empty-pattern': 'off',\n\t\t'no-console': ['error', { allow: ['warn', 'error'] }],\n\t},\n\tsettings: {\n\t\t'jsx-a11y': { components: {}, attributes: {} },\n\t\treact: { formComponents: [], linkComponents: [] },\n\t\tjsdoc: {\n\t\t\tignorePrivate: false,\n\t\t\tignoreInternal: false,\n\t\t\tignoreReplacesDocs: true,\n\t\t\toverrideReplacesDocs: true,\n\t\t\taugmentsExtendsReplacesDocs: false,\n\t\t\timplementsReplacesDocs: false,\n\t\t\texemptDestructuredRootsFromChecks: false,\n\t\t\ttagNamePreference: {},\n\t\t},\n\t},\n\tenv: { builtin: true },\n\tglobals: {},\n\tignorePatterns: ['**/dist/**'],\n}\n\nexport const workspaceConfig = {\n\tfmt,\n\tlint,\n\tstaged: {\n\t\t'*.{js,ts,tsx}': 'vp check --fix',\n\t},\n}\n","import { nitro } from 'nitro/vite'\nimport { devtools } from '@tanstack/devtools-vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact, { reactCompilerPreset } from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\nimport babel from '@rolldown/plugin-babel'\nimport svgr from 'vite-plugin-svgr'\nimport { resolve } from 'node:path'\nimport { mergeConfig, type TestProjectConfiguration } from 'vite-plus'\nimport { playwright } from 'vite-plus/test/browser-playwright'\nimport {\n\tcreateMswHandlersPlugin,\n\tcreateStylesPlugin,\n} from './plugins/virtual-modules.ts'\nimport { workspaceConfig } from './workspace.ts'\n\nconst stylesSetup = '@aamini/config/setup/styles'\n\ninterface ProjectOverrides {\n\tserver?: TestProjectConfiguration\n\tbrowser?: TestProjectConfiguration\n}\n\nexport interface AppConfigOptions {\n\troot?: string\n\tprojectOverrides?: ProjectOverrides\n}\n\nexport const createAppConfig = ({\n\troot = process.cwd(),\n\tprojectOverrides,\n}: AppConfigOptions = {}): Record<string, unknown> => ({\n\troot,\n\tresolve: {\n\t\ttsconfigPaths: true,\n\t\tdedupe: ['react', 'react-dom'],\n\t\talias: [\n\t\t\t{ find: '@/mocks', replacement: resolve(root, '__mocks__') },\n\t\t\t{ find: '@', replacement: resolve(root, 'src') },\n\t\t\t{ find: '@tests', replacement: resolve(root, 'tests') },\n\t\t],\n\t},\n\tplugins: [\n\t\ttanstackStart(),\n\t\t...(process.env.VITEST === 'true'\n\t\t\t? []\n\t\t\t: [devtools({ injectSource: { enabled: false } }), nitro()]),\n\t\ttailwindcss(),\n\t\tviteReact(),\n\t\tbabel({ presets: [reactCompilerPreset()] }),\n\t\tsvgr({\n\t\t\tinclude: '**/*.svg',\n\t\t\tsvgrOptions: { exportType: 'default' },\n\t\t}),\n\t],\n\tfmt: workspaceConfig.fmt,\n\tlint: workspaceConfig.lint,\n\tstaged: workspaceConfig.staged,\n\ttest: {\n\t\tpassWithNoTests: true,\n\t\tprojects: [\n\t\t\t{\n\t\t\t\textends: true,\n\t\t\t\ttest: {\n\t\t\t\t\tname: 'unit',\n\t\t\t\t\tinclude: ['src/**/*.test.unit.ts'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tmergeConfig(\n\t\t\t\t{\n\t\t\t\t\textends: true,\n\t\t\t\t\tplugins: [createMswHandlersPlugin()],\n\t\t\t\t\ttest: {\n\t\t\t\t\t\tname: 'server',\n\t\t\t\t\t\tinclude: ['src/**/*.test.ts'],\n\t\t\t\t\t\ttestTimeout: 30_000,\n\t\t\t\t\t\tfileParallelism: false,\n\t\t\t\t\t},\n\t\t\t\t} satisfies TestProjectConfiguration as Record<string, unknown>,\n\t\t\t\t(projectOverrides?.server ?? {}) as Record<string, unknown>,\n\t\t\t),\n\t\t\tmergeConfig(\n\t\t\t\t{\n\t\t\t\t\textends: true,\n\t\t\t\t\tplugins: [createMswHandlersPlugin(), createStylesPlugin()],\n\t\t\t\t\ttest: {\n\t\t\t\t\t\tname: 'browser',\n\t\t\t\t\t\tinclude: ['src/**/*.test.tsx', 'tests/**/*.test.tsx'],\n\t\t\t\t\t\tsetupFiles: [stylesSetup],\n\t\t\t\t\t\tbrowser: {\n\t\t\t\t\t\t\tinstances: [{ browser: 'chromium' }],\n\t\t\t\t\t\t\tprovider: playwright(),\n\t\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\t\theadless: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} satisfies TestProjectConfiguration as Record<string, unknown>,\n\t\t\t\t(projectOverrides?.browser ?? {}) as Record<string, unknown>,\n\t\t\t),\n\t\t],\n\t},\n})\n\nexport const viteConfig: typeof createAppConfig = createAppConfig\nexport { workspaceConfig } from './workspace.ts'\n"],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aamini/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -17,52 +17,25 @@
|
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist",
|
|
20
|
-
"setup",
|
|
21
|
-
"test",
|
|
22
20
|
"tsconfig",
|
|
23
|
-
"
|
|
24
|
-
"virtual-modules.d.ts"
|
|
21
|
+
"README.md"
|
|
25
22
|
],
|
|
23
|
+
"main": "./dist/vite.mjs",
|
|
24
|
+
"types": "./dist/vite.d.mts",
|
|
26
25
|
"exports": {
|
|
27
|
-
"
|
|
28
|
-
"types": "./dist
|
|
29
|
-
"
|
|
30
|
-
"default": "./dist/vite.shared.mjs"
|
|
26
|
+
"./*": {
|
|
27
|
+
"types": "./dist/*.d.mts",
|
|
28
|
+
"default": "./dist/*.mjs"
|
|
31
29
|
},
|
|
32
|
-
"./
|
|
33
|
-
"./playwright": {
|
|
34
|
-
"types": "./dist/playwright.shared.config.d.mts",
|
|
35
|
-
"import": "./dist/playwright.shared.config.mjs",
|
|
36
|
-
"default": "./dist/playwright.shared.config.mjs"
|
|
37
|
-
},
|
|
38
|
-
"./vitest": {
|
|
39
|
-
"types": "./dist/vitest.shared.d.mts",
|
|
40
|
-
"import": "./dist/vitest.shared.mjs",
|
|
41
|
-
"default": "./dist/vitest.shared.mjs"
|
|
42
|
-
},
|
|
43
|
-
"./test/*": {
|
|
44
|
-
"types": "./dist/test/*.d.mts",
|
|
45
|
-
"import": "./dist/test/*.mjs",
|
|
46
|
-
"default": "./dist/test/*.mjs"
|
|
47
|
-
},
|
|
48
|
-
"./setup/*": {
|
|
49
|
-
"types": "./dist/setup/*.d.mts",
|
|
50
|
-
"import": "./dist/setup/*.mjs",
|
|
51
|
-
"default": "./dist/setup/*.mjs"
|
|
52
|
-
},
|
|
53
|
-
"./msw": {
|
|
54
|
-
"types": "./dist/msw.d.mts",
|
|
55
|
-
"import": "./dist/msw.mjs",
|
|
56
|
-
"default": "./dist/msw.mjs"
|
|
57
|
-
}
|
|
30
|
+
"./tsconfig/*": "./tsconfig/tsconfig.*.json"
|
|
58
31
|
},
|
|
59
32
|
"scripts": {
|
|
60
33
|
"build": "vp pack",
|
|
61
34
|
"bump": "npm version patch --no-git-tag-version",
|
|
62
35
|
"pack": "vp pack",
|
|
63
|
-
"prepublishOnly": "vp
|
|
36
|
+
"prepublishOnly": "vp run build"
|
|
64
37
|
},
|
|
65
|
-
"
|
|
38
|
+
"peerDependencies": {
|
|
66
39
|
"@babel/core": "^7.29.0",
|
|
67
40
|
"@playwright/test": "^1.59.1",
|
|
68
41
|
"@rolldown/plugin-babel": "^0.2.3",
|
|
@@ -75,26 +48,46 @@
|
|
|
75
48
|
"@types/pg": "^8.18.0",
|
|
76
49
|
"@types/react": "^19.2.14",
|
|
77
50
|
"@vitejs/plugin-react": "^6.0.1",
|
|
78
|
-
"@vitest/browser-playwright": "4.1.5",
|
|
79
51
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
80
52
|
"drizzle-orm": "^0.45.1",
|
|
81
53
|
"drizzle-seed": "^0.3.1",
|
|
82
54
|
"get-port": "^7.2.0",
|
|
83
55
|
"msw": "^2.13.4",
|
|
84
|
-
"nitro": "
|
|
56
|
+
"nitro": "*",
|
|
85
57
|
"pg": "^8.20.0",
|
|
86
58
|
"react": "^19.2.4",
|
|
87
59
|
"testcontainers": "^11.12.0",
|
|
88
60
|
"typescript": "^5.8.3",
|
|
89
|
-
"vite": "
|
|
90
|
-
"vite-plus": "latest",
|
|
61
|
+
"vite": "*",
|
|
91
62
|
"vite-plugin-svgr": "^5.2.0",
|
|
92
|
-
"
|
|
63
|
+
"vite-plus": "*",
|
|
93
64
|
"vitest-browser-react": "^2.0.5"
|
|
94
65
|
},
|
|
95
66
|
"devDependencies": {
|
|
96
|
-
"@
|
|
97
|
-
"@
|
|
98
|
-
"
|
|
67
|
+
"@babel/core": "^7.29.0",
|
|
68
|
+
"@playwright/test": "^1.59.1",
|
|
69
|
+
"@rolldown/plugin-babel": "^0.2.3",
|
|
70
|
+
"@tailwindcss/vite": "^4.2.1",
|
|
71
|
+
"@tanstack/devtools-vite": "^0.6.0",
|
|
72
|
+
"@tanstack/react-start": "^1.166.7",
|
|
73
|
+
"@testcontainers/postgresql": "^11.12.0",
|
|
74
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
75
|
+
"@types/node": "^25.4.0",
|
|
76
|
+
"@types/pg": "^8.18.0",
|
|
77
|
+
"@types/react": "^19.2.14",
|
|
78
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
79
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
80
|
+
"drizzle-orm": "^0.45.1",
|
|
81
|
+
"drizzle-seed": "^0.3.1",
|
|
82
|
+
"msw": "^2.13.4",
|
|
83
|
+
"nitro": "latest",
|
|
84
|
+
"pg": "^8.20.0",
|
|
85
|
+
"react": "^19.2.4",
|
|
86
|
+
"testcontainers": "^11.12.0",
|
|
87
|
+
"typescript": "^5.8.3",
|
|
88
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
89
|
+
"vite-plugin-svgr": "^5.2.0",
|
|
90
|
+
"vite-plus": "latest",
|
|
91
|
+
"vitest-browser-react": "^2.0.5"
|
|
99
92
|
}
|
|
100
93
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
|
-
//#region test/internal.ts
|
|
4
|
-
const HANDLER_LOCATIONS = [
|
|
5
|
-
"__mocks__/handlers.ts",
|
|
6
|
-
"__mocks__/handlers.js",
|
|
7
|
-
"src/mocks/handlers.ts",
|
|
8
|
-
"src/mocks/handlers.js"
|
|
9
|
-
];
|
|
10
|
-
function findHandlerPath() {
|
|
11
|
-
if (typeof process === "undefined") return "";
|
|
12
|
-
const cwd = process.cwd();
|
|
13
|
-
for (const location of HANDLER_LOCATIONS) {
|
|
14
|
-
const fullPath = resolve(cwd, location);
|
|
15
|
-
if (existsSync(fullPath)) return fullPath;
|
|
16
|
-
}
|
|
17
|
-
throw new Error(`No MSW handlers found. Expected one of:\n${HANDLER_LOCATIONS.map((l) => ` - ${resolve(cwd, l)}`).join("\n")}`);
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
export { findHandlerPath as t };
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=internal-Dshd0hdM.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internal-Dshd0hdM.mjs","names":[],"sources":["../test/internal.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport const 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\nexport function findHandlerPath(): string {\n\tif (typeof process === 'undefined') {\n\t\treturn ''\n\t}\n\tconst cwd = process.cwd()\n\tfor (const location of HANDLER_LOCATIONS) {\n\t\tconst fullPath = resolve(cwd, location)\n\t\tif (existsSync(fullPath)) return fullPath\n\t}\n\tthrow new Error(\n\t\t`No MSW handlers found. Expected one of:\\n${HANDLER_LOCATIONS.map((l) => ` - ${resolve(cwd, l)}`).join('\\n')}`,\n\t)\n}\n\nexport function createProxy<T extends object>(getTarget: () => T): T {\n\tconst handlers: ProxyHandler<object> = {\n\t\tget(_, prop) {\n\t\t\treturn Reflect.get(getTarget(), prop, getTarget())\n\t\t},\n\t\tapply(target, thisArg, args) {\n\t\t\treturn Reflect.apply(getTarget() as any, thisArg, args)\n\t\t},\n\t\thas(_, prop) {\n\t\t\treturn prop in getTarget()\n\t\t},\n\t\townKeys() {\n\t\t\treturn Reflect.ownKeys(getTarget())\n\t\t},\n\t\tgetOwnPropertyDescriptor(_, prop) {\n\t\t\treturn Reflect.getOwnPropertyDescriptor(getTarget(), prop)\n\t\t},\n\t}\n\tconst proxyTarget = () => {}\n\treturn new Proxy(proxyTarget, handlers) as T\n}\n"],"mappings":";;;AAGA,MAAa,oBAAoB;CAChC;CACA;CACA;CACA;CACA;AAED,SAAgB,kBAA0B;CACzC,IAAI,OAAO,YAAY,aACtB,OAAO;CAER,MAAM,MAAM,QAAQ,KAAK;CACzB,KAAK,MAAM,YAAY,mBAAmB;EACzC,MAAM,WAAW,QAAQ,KAAK,SAAS;EACvC,IAAI,WAAW,SAAS,EAAE,OAAO;;CAElC,MAAM,IAAI,MACT,4CAA4C,kBAAkB,KAAK,MAAM,OAAO,QAAQ,KAAK,EAAE,GAAG,CAAC,KAAK,KAAK,GAC7G"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.shared.config.mjs","names":[],"sources":["../playwright.shared.config.ts"],"sourcesContent":["import {\n\tdefineConfig,\n\tdevices,\n\ttype PlaywrightTestConfig,\n} from '@playwright/test'\n\n/** See https://playwright.dev/docs/test-configuration. */\nexport const baseConfig = async (overrides?: PlaywrightTestConfig) => {\n\treturn defineConfig(\n\t\t{\n\t\t\ttestDir: './e2e',\n\t\t\toutputDir: '.playwright/test-results',\n\t\t\t/* Run tests in files in parallel */\n\t\t\tfullyParallel: true,\n\t\t\t// Opt out of parallel tests on CI.\n\t\t\tworkers: process.env.CI ? 1 : '50%',\n\t\t\t/* Fail the build on CI if you accidentally left test.only in the source code. */\n\t\t\tforbidOnly: !!process.env.CI,\n\t\t\tretries: process.env.CI ? 3 : 0,\n\t\t\t/* Reporter to use. See https://playwright.dev/docs/test-reporters */\n\t\t\treporter: [\n\t\t\t\t['html', { open: 'never', outputFolder: '.playwright/report' }],\n\t\t\t],\n\n\t\t\t/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */\n\t\t\tuse: {\n\t\t\t\tcolorScheme: 'dark',\n\n\t\t\t\t/* Base URL to use in actions like `await page.goto('/')`. */\n\t\t\t\tbaseURL: process.env.BASE_URL,\n\n\t\t\t\t/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */\n\t\t\t\ttrace: 'retain-on-first-failure',\n\t\t\t\tscreenshot: 'on',\n\t\t\t\tvideo: 'retain-on-failure',\n\t\t\t},\n\n\t\t\ttimeout: 15_000,\n\t\t\texpect: {\n\t\t\t\ttimeout: 5_000,\n\t\t\t},\n\n\t\t\t/* Configure projects for major browsers */\n\t\t\tprojects: [\n\t\t\t\t{\n\t\t\t\t\tname: 'chromium',\n\t\t\t\t\tuse: {\n\t\t\t\t\t\t...devices['Desktop Chrome'],\n\t\t\t\t\t\tlaunchOptions: {\n\t\t\t\t\t\t\targs: ['--disable-lcd-text'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'mobile',\n\t\t\t\t\tuse: {\n\t\t\t\t\t\t...devices['Desktop Chrome'],\n\t\t\t\t\t\tviewport: {\n\t\t\t\t\t\t\twidth: 320,\n\t\t\t\t\t\t\theight: 800,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlaunchOptions: {\n\t\t\t\t\t\t\targs: ['--disable-lcd-text'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\toverrides ?? {},\n\t)\n}\n"],"mappings":";;;AAOA,MAAa,aAAa,OAAO,cAAqC;CACrE,OAAO,aACN;EACC,SAAS;EACT,WAAW;EAEX,eAAe;EAEf,SAAS,QAAQ,IAAI,KAAK,IAAI;EAE9B,YAAY,CAAC,CAAC,QAAQ,IAAI;EAC1B,SAAS,QAAQ,IAAI,KAAK,IAAI;EAE9B,UAAU,CACT,CAAC,QAAQ;GAAE,MAAM;GAAS,cAAc;GAAsB,CAAC,CAC/D;EAGD,KAAK;GACJ,aAAa;GAGb,SAAS,QAAQ,IAAI;GAGrB,OAAO;GACP,YAAY;GACZ,OAAO;GACP;EAED,SAAS;EACT,QAAQ,EACP,SAAS,KACT;EAGD,UAAU,CACT;GACC,MAAM;GACN,KAAK;IACJ,GAAG,QAAQ;IACX,eAAe,EACd,MAAM,CAAC,qBAAqB,EAC5B;IACD;GACD,EACD;GACC,MAAM;GACN,KAAK;IACJ,GAAG,QAAQ;IACX,UAAU;KACT,OAAO;KACP,QAAQ;KACR;IACD,eAAe,EACd,MAAM,CAAC,qBAAqB,EAC5B;IACD;GACD,CACD;EACD,EACD,aAAa,EAAE,CACf"}
|
package/dist/test/database.d.mts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
2
|
-
import { Pool } from "pg";
|
|
3
|
-
|
|
4
|
-
//#region test/database.d.ts
|
|
5
|
-
type Database = NodePgDatabase & {
|
|
6
|
-
$client: Pool;
|
|
7
|
-
};
|
|
8
|
-
interface SeedDatabaseOptions {
|
|
9
|
-
schemaPath: string;
|
|
10
|
-
migrationsFolder: string;
|
|
11
|
-
seedFunction?: (db: Database) => Promise<void>;
|
|
12
|
-
extensions?: string[];
|
|
13
|
-
}
|
|
14
|
-
declare function seedDatabase(db: Database, {
|
|
15
|
-
schemaPath,
|
|
16
|
-
migrationsFolder,
|
|
17
|
-
seedFunction,
|
|
18
|
-
extensions
|
|
19
|
-
}: SeedDatabaseOptions): Promise<void>;
|
|
20
|
-
//#endregion
|
|
21
|
-
export { Database, SeedDatabaseOptions, seedDatabase };
|
|
22
|
-
//# sourceMappingURL=database.d.mts.map
|
package/dist/test/database.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region test/database.ts
|
|
2
|
-
const DEFAULT_EXTENSIONS = ["pg_trgm"];
|
|
3
|
-
async function seedDatabase(db, { schemaPath, migrationsFolder, seedFunction, extensions = DEFAULT_EXTENSIONS }) {
|
|
4
|
-
const { migrate } = await import("drizzle-orm/node-postgres/migrator");
|
|
5
|
-
const { reset } = await import("drizzle-seed");
|
|
6
|
-
const schema = await import(
|
|
7
|
-
/* @vite-ignore */
|
|
8
|
-
schemaPath
|
|
9
|
-
);
|
|
10
|
-
for (const ext of extensions) await db.execute(`CREATE EXTENSION IF NOT EXISTS "${ext}"`);
|
|
11
|
-
await migrate(db, { migrationsFolder });
|
|
12
|
-
await reset(db, schema);
|
|
13
|
-
if (seedFunction) await seedFunction(db);
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { seedDatabase };
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=database.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database.mjs","names":[],"sources":["../../test/database.ts"],"sourcesContent":["import type { NodePgDatabase } from 'drizzle-orm/node-postgres'\nimport type { Pool } from 'pg'\n\n// Convention: schema at src/db/tables.ts, migrations at src/db/migrations/\nconst DEFAULT_EXTENSIONS = ['pg_trgm']\n\nexport type Database = NodePgDatabase & {\n\t$client: Pool\n}\n\nexport interface SeedDatabaseOptions {\n\tschemaPath: string\n\tmigrationsFolder: string\n\tseedFunction?: (db: Database) => Promise<void>\n\textensions?: string[]\n}\n\nexport async function seedDatabase(\n\tdb: Database,\n\t{\n\t\tschemaPath,\n\t\tmigrationsFolder,\n\t\tseedFunction,\n\t\textensions = DEFAULT_EXTENSIONS,\n\t}: SeedDatabaseOptions,\n) {\n\tconst { migrate } = await import('drizzle-orm/node-postgres/migrator')\n\tconst { reset } = await import('drizzle-seed')\n\n\tconst schema = await import(/* @vite-ignore */ schemaPath)\n\n\tfor (const ext of extensions) {\n\t\tawait db.execute(`CREATE EXTENSION IF NOT EXISTS \"${ext}\"`)\n\t}\n\tawait migrate(db, { migrationsFolder })\n\tawait reset(db, schema)\n\tif (seedFunction) await seedFunction(db)\n}\n"],"mappings":";AAIA,MAAM,qBAAqB,CAAC,UAAU;AAatC,eAAsB,aACrB,IACA,EACC,YACA,kBACA,cACA,aAAa,sBAEb;CACD,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,EAAE,UAAU,MAAM,OAAO;CAE/B,MAAM,SAAS,MAAM;;EAA0B;;CAE/C,KAAK,MAAM,OAAO,YACjB,MAAM,GAAG,QAAQ,mCAAmC,IAAI,GAAG;CAE5D,MAAM,QAAQ,IAAI,EAAE,kBAAkB,CAAC;CACvC,MAAM,MAAM,IAAI,OAAO;CACvB,IAAI,cAAc,MAAM,aAAa,GAAG"}
|
package/dist/test/playwright.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
//#region test/playwright.ts
|
|
3
|
-
async function mockJsonRoute(page, url, fixtureUrl) {
|
|
4
|
-
await page.route(url, async (route) => {
|
|
5
|
-
const body = await readFile(fixtureUrl, "utf8");
|
|
6
|
-
await route.fulfill({
|
|
7
|
-
contentType: "application/json",
|
|
8
|
-
body
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { mockJsonRoute };
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=playwright.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.mjs","names":[],"sources":["../../test/playwright.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises'\nimport type { Page } from '@playwright/test'\n\nexport async function mockJsonRoute(\n\tpage: Page,\n\turl: string | RegExp,\n\tfixtureUrl: URL,\n) {\n\tawait page.route(url, async (route) => {\n\t\tconst body = await readFile(fixtureUrl, 'utf8')\n\n\t\tawait route.fulfill({\n\t\t\tcontentType: 'application/json',\n\t\t\tbody,\n\t\t})\n\t})\n}\n"],"mappings":";;AAGA,eAAsB,cACrB,MACA,KACA,YACC;CACD,MAAM,KAAK,MAAM,KAAK,OAAO,UAAU;EACtC,MAAM,OAAO,MAAM,SAAS,YAAY,OAAO;EAE/C,MAAM,MAAM,QAAQ;GACnB,aAAa;GACb;GACA,CAAC;GACD"}
|
package/dist/test/postgres.d.mts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { StartedPostgreSqlContainer } from "@testcontainers/postgresql";
|
|
2
|
-
|
|
3
|
-
//#region test/postgres.d.ts
|
|
4
|
-
type State = {
|
|
5
|
-
container: StartedPostgreSqlContainer;
|
|
6
|
-
databaseUrl: string;
|
|
7
|
-
};
|
|
8
|
-
declare function ensurePostgresContainer(): Promise<State | {
|
|
9
|
-
databaseUrl: string;
|
|
10
|
-
}>;
|
|
11
|
-
declare function stopPostgresContainer(): Promise<void>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { ensurePostgresContainer, stopPostgresContainer };
|
|
14
|
-
//# sourceMappingURL=postgres.d.mts.map
|
package/dist/test/postgres.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { PostgreSqlContainer } from "@testcontainers/postgresql";
|
|
2
|
-
import { Wait } from "testcontainers";
|
|
3
|
-
//#region test/postgres.ts
|
|
4
|
-
let state;
|
|
5
|
-
async function ensurePostgresContainer() {
|
|
6
|
-
const databaseUrl = process.env.DATABASE_URL;
|
|
7
|
-
if (databaseUrl) return { databaseUrl };
|
|
8
|
-
if (!state) {
|
|
9
|
-
const container = await new PostgreSqlContainer("postgres:17").withDatabase("imdbgraph").withUsername("imdbgraph").withPassword("imdbgraph").withWaitStrategy(Wait.forHealthCheck()).start();
|
|
10
|
-
state = {
|
|
11
|
-
container,
|
|
12
|
-
databaseUrl: container.getConnectionUri()
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return state;
|
|
16
|
-
}
|
|
17
|
-
async function stopPostgresContainer() {
|
|
18
|
-
if (!state) return;
|
|
19
|
-
await state.container.stop();
|
|
20
|
-
state = void 0;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { ensurePostgresContainer, stopPostgresContainer };
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=postgres.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.mjs","names":[],"sources":["../../test/postgres.ts"],"sourcesContent":["import {\n\tPostgreSqlContainer,\n\ttype StartedPostgreSqlContainer,\n} from '@testcontainers/postgresql'\nimport { Wait } from 'testcontainers'\n\ntype State = {\n\tcontainer: StartedPostgreSqlContainer\n\tdatabaseUrl: string\n}\n\nlet state: State | undefined\n\nexport async function ensurePostgresContainer() {\n\tconst databaseUrl = process.env.DATABASE_URL\n\tif (databaseUrl) {\n\t\treturn {\n\t\t\tdatabaseUrl,\n\t\t}\n\t}\n\n\tif (!state) {\n\t\tconst container = await new PostgreSqlContainer('postgres:17')\n\t\t\t.withDatabase('imdbgraph')\n\t\t\t.withUsername('imdbgraph')\n\t\t\t.withPassword('imdbgraph')\n\t\t\t.withWaitStrategy(Wait.forHealthCheck())\n\t\t\t.start()\n\n\t\tstate = {\n\t\t\tcontainer,\n\t\t\tdatabaseUrl: container.getConnectionUri(),\n\t\t}\n\t}\n\n\treturn state\n}\n\nexport async function stopPostgresContainer() {\n\tif (!state) return\n\tawait state.container.stop()\n\tstate = undefined\n}\n"],"mappings":";;;AAWA,IAAI;AAEJ,eAAsB,0BAA0B;CAC/C,MAAM,cAAc,QAAQ,IAAI;CAChC,IAAI,aACH,OAAO,EACN,aACA;CAGF,IAAI,CAAC,OAAO;EACX,MAAM,YAAY,MAAM,IAAI,oBAAoB,cAAc,CAC5D,aAAa,YAAY,CACzB,aAAa,YAAY,CACzB,aAAa,YAAY,CACzB,iBAAiB,KAAK,gBAAgB,CAAC,CACvC,OAAO;EAET,QAAQ;GACP;GACA,aAAa,UAAU,kBAAkB;GACzC;;CAGF,OAAO;;AAGR,eAAsB,wBAAwB;CAC7C,IAAI,CAAC,OAAO;CACZ,MAAM,MAAM,UAAU,MAAM;CAC5B,QAAQ,KAAA"}
|