diff --git a/.changeset/grumpy-queens-invite.md b/.changeset/grumpy-queens-invite.md new file mode 100644 index 00000000..92790dc0 --- /dev/null +++ b/.changeset/grumpy-queens-invite.md @@ -0,0 +1,5 @@ +--- +'vite-plugin-kit-routes': patch +--- + +detect export function (not only export const) in +server.ts files diff --git a/.changeset/thin-otters-punch.md b/.changeset/thin-otters-punch.md new file mode 100644 index 00000000..81ccc46e --- /dev/null +++ b/.changeset/thin-otters-punch.md @@ -0,0 +1,5 @@ +--- +'vite-plugin-striper': patch +--- + +rmv some leftover logs :/ diff --git a/packages/eslint-config/index.cjs b/packages/eslint-config/index.cjs index f5d20d0c..17b8ff64 100644 --- a/packages/eslint-config/index.cjs +++ b/packages/eslint-config/index.cjs @@ -3,7 +3,6 @@ module.exports = { parser: '@typescript-eslint/parser', extends: [ '@theguild', - '@theguild/eslint-config/react', '@theguild/eslint-config/mdx', '@theguild/eslint-config/json', '@theguild/eslint-config/yml', @@ -42,9 +41,12 @@ module.exports = { }, }, ], + ignorePatterns: ['tsconfig.json', 'tsconfig.eslint.json', '.npmrc', 'README.md'], parserOptions: { sourceType: 'module', ecmaVersion: 2020, + project: 'tsconfig.eslint.json', + extraFileExtensions: ['.json'], }, env: { browser: true, diff --git a/packages/handles/package.json b/packages/handles/package.json index 1c687feb..a2fd2155 100644 --- a/packages/handles/package.json +++ b/packages/handles/package.json @@ -34,7 +34,7 @@ "devDependencies": { "@kitql/eslint-config": "workspace:*", "@sveltejs/adapter-node": "1.3.1", - "@sveltejs/kit": "1.29.0", + "@sveltejs/kit": "1.30.1", "@sveltejs/package": "2.2.2", "publint": "0.2.4", "svelte": "4.2.1", diff --git a/packages/helpers/package.json b/packages/helpers/package.json index efcc0476..19a32fbc 100644 --- a/packages/helpers/package.json +++ b/packages/helpers/package.json @@ -33,7 +33,7 @@ }, "devDependencies": { "@sveltejs/adapter-auto": "2.1.0", - "@sveltejs/kit": "1.29.0", + "@sveltejs/kit": "1.30.1", "@sveltejs/package": "2.2.2", "@kitql/eslint-config": "workspace:*", "publint": "0.2.4", diff --git a/packages/internals/package.json b/packages/internals/package.json index 9eaba4de..6c363eb4 100644 --- a/packages/internals/package.json +++ b/packages/internals/package.json @@ -29,7 +29,7 @@ }, "devDependencies": { "@sveltejs/adapter-auto": "2.1.0", - "@sveltejs/kit": "1.29.0", + "@sveltejs/kit": "1.30.1", "@sveltejs/package": "2.2.2", "@kitql/eslint-config": "workspace:*", "publint": "0.2.4", diff --git a/packages/internals/src/lib/fs/fs.spec.ts b/packages/internals/src/lib/fs/fs.spec.ts index 13be4cbc..5a12da2a 100644 --- a/packages/internals/src/lib/fs/fs.spec.ts +++ b/packages/internals/src/lib/fs/fs.spec.ts @@ -4,41 +4,11 @@ import { getFilesUnder, read, write, relative } from './fs.js' describe('fs', () => { it('getFilesUnder', async () => { - const location = relative(`${process.cwd()}`, '../vite-plugin-kit-routes/src/routes/') + const location = relative(`${process.cwd()}`, 'src/routes/') expect(getFilesUnder(location)).toMatchInlineSnapshot(` [ - "(rootGroup)/+page.svelte", - "(rootGroup)/subGroup/(anotherSub)/user/+page.svelte", - "(rootGroup)/subGroup/+page.svelte", - "(rootGroup)/subGroup2/+page.svelte", "+layout.svelte", - "[[lang]]/contract/+page.svelte", - "[[lang]]/contract/+server.ts", - "[[lang]]/contract/[id]/+page.server.ts", - "[[lang]]/contract/[id]/+page.svelte", - "[[lang]]/gp/(logged)/one/+page.svelte", - "[[lang]]/gp/(public)/two/+page.svelte", - "[[lang]]/main/+page.svelte", - "[[lang]]/match/[id=ab]/+page.svelte", - "[[lang]]/match/[id=int]/+page.svelte", - "[[lang]]/site/+page.server.ts", - "[[lang]]/site/+page.svelte", - "[[lang]]/site/+server.ts", - "[[lang]]/site/[id]/+page.server.ts", - "[[lang]]/site/[id]/+page.svelte", - "[[lang]]/site_contract/+page.server.ts", - "[[lang]]/site_contract/[siteId]-[contractId]/+page.server.ts", - "[[lang]]/site_contract/[siteId]-[contractId]/+page.svelte", - "a/[...rest]/z/+page.svelte", - "api/graphql/+server.ts", - "data/errors/[locale].json/+server.ts", - "lay/(layVerySpecial)/+layout.svelte", - "lay/(layVerySpecial)/normal/+page.svelte", - "lay/(layVerySpecial)/root-layout/+page@.svelte", - "lay/(layVerySpecial)/skip/+page@lay.svelte", - "lay/+layout.svelte", - "page_server_woAction/+page.server.ts", - "sp/+page.svelte", + "+page.svelte", ] `) }) diff --git a/packages/vite-plugin-kit-routes/package.json b/packages/vite-plugin-kit-routes/package.json index 42d65cda..706370ae 100644 --- a/packages/vite-plugin-kit-routes/package.json +++ b/packages/vite-plugin-kit-routes/package.json @@ -29,7 +29,7 @@ "devDependencies": { "@kitql/eslint-config": "workspace:*", "@sveltejs/adapter-auto": "2.1.0", - "@sveltejs/kit": "1.29.0", + "@sveltejs/kit": "1.30.1", "@sveltejs/package": "2.2.2", "publint": "0.2.4", "svelte": "4.2.1", diff --git a/packages/vite-plugin-kit-routes/src/lib/ROUTES.ts b/packages/vite-plugin-kit-routes/src/lib/ROUTES.ts index 6393ad0a..8ea028ec 100644 --- a/packages/vite-plugin-kit-routes/src/lib/ROUTES.ts +++ b/packages/vite-plugin-kit-routes/src/lib/ROUTES.ts @@ -90,6 +90,8 @@ const PAGES = { * SERVERS */ const SERVERS = { + 'GET /server_func_get': `/server_func_get`, + 'POST /server_func_post': `/server_func_post`, 'GET /contract': (params?: { lang?: 'fr' | 'en' | 'hu' | 'at' | string }) => { return `${params?.lang ? `/${params?.lang}` : ''}/contract` }, @@ -275,6 +277,8 @@ export type KIT_ROUTES = { '/sp': never } SERVERS: { + 'GET /server_func_get': never + 'POST /server_func_post': never 'GET /contract': 'lang' 'POST /contract': 'lang' 'GET /site': 'lang' diff --git a/packages/vite-plugin-kit-routes/src/lib/ast.ts b/packages/vite-plugin-kit-routes/src/lib/ast.ts index a2293fb5..79e2ea6b 100644 --- a/packages/vite-plugin-kit-routes/src/lib/ast.ts +++ b/packages/vite-plugin-kit-routes/src/lib/ast.ts @@ -18,22 +18,34 @@ export const getMethodsOfServerFiles = (pathFile: string) => { let exportedNames: string[] = [] visit(codeParsed, { visitExportNamedDeclaration(path) { - // @ts-ignore - const declarations = path.node.declaration?.declarations - if (declarations) { - declarations.forEach((declaration: any) => { - if (declaration.id.name) { + const declaration = path.node.declaration + + // Check for variable declarations + if (declaration?.type === 'VariableDeclaration') { + declaration.declarations.forEach(declaration => { + if ( + declaration.type === 'VariableDeclarator' && + declaration.id.type === 'Identifier' && + declaration.id.name + ) { exportedNames.push(declaration.id.name) } }) } + // Check for function declarations + if (declaration?.type === 'FunctionDeclaration') { + if (declaration.id && declaration.id.name) { + exportedNames.push(String(declaration.id.name)) + } + } + // Check for export specifiers (for aliased exports) const specifiers = path.node.specifiers if (specifiers) { - specifiers.forEach((specifier: any) => { + specifiers.forEach(specifier => { if (specifier.exported.name) { - exportedNames.push(specifier.exported.name) + exportedNames.push(String(specifier.exported.name)) } }) } diff --git a/packages/vite-plugin-kit-routes/src/lib/plugins.spec.ts b/packages/vite-plugin-kit-routes/src/lib/plugins.spec.ts index b8ca41f1..4eede9cd 100644 --- a/packages/vite-plugin-kit-routes/src/lib/plugins.spec.ts +++ b/packages/vite-plugin-kit-routes/src/lib/plugins.spec.ts @@ -796,6 +796,8 @@ describe('rmv Helper', () => { "(rootGroup)/subGroup/(anotherSub)/user/+page.svelte", "(rootGroup)/subGroup/+page.svelte", "(rootGroup)/subGroup2/+page.svelte", + "(servers)/server_func_get/+server.ts", + "(servers)/server_func_post/+server.ts", "+layout.svelte", "/contract/+page.svelte", "/contract/+server.ts", @@ -840,6 +842,8 @@ describe('rmv Helper', () => { "(rootGroup)/subGroup/(anotherSub)/user/+page.svelte", "(rootGroup)/subGroup/+page.svelte", "(rootGroup)/subGroup2/+page.svelte", + "(servers)/server_func_get/+server.ts", + "(servers)/server_func_post/+server.ts", "+layout.svelte", "[[lang]]/contract/+page.svelte", "[[lang]]/contract/+server.ts", @@ -877,6 +881,8 @@ describe('rmv Helper', () => { "/subGroup/user/+page.svelte", "/subGroup/+page.svelte", "/subGroup2/+page.svelte", + "/server_func_get/+server.ts", + "/server_func_post/+server.ts", "+layout.svelte", "[[lang]]/contract/+page.svelte", "[[lang]]/contract/+server.ts", @@ -917,6 +923,8 @@ describe('rmv Helper', () => { "/subGroup/user/+page.svelte", "/subGroup/+page.svelte", "/subGroup2/+page.svelte", + "/server_func_get/+server.ts", + "/server_func_post/+server.ts", "+layout.svelte", "/contract/+page.svelte", "/contract/+server.ts", diff --git a/packages/vite-plugin-kit-routes/src/routes/(servers)/server_func_get/+server.ts b/packages/vite-plugin-kit-routes/src/routes/(servers)/server_func_get/+server.ts new file mode 100644 index 00000000..6fe53073 --- /dev/null +++ b/packages/vite-plugin-kit-routes/src/routes/(servers)/server_func_get/+server.ts @@ -0,0 +1,3 @@ +export async function GET() { + return new Response() +} diff --git a/packages/vite-plugin-kit-routes/src/routes/(servers)/server_func_post/+server.ts b/packages/vite-plugin-kit-routes/src/routes/(servers)/server_func_post/+server.ts new file mode 100644 index 00000000..64205154 --- /dev/null +++ b/packages/vite-plugin-kit-routes/src/routes/(servers)/server_func_post/+server.ts @@ -0,0 +1,3 @@ +export async function POST() { + return new Response() +} diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_base.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_base.ts index 6db1d8ae..039335ff 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_base.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_base.ts @@ -57,6 +57,8 @@ const PAGES = { * SERVERS */ const SERVERS = { + "GET /server_func_get": `${base}/server_func_get`, + "POST /server_func_post": `${base}/server_func_post`, "GET /contract": (params?: { lang?: (string | number) }) => { return `${base}${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -181,7 +183,7 @@ export function route(key: T, ...params: any[]): strin */ export type KIT_ROUTES = { PAGES: { '/': never, '/subGroup': never, '/subGroup/user': never, '/subGroup2': never, '/contract': 'lang', '/contract/[id]': 'id' | 'lang', '/gp/one': 'lang', '/gp/two': 'lang', '/main': 'lang', '/match/[id=ab]': 'id' | 'lang', '/match/[id=int]': 'id' | 'lang', '/site': 'lang', '/site/[id]': 'id' | 'lang', '/site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang', '/a/[...rest]/z': 'rest', '/lay/normal': never, '/lay/root-layout': never, '/lay/skip': never, '/sp': never } - SERVERS: { 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } + SERVERS: { 'GET /server_func_get': never, 'POST /server_func_post': never, 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } ACTIONS: { 'default /contract/[id]': 'id' | 'lang', 'create /site': 'lang', 'update /site/[id]': 'id' | 'lang', 'delete /site/[id]': 'id' | 'lang', 'noSatisfies /site_contract': 'lang', 'send /site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang' } LINKS: Record Params: { lang: never, id: never, siteId: never, contractId: never, rest: never, locale: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-path.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-path.ts index 758001c7..ed6588f0 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-path.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-path.ts @@ -61,6 +61,8 @@ export const PAGES = { * SERVERS */ export const SERVERS = { + "GET /server_func_get": `/server_func_get`, + "POST /server_func_post": `/server_func_post`, "GET /contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -167,7 +169,7 @@ export const currentSp = () => { */ export type KIT_ROUTES = { PAGES: { '/': never, '/subGroup': never, '/subGroup/user': never, '/subGroup2': never, '/contract': 'lang', '/contract/[id]': 'id' | 'lang', '/gp/one': 'lang', '/gp/two': 'lang', '/main': 'lang', '/match/[id=ab]': 'id' | 'lang', '/match/[id=int]': 'id' | 'lang', '/site': 'lang', '/site/[id]': 'lang' | 'id', '/site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang', '/a/[...rest]/z': 'rest', '/lay/normal': never, '/lay/root-layout': never, '/lay/skip': never, '/sp': never } - SERVERS: { 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } + SERVERS: { 'GET /server_func_get': never, 'POST /server_func_post': never, 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } ACTIONS: { 'default /contract/[id]': 'id' | 'lang', 'create /site': 'lang', 'update /site/[id]': 'id' | 'lang', 'delete /site/[id]': 'id' | 'lang', 'noSatisfies /site_contract': 'lang', 'send /site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-path_shortened.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-path_shortened.ts index 14201a71..543ce5ae 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-path_shortened.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-path_shortened.ts @@ -61,6 +61,8 @@ export const PAGES = { * SERVERS */ export const SERVERS = { + "GET /server_func_get": `/server_func_get`, + "POST /server_func_post": `/server_func_post`, "GET /contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -168,7 +170,7 @@ export const currentSp = () => { */ export type KIT_ROUTES = { PAGES: { '/': never, '/subGroup': never, '/subGroup/user': never, '/subGroup2': never, '/contract': 'lang', '/contract/[id]': 'lang' | 'id', '/gp/one': 'lang', '/gp/two': 'lang', '/main': 'lang', '/match/[id=ab]': 'lang' | 'id', '/match/[id=int]': 'lang' | 'id', '/site': 'lang', '/site/[id]': 'lang' | 'id', '/site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang', '/a/[...rest]/z': 'rest', '/lay/normal': never, '/lay/root-layout': never, '/lay/skip': never, '/sp': never } - SERVERS: { 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } + SERVERS: { 'GET /server_func_get': never, 'POST /server_func_post': never, 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } ACTIONS: { 'default /contract/[id]': 'lang' | 'id', 'create /site': 'lang', 'update /site/[id]': 'lang' | 'id', 'delete /site/[id]': 'lang' | 'id', 'noSatisfies /site_contract': 'lang', 'send /site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-symbol.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-symbol.ts index 70dbfbc7..93bd9d37 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-symbol.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-symbol.ts @@ -61,6 +61,8 @@ export const PAGES = { * SERVERS */ export const SERVERS = { + "GET_server_func_get": `/server_func_get`, + "POST_server_func_post": `/server_func_post`, "GET_contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -167,7 +169,7 @@ export const currentSp = () => { */ export type KIT_ROUTES = { PAGES: { '_ROOT': never, 'subGroup': never, 'subGroup_user': never, 'subGroup2': never, 'contract': 'lang', 'contract_id': 'id' | 'lang', 'gp_one': 'lang', 'gp_two': 'lang', 'main': 'lang', 'match_id_ab': 'id' | 'lang', 'match_id_int': 'id' | 'lang', 'site': 'lang', 'site_id': 'lang' | 'id', 'site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang', 'a_rest_z': 'rest', 'lay_normal': never, 'lay_root_layout': never, 'lay_skip': never, 'sp': never } - SERVERS: { 'GET_contract': 'lang', 'POST_contract': 'lang', 'GET_site': 'lang', 'GET_api_graphql': never, 'POST_api_graphql': never, 'GET_data_errors_locale_json': 'locale' } + SERVERS: { 'GET_server_func_get': never, 'POST_server_func_post': never, 'GET_contract': 'lang', 'POST_contract': 'lang', 'GET_site': 'lang', 'GET_api_graphql': never, 'POST_api_graphql': never, 'GET_data_errors_locale_json': 'locale' } ACTIONS: { 'default_contract_id': 'id' | 'lang', 'create_site': 'lang', 'update_site_id': 'id' | 'lang', 'delete_site_id': 'id' | 'lang', 'noSatisfies_site_contract': 'lang', 'send_site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-symbol_shortened.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-symbol_shortened.ts index a33b37f8..c3b80c1c 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-symbol_shortened.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-object-symbol_shortened.ts @@ -61,6 +61,8 @@ export const PAGES = { * SERVERS */ export const SERVERS = { + "GET_server_func_get": `/server_func_get`, + "POST_server_func_post": `/server_func_post`, "GET_contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -168,7 +170,7 @@ export const currentSp = () => { */ export type KIT_ROUTES = { PAGES: { '_ROOT': never, 'subGroup': never, 'subGroup_user': never, 'subGroup2': never, 'contract': 'lang', 'contract_id': 'lang' | 'id', 'gp_one': 'lang', 'gp_two': 'lang', 'main': 'lang', 'match_id_ab': 'lang' | 'id', 'match_id_int': 'lang' | 'id', 'site': 'lang', 'site_id': 'lang' | 'id', 'site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang', 'a_rest_z': 'rest', 'lay_normal': never, 'lay_root_layout': never, 'lay_skip': never, 'sp': never } - SERVERS: { 'GET_contract': 'lang', 'POST_contract': 'lang', 'GET_site': 'lang', 'GET_api_graphql': never, 'POST_api_graphql': never, 'GET_data_errors_locale_json': 'locale' } + SERVERS: { 'GET_server_func_get': never, 'POST_server_func_post': never, 'GET_contract': 'lang', 'POST_contract': 'lang', 'GET_site': 'lang', 'GET_api_graphql': never, 'POST_api_graphql': never, 'GET_data_errors_locale_json': 'locale' } ACTIONS: { 'default_contract_id': 'lang' | 'id', 'create_site': 'lang', 'update_site_id': 'lang' | 'id', 'delete_site_id': 'lang' | 'id', 'noSatisfies_site_contract': 'lang', 'send_site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-path.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-path.ts index 1fcc27c8..412598de 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-path.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-path.ts @@ -61,6 +61,8 @@ export const PAGES = { * SERVERS */ export const SERVERS = { + "GET /server_func_get": `/server_func_get`, + "POST /server_func_post": `/server_func_post`, "GET /contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -194,7 +196,7 @@ export function route(key: T, ...params: any[]): strin */ export type KIT_ROUTES = { PAGES: { '/': never, '/subGroup': never, '/subGroup/user': never, '/subGroup2': never, '/contract': 'lang', '/contract/[id]': 'id' | 'lang', '/gp/one': 'lang', '/gp/two': 'lang', '/main': 'lang', '/match/[id=ab]': 'id' | 'lang', '/match/[id=int]': 'id' | 'lang', '/site': 'lang', '/site/[id]': 'lang' | 'id', '/site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang', '/a/[...rest]/z': 'rest', '/lay/normal': never, '/lay/root-layout': never, '/lay/skip': never, '/sp': never } - SERVERS: { 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } + SERVERS: { 'GET /server_func_get': never, 'POST /server_func_post': never, 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } ACTIONS: { 'default /contract/[id]': 'id' | 'lang', 'create /site': 'lang', 'update /site/[id]': 'id' | 'lang', 'delete /site/[id]': 'id' | 'lang', 'noSatisfies /site_contract': 'lang', 'send /site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-path_shortened.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-path_shortened.ts index fb978c69..8e937489 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-path_shortened.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-path_shortened.ts @@ -61,6 +61,8 @@ export const PAGES = { * SERVERS */ export const SERVERS = { + "GET /server_func_get": `/server_func_get`, + "POST /server_func_post": `/server_func_post`, "GET /contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -195,7 +197,7 @@ export function route(key: T, ...params: any[]): strin */ export type KIT_ROUTES = { PAGES: { '/': never, '/subGroup': never, '/subGroup/user': never, '/subGroup2': never, '/contract': 'lang', '/contract/[id]': 'lang' | 'id', '/gp/one': 'lang', '/gp/two': 'lang', '/main': 'lang', '/match/[id=ab]': 'lang' | 'id', '/match/[id=int]': 'lang' | 'id', '/site': 'lang', '/site/[id]': 'lang' | 'id', '/site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang', '/a/[...rest]/z': 'rest', '/lay/normal': never, '/lay/root-layout': never, '/lay/skip': never, '/sp': never } - SERVERS: { 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } + SERVERS: { 'GET /server_func_get': never, 'POST /server_func_post': never, 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } ACTIONS: { 'default /contract/[id]': 'lang' | 'id', 'create /site': 'lang', 'update /site/[id]': 'lang' | 'id', 'delete /site/[id]': 'lang' | 'id', 'noSatisfies /site_contract': 'lang', 'send /site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-symbol.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-symbol.ts index b73ca195..b03bbe9d 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-symbol.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-symbol.ts @@ -61,6 +61,8 @@ export const PAGES = { * SERVERS */ export const SERVERS = { + "GET server_func_get": `/server_func_get`, + "POST server_func_post": `/server_func_post`, "GET contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -194,7 +196,7 @@ export function route(key: T, ...params: any[]): strin */ export type KIT_ROUTES = { PAGES: { '_ROOT': never, 'subGroup': never, 'subGroup_user': never, 'subGroup2': never, 'contract': 'lang', 'contract_id': 'id' | 'lang', 'gp_one': 'lang', 'gp_two': 'lang', 'main': 'lang', 'match_id_ab': 'id' | 'lang', 'match_id_int': 'id' | 'lang', 'site': 'lang', 'site_id': 'lang' | 'id', 'site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang', 'a_rest_z': 'rest', 'lay_normal': never, 'lay_root_layout': never, 'lay_skip': never, 'sp': never } - SERVERS: { 'GET contract': 'lang', 'POST contract': 'lang', 'GET site': 'lang', 'GET api_graphql': never, 'POST api_graphql': never, 'GET data_errors_locale_json': 'locale' } + SERVERS: { 'GET server_func_get': never, 'POST server_func_post': never, 'GET contract': 'lang', 'POST contract': 'lang', 'GET site': 'lang', 'GET api_graphql': never, 'POST api_graphql': never, 'GET data_errors_locale_json': 'locale' } ACTIONS: { 'default contract_id': 'id' | 'lang', 'create site': 'lang', 'update site_id': 'id' | 'lang', 'delete site_id': 'id' | 'lang', 'noSatisfies site_contract': 'lang', 'send site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-symbol_shortened.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-symbol_shortened.ts index f1231e9a..7b5c8e54 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-symbol_shortened.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-and-object-symbol_shortened.ts @@ -61,6 +61,8 @@ export const PAGES = { * SERVERS */ export const SERVERS = { + "GET server_func_get": `/server_func_get`, + "POST server_func_post": `/server_func_post`, "GET contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -195,7 +197,7 @@ export function route(key: T, ...params: any[]): strin */ export type KIT_ROUTES = { PAGES: { '_ROOT': never, 'subGroup': never, 'subGroup_user': never, 'subGroup2': never, 'contract': 'lang', 'contract_id': 'lang' | 'id', 'gp_one': 'lang', 'gp_two': 'lang', 'main': 'lang', 'match_id_ab': 'lang' | 'id', 'match_id_int': 'lang' | 'id', 'site': 'lang', 'site_id': 'lang' | 'id', 'site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang', 'a_rest_z': 'rest', 'lay_normal': never, 'lay_root_layout': never, 'lay_skip': never, 'sp': never } - SERVERS: { 'GET contract': 'lang', 'POST contract': 'lang', 'GET site': 'lang', 'GET api_graphql': never, 'POST api_graphql': never, 'GET data_errors_locale_json': 'locale' } + SERVERS: { 'GET server_func_get': never, 'POST server_func_post': never, 'GET contract': 'lang', 'POST contract': 'lang', 'GET site': 'lang', 'GET api_graphql': never, 'POST api_graphql': never, 'GET data_errors_locale_json': 'locale' } ACTIONS: { 'default contract_id': 'lang' | 'id', 'create site': 'lang', 'update site_id': 'lang' | 'id', 'delete site_id': 'lang' | 'id', 'noSatisfies site_contract': 'lang', 'send site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-path.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-path.ts index a3ce38cb..71ee9f44 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-path.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-path.ts @@ -61,6 +61,8 @@ const PAGES = { * SERVERS */ const SERVERS = { + "GET /server_func_get": `/server_func_get`, + "POST /server_func_post": `/server_func_post`, "GET /contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -194,7 +196,7 @@ export function route(key: T, ...params: any[]): strin */ export type KIT_ROUTES = { PAGES: { '/': never, '/subGroup': never, '/subGroup/user': never, '/subGroup2': never, '/contract': 'lang', '/contract/[id]': 'id' | 'lang', '/gp/one': 'lang', '/gp/two': 'lang', '/main': 'lang', '/match/[id=ab]': 'id' | 'lang', '/match/[id=int]': 'id' | 'lang', '/site': 'lang', '/site/[id]': 'lang' | 'id', '/site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang', '/a/[...rest]/z': 'rest', '/lay/normal': never, '/lay/root-layout': never, '/lay/skip': never, '/sp': never } - SERVERS: { 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } + SERVERS: { 'GET /server_func_get': never, 'POST /server_func_post': never, 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } ACTIONS: { 'default /contract/[id]': 'id' | 'lang', 'create /site': 'lang', 'update /site/[id]': 'id' | 'lang', 'delete /site/[id]': 'id' | 'lang', 'noSatisfies /site_contract': 'lang', 'send /site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-path_shortened.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-path_shortened.ts index 588089bf..1e1cedc4 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-path_shortened.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-path_shortened.ts @@ -61,6 +61,8 @@ const PAGES = { * SERVERS */ const SERVERS = { + "GET /server_func_get": `/server_func_get`, + "POST /server_func_post": `/server_func_post`, "GET /contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -195,7 +197,7 @@ export function route(key: T, ...params: any[]): strin */ export type KIT_ROUTES = { PAGES: { '/': never, '/subGroup': never, '/subGroup/user': never, '/subGroup2': never, '/contract': 'lang', '/contract/[id]': 'lang' | 'id', '/gp/one': 'lang', '/gp/two': 'lang', '/main': 'lang', '/match/[id=ab]': 'lang' | 'id', '/match/[id=int]': 'lang' | 'id', '/site': 'lang', '/site/[id]': 'lang' | 'id', '/site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang', '/a/[...rest]/z': 'rest', '/lay/normal': never, '/lay/root-layout': never, '/lay/skip': never, '/sp': never } - SERVERS: { 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } + SERVERS: { 'GET /server_func_get': never, 'POST /server_func_post': never, 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } ACTIONS: { 'default /contract/[id]': 'lang' | 'id', 'create /site': 'lang', 'update /site/[id]': 'lang' | 'id', 'delete /site/[id]': 'lang' | 'id', 'noSatisfies /site_contract': 'lang', 'send /site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-symbol.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-symbol.ts index bddbdf19..b7660fc7 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-symbol.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-symbol.ts @@ -61,6 +61,8 @@ const PAGES = { * SERVERS */ const SERVERS = { + "GET server_func_get": `/server_func_get`, + "POST server_func_post": `/server_func_post`, "GET contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -194,7 +196,7 @@ export function route(key: T, ...params: any[]): strin */ export type KIT_ROUTES = { PAGES: { '_ROOT': never, 'subGroup': never, 'subGroup_user': never, 'subGroup2': never, 'contract': 'lang', 'contract_id': 'id' | 'lang', 'gp_one': 'lang', 'gp_two': 'lang', 'main': 'lang', 'match_id_ab': 'id' | 'lang', 'match_id_int': 'id' | 'lang', 'site': 'lang', 'site_id': 'lang' | 'id', 'site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang', 'a_rest_z': 'rest', 'lay_normal': never, 'lay_root_layout': never, 'lay_skip': never, 'sp': never } - SERVERS: { 'GET contract': 'lang', 'POST contract': 'lang', 'GET site': 'lang', 'GET api_graphql': never, 'POST api_graphql': never, 'GET data_errors_locale_json': 'locale' } + SERVERS: { 'GET server_func_get': never, 'POST server_func_post': never, 'GET contract': 'lang', 'POST contract': 'lang', 'GET site': 'lang', 'GET api_graphql': never, 'POST api_graphql': never, 'GET data_errors_locale_json': 'locale' } ACTIONS: { 'default contract_id': 'id' | 'lang', 'create site': 'lang', 'update site_id': 'id' | 'lang', 'delete site_id': 'id' | 'lang', 'noSatisfies site_contract': 'lang', 'send site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-symbol_shortened.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-symbol_shortened.ts index f7af5915..8edea596 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-symbol_shortened.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-route-symbol_shortened.ts @@ -61,6 +61,8 @@ const PAGES = { * SERVERS */ const SERVERS = { + "GET server_func_get": `/server_func_get`, + "POST server_func_post": `/server_func_post`, "GET contract": (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -195,7 +197,7 @@ export function route(key: T, ...params: any[]): strin */ export type KIT_ROUTES = { PAGES: { '_ROOT': never, 'subGroup': never, 'subGroup_user': never, 'subGroup2': never, 'contract': 'lang', 'contract_id': 'lang' | 'id', 'gp_one': 'lang', 'gp_two': 'lang', 'main': 'lang', 'match_id_ab': 'lang' | 'id', 'match_id_int': 'lang' | 'id', 'site': 'lang', 'site_id': 'lang' | 'id', 'site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang', 'a_rest_z': 'rest', 'lay_normal': never, 'lay_root_layout': never, 'lay_skip': never, 'sp': never } - SERVERS: { 'GET contract': 'lang', 'POST contract': 'lang', 'GET site': 'lang', 'GET api_graphql': never, 'POST api_graphql': never, 'GET data_errors_locale_json': 'locale' } + SERVERS: { 'GET server_func_get': never, 'POST server_func_post': never, 'GET contract': 'lang', 'POST contract': 'lang', 'GET site': 'lang', 'GET api_graphql': never, 'POST api_graphql': never, 'GET data_errors_locale_json': 'locale' } ACTIONS: { 'default contract_id': 'lang' | 'id', 'create site': 'lang', 'update site_id': 'lang' | 'id', 'delete site_id': 'lang' | 'id', 'noSatisfies site_contract': 'lang', 'send site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-variables.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-variables.ts index 68088a7e..cfbd831d 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-variables.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-variables.ts @@ -58,6 +58,8 @@ export const PAGE_sp = `/sp` /** * SERVERS */ +export const SERVER_GET_server_func_get = `/server_func_get` +export const SERVER_POST_server_func_post = `/server_func_post` export const SERVER_GET_contract = (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` } @@ -159,7 +161,7 @@ export const currentSp = () => { */ export type KIT_ROUTES = { PAGES: { '_ROOT': never, 'subGroup': never, 'subGroup_user': never, 'subGroup2': never, 'contract': 'lang', 'contract_id': 'id' | 'lang', 'gp_one': 'lang', 'gp_two': 'lang', 'main': 'lang', 'match_id_ab': 'id' | 'lang', 'match_id_int': 'id' | 'lang', 'site': 'lang', 'site_id': 'lang' | 'id', 'site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang', 'a_rest_z': 'rest', 'lay_normal': never, 'lay_root_layout': never, 'lay_skip': never, 'sp': never } - SERVERS: { 'GET_contract': 'lang', 'POST_contract': 'lang', 'GET_site': 'lang', 'GET_api_graphql': never, 'POST_api_graphql': never, 'GET_data_errors_locale_json': 'locale' } + SERVERS: { 'GET_server_func_get': never, 'POST_server_func_post': never, 'GET_contract': 'lang', 'POST_contract': 'lang', 'GET_site': 'lang', 'GET_api_graphql': never, 'POST_api_graphql': never, 'GET_data_errors_locale_json': 'locale' } ACTIONS: { 'default_contract_id': 'id' | 'lang', 'create_site': 'lang', 'update_site_id': 'id' | 'lang', 'delete_site_id': 'id' | 'lang', 'noSatisfies_site_contract': 'lang', 'send_site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-variables_shortened.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-variables_shortened.ts index 8676acd1..3993886b 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_format-variables_shortened.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_format-variables_shortened.ts @@ -58,6 +58,8 @@ export const PAGE_sp = `/sp` /** * SERVERS */ +export const SERVER_GET_server_func_get = `/server_func_get` +export const SERVER_POST_server_func_post = `/server_func_post` export const SERVER_GET_contract = (params?: { lang?: ('fr' | 'en' | 'hu' | 'at' | string) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` } @@ -160,7 +162,7 @@ export const currentSp = () => { */ export type KIT_ROUTES = { PAGES: { '_ROOT': never, 'subGroup': never, 'subGroup_user': never, 'subGroup2': never, 'contract': 'lang', 'contract_id': 'lang' | 'id', 'gp_one': 'lang', 'gp_two': 'lang', 'main': 'lang', 'match_id_ab': 'lang' | 'id', 'match_id_int': 'lang' | 'id', 'site': 'lang', 'site_id': 'lang' | 'id', 'site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang', 'a_rest_z': 'rest', 'lay_normal': never, 'lay_root_layout': never, 'lay_skip': never, 'sp': never } - SERVERS: { 'GET_contract': 'lang', 'POST_contract': 'lang', 'GET_site': 'lang', 'GET_api_graphql': never, 'POST_api_graphql': never, 'GET_data_errors_locale_json': 'locale' } + SERVERS: { 'GET_server_func_get': never, 'POST_server_func_post': never, 'GET_contract': 'lang', 'POST_contract': 'lang', 'GET_site': 'lang', 'GET_api_graphql': never, 'POST_api_graphql': never, 'GET_data_errors_locale_json': 'locale' } ACTIONS: { 'default_contract_id': 'lang' | 'id', 'create_site': 'lang', 'update_site_id': 'lang' | 'id', 'delete_site_id': 'lang' | 'id', 'noSatisfies_site_contract': 'lang', 'send_site_contract_siteId_contractId': 'siteId' | 'contractId' | 'lang' } LINKS: { 'twitter': never, 'twitter_post': 'name' | 'id', 'gravatar': 'str' } Params: { first: never, lang: never, id: never, limit: never, demo: never, siteId: never, contractId: never, rest: never, locale: never, extra: never, name: never, str: never, s: never, d: never } diff --git a/packages/vite-plugin-kit-routes/src/test/ROUTES_post-update.ts b/packages/vite-plugin-kit-routes/src/test/ROUTES_post-update.ts index 202c8c2f..eac6b94e 100644 --- a/packages/vite-plugin-kit-routes/src/test/ROUTES_post-update.ts +++ b/packages/vite-plugin-kit-routes/src/test/ROUTES_post-update.ts @@ -56,6 +56,8 @@ const PAGES = { * SERVERS */ const SERVERS = { + "GET /server_func_get": `/server_func_get`, + "POST /server_func_post": `/server_func_post`, "GET /contract": (params?: { lang?: (string | number) }) => { return `${params?.lang ? `/${params?.lang}`: ''}/contract` }, @@ -180,7 +182,7 @@ export function route(key: T, ...params: any[]): strin */ export type KIT_ROUTES = { PAGES: { '/': never, '/subGroup': never, '/subGroup/user': never, '/subGroup2': never, '/contract': 'lang', '/contract/[id]': 'id' | 'lang', '/gp/one': 'lang', '/gp/two': 'lang', '/main': 'lang', '/match/[id=ab]': 'id' | 'lang', '/match/[id=int]': 'id' | 'lang', '/site': 'lang', '/site/[id]': 'id' | 'lang', '/site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang', '/a/[...rest]/z': 'rest', '/lay/normal': never, '/lay/root-layout': never, '/lay/skip': never, '/sp': never } - SERVERS: { 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } + SERVERS: { 'GET /server_func_get': never, 'POST /server_func_post': never, 'GET /contract': 'lang', 'POST /contract': 'lang', 'GET /site': 'lang', 'GET /api/graphql': never, 'POST /api/graphql': never, 'GET /data/errors/[locale].json': 'locale' } ACTIONS: { 'default /contract/[id]': 'id' | 'lang', 'create /site': 'lang', 'update /site/[id]': 'id' | 'lang', 'delete /site/[id]': 'id' | 'lang', 'noSatisfies /site_contract': 'lang', 'send /site_contract/[siteId]-[contractId]': 'siteId' | 'contractId' | 'lang' } LINKS: Record Params: { lang: never, id: never, siteId: never, contractId: never, rest: never, locale: never } diff --git a/packages/vite-plugin-striper/package.json b/packages/vite-plugin-striper/package.json index 09706b6a..5f776658 100644 --- a/packages/vite-plugin-striper/package.json +++ b/packages/vite-plugin-striper/package.json @@ -29,7 +29,7 @@ "devDependencies": { "@kitql/eslint-config": "workspace:*", "@sveltejs/adapter-auto": "2.1.0", - "@sveltejs/kit": "1.29.0", + "@sveltejs/kit": "1.30.1", "@sveltejs/package": "2.2.2", "publint": "0.2.4", "svelte": "4.2.1", diff --git a/packages/vite-plugin-striper/src/lib/plugin.ts b/packages/vite-plugin-striper/src/lib/plugin.ts index dcc91991..ac9f4970 100644 --- a/packages/vite-plugin-striper/src/lib/plugin.ts +++ b/packages/vite-plugin-striper/src/lib/plugin.ts @@ -1,4 +1,4 @@ -import { green, Log, yellow } from '@kitql/helpers' +import { gray, green, Log, yellow } from '@kitql/helpers' import { getFilesUnder } from '@kitql/internals' import { readFileSync } from 'fs' import type { Plugin } from 'vite' @@ -101,9 +101,10 @@ export function striper(sCptions?: ViteStriperOptions): Plugin[] { if (sCptions?.debug && info.length > 0) { log.info( `` + - `${green('-----')} after transform of ${yellow(filepath)}\n` + + `${gray('File :')} ${yellow(filepath)}\n` + + `${green('-----')}\n` + `${rest.code}` + - `\n${green(':::::')}` + + `\n${green(':::::')}\n` + `${info}` + `\n${green('-----')}` + ``, diff --git a/packages/vite-plugin-striper/src/lib/transformDecorator.ts b/packages/vite-plugin-striper/src/lib/transformDecorator.ts index 60b9829e..c0bd6f92 100644 --- a/packages/vite-plugin-striper/src/lib/transformDecorator.ts +++ b/packages/vite-plugin-striper/src/lib/transformDecorator.ts @@ -70,7 +70,8 @@ export const removeUnusedImports = async (code: string) => { this.traverse(path) }, }) - console.log(`usedIdentifiers`, usedIdentifiers) + + // console.log(`usedIdentifiers`, usedIdentifiers) let removed = Array.from(originalImports) diff --git a/packages/vite-plugin-striper/svelte.config.js b/packages/vite-plugin-striper/svelte.config.js index 18b47166..022474c2 100644 --- a/packages/vite-plugin-striper/svelte.config.js +++ b/packages/vite-plugin-striper/svelte.config.js @@ -15,4 +15,5 @@ const config = { }, } +// eslint-disable-next-line import/no-default-export export default config diff --git a/packages/vite-plugin-striper/tsconfig.eslint.json b/packages/vite-plugin-striper/tsconfig.eslint.json new file mode 100644 index 00000000..be5346c1 --- /dev/null +++ b/packages/vite-plugin-striper/tsconfig.eslint.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.json", + "include": [ + "src/lib/**/*.ts", + "./**/*", + "./**/.*", + "./**/.*.[tj]s?(x)", + "svelte.config.js", + "vite.config.ts", + ".eslintrc.cjs", + "README.md", + "**/*" + ], + "exclude": [] +} diff --git a/packages/vite-plugin-watch-and-run/package.json b/packages/vite-plugin-watch-and-run/package.json index 4fe97ef5..7bc4c01c 100644 --- a/packages/vite-plugin-watch-and-run/package.json +++ b/packages/vite-plugin-watch-and-run/package.json @@ -30,7 +30,7 @@ "@kitql/eslint-config": "workspace:*", "@types/micromatch": "4.0.2", "@sveltejs/adapter-auto": "2.1.0", - "@sveltejs/kit": "1.29.0", + "@sveltejs/kit": "1.30.1", "@sveltejs/package": "2.2.2", "publint": "0.2.4", "svelte": "4.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ee1a726e..8d1f8369 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -112,10 +112,10 @@ importers: version: link:../eslint-config '@sveltejs/adapter-node': specifier: 1.3.1 - version: 1.3.1(@sveltejs/kit@1.29.0) + version: 1.3.1(@sveltejs/kit@1.30.1) '@sveltejs/kit': - specifier: 1.29.0 - version: 1.29.0(svelte@4.2.1)(vite@4.5.0) + specifier: 1.30.1 + version: 1.30.1(svelte@4.2.1)(vite@4.5.0) '@sveltejs/package': specifier: 2.2.2 version: 2.2.2(svelte@4.2.1)(typescript@5.3.2) @@ -149,10 +149,10 @@ importers: version: link:../eslint-config '@sveltejs/adapter-auto': specifier: 2.1.0 - version: 2.1.0(@sveltejs/kit@1.29.0) + version: 2.1.0(@sveltejs/kit@1.30.1) '@sveltejs/kit': - specifier: 1.29.0 - version: 1.29.0(svelte@4.2.1)(vite@4.5.0) + specifier: 1.30.1 + version: 1.30.1(svelte@4.2.1)(vite@4.5.0) '@sveltejs/package': specifier: 2.2.2 version: 2.2.2(svelte@4.2.1)(typescript@5.3.2) @@ -202,10 +202,10 @@ importers: version: link:../eslint-config '@sveltejs/adapter-auto': specifier: 2.1.0 - version: 2.1.0(@sveltejs/kit@1.29.0) + version: 2.1.0(@sveltejs/kit@1.30.1) '@sveltejs/kit': - specifier: 1.29.0 - version: 1.29.0(svelte@4.2.1)(vite@4.5.0) + specifier: 1.30.1 + version: 1.30.1(svelte@4.2.1)(vite@4.5.0) '@sveltejs/package': specifier: 2.2.2 version: 2.2.2(svelte@4.2.1)(typescript@5.3.2) @@ -255,10 +255,10 @@ importers: version: link:../eslint-config '@sveltejs/adapter-auto': specifier: 2.1.0 - version: 2.1.0(@sveltejs/kit@1.29.0) + version: 2.1.0(@sveltejs/kit@1.30.1) '@sveltejs/kit': - specifier: 1.29.0 - version: 1.29.0(svelte@4.2.1)(vite@4.5.0) + specifier: 1.30.1 + version: 1.30.1(svelte@4.2.1)(vite@4.5.0) '@sveltejs/package': specifier: 2.2.2 version: 2.2.2(svelte@4.2.1)(typescript@5.3.2) @@ -308,10 +308,10 @@ importers: version: link:../eslint-config '@sveltejs/adapter-auto': specifier: 2.1.0 - version: 2.1.0(@sveltejs/kit@1.29.0) + version: 2.1.0(@sveltejs/kit@1.30.1) '@sveltejs/kit': - specifier: 1.29.0 - version: 1.29.0(svelte@4.2.1)(vite@4.5.0) + specifier: 1.30.1 + version: 1.30.1(svelte@4.2.1)(vite@4.5.0) '@sveltejs/package': specifier: 2.2.2 version: 2.2.2(svelte@4.2.1)(typescript@5.3.2) @@ -352,10 +352,10 @@ importers: version: link:../eslint-config '@sveltejs/adapter-auto': specifier: 2.1.0 - version: 2.1.0(@sveltejs/kit@1.29.0) + version: 2.1.0(@sveltejs/kit@1.30.1) '@sveltejs/kit': - specifier: 1.29.0 - version: 1.29.0(svelte@4.2.1)(vite@4.5.0) + specifier: 1.30.1 + version: 1.30.1(svelte@4.2.1)(vite@4.5.0) '@sveltejs/package': specifier: 2.2.2 version: 2.2.2(svelte@4.2.1)(typescript@5.3.2) @@ -2746,16 +2746,16 @@ packages: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true - /@sveltejs/adapter-auto@2.1.0(@sveltejs/kit@1.29.0): + /@sveltejs/adapter-auto@2.1.0(@sveltejs/kit@1.30.1): resolution: {integrity: sha512-o2pZCfATFtA/Gw/BB0Xm7k4EYaekXxaPGER3xGSY3FvzFJGTlJlZjBseaXwYSM94lZ0HniOjTokN3cWaLX6fow==} peerDependencies: '@sveltejs/kit': ^1.0.0 dependencies: - '@sveltejs/kit': 1.29.0(svelte@4.2.1)(vite@4.5.0) + '@sveltejs/kit': 1.30.1(svelte@4.2.1)(vite@4.5.0) import-meta-resolve: 3.0.0 dev: true - /@sveltejs/adapter-node@1.3.1(@sveltejs/kit@1.29.0): + /@sveltejs/adapter-node@1.3.1(@sveltejs/kit@1.30.1): resolution: {integrity: sha512-A0VgRQDCDPzdLNoiAbcOxGw4zT1Mc+n1LwT1OmO350R7WxrEqdMUChPPOd1iMfIDWlP4ie6E2d/WQf5es2d4Zw==} peerDependencies: '@sveltejs/kit': ^1.0.0 @@ -2763,12 +2763,12 @@ packages: '@rollup/plugin-commonjs': 25.0.5(rollup@3.29.4) '@rollup/plugin-json': 6.0.1(rollup@3.29.4) '@rollup/plugin-node-resolve': 15.2.3(rollup@3.29.4) - '@sveltejs/kit': 1.29.0(svelte@4.2.1)(vite@4.5.0) + '@sveltejs/kit': 1.30.1(svelte@4.2.1)(vite@4.5.0) rollup: 3.29.4 dev: true - /@sveltejs/kit@1.29.0(svelte@4.2.1)(vite@4.5.0): - resolution: {integrity: sha512-O+DvB67Ouha0pVKh0nRxr8QwZcls8h4knLoS6Sk1DhRLAuQzuM0FNnPNIhMHL1iP1LFeXd3P+bk+h2V07WSF5w==} + /@sveltejs/kit@1.30.1(svelte@4.2.1)(vite@4.5.0): + resolution: {integrity: sha512-N4hMFTRmnkB0q1uB93wfM8As2q4zYI2FQ01K8dQOCAWbm2y6mB0pmF12ILO+zbEim13csBLO0JyAWJRSd101hQ==} engines: {node: ^16.14 || >=18} hasBin: true requiresBuild: true