@tsed/vike 7.79.4 → 7.80.0

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.
@@ -1,3 +1,4 @@
1
+ var _a;
1
2
  import { __decorate, __metadata } from "tslib";
2
3
  import { PlatformApplication } from "@tsed/common";
3
4
  import { Inject, Module } from "@tsed/di";
@@ -40,7 +41,7 @@ __decorate([
40
41
  ], ViteModule.prototype, "viteService", void 0);
41
42
  __decorate([
42
43
  Inject(VITE_SERVER),
43
- __metadata("design:type", Object)
44
+ __metadata("design:type", typeof (_a = typeof VITE_SERVER !== "undefined" && VITE_SERVER) === "function" ? _a : Object)
44
45
  ], ViteModule.prototype, "viteServer", void 0);
45
46
  ViteModule = __decorate([
46
47
  Module({
@@ -1 +1 @@
1
- {"version":3,"file":"ViteModule.js","sourceRoot":"","sources":["../../src/ViteModule.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AACxC,OAAO,EAAwB,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAC1E,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAC,sBAAsB,EAAC,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAK/C,IAAM,UAAU,GAAhB,MAAM,UAAU;IAEX,GAAG,CAAsB;IAGzB,YAAY,CAAgB;IAG5B,WAAW,CAAc;IAGzB,UAAU,CAAc;IAElC,OAAO;QACL,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,MAAM,EAAE;YACvC,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,KAAK,EAAE,IAAY,EAAE,OAA8B,EAAE,EAAE;gBAC7D,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW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MAAM,EAAE;YACvC,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,KAAK,EAAE,IAAY,EAAE,OAA8B,EAAE,EAAE;gBAC7D,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;YAC9D,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,UAAU;QACR,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACxD,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC;IACnD,CAAC;CACF,CAAA;AA5BC;IAAC,MAAM,EAAE;8BACM,mBAAmB;uCAAC;AAEnC;IAAC,MAAM,EAAE;8BACe,aAAa;gDAAC;AAEtC;IAAC,MAAM,EAAE;8BACc,WAAW;+CAAC;AAEnC;IAAC,MAAM,CAAC,WAAW,CAAC;kDACE,WAAW,oBAAX,WAAW;8CAAC;AAXvB,UAAU;IAHtB,MAAM,CAAC;QACN,OAAO,EAAE,EAAE;KACZ,CAAC;GACW,UAAU,CA6BtB;SA7BY,UAAU"}
@@ -0,0 +1,13 @@
1
+ import { PlatformApplication } from "@tsed/common";
2
+ import { PlatformViews } from "@tsed/platform-views";
3
+ import { VITE_SERVER } from "./services/ViteServer.js";
4
+ import { ViteService } from "./services/ViteService.js";
5
+ export declare class ViteModule {
6
+ protected app: PlatformApplication;
7
+ protected platformView: PlatformViews;
8
+ protected viteService: ViteService;
9
+ protected viteServer: VITE_SERVER;
10
+ $onInit(): void;
11
+ $afterInit(): void;
12
+ $afterRoutesInit(): PlatformApplication<TsED.Application>;
13
+ }
@@ -0,0 +1 @@
1
+ export declare function Vite(path?: string): MethodDecorator;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @file Automatically generated by @tsed/barrels.
3
+ */
4
+ export * from "./decorators/vite.js";
5
+ export * from "./interfaces/interfaces.js";
6
+ export * from "./interfaces/ViteConfig.js";
7
+ export * from "./interfaces/ViteRenderContext.js";
8
+ export * from "./middlewares/ViteRendererMiddleware.js";
9
+ export * from "./services/ViteServer.js";
10
+ export * from "./services/ViteService.js";
11
+ export * from "./ViteModule.js";
@@ -0,0 +1,7 @@
1
+ import { Options } from "sirv";
2
+ import type { InlineConfig } from "vite";
3
+ export type ViteConfig = InlineConfig & {
4
+ enableStream?: boolean;
5
+ statics?: Omit<Options, "dev">;
6
+ stateSnapshot?(): unknown;
7
+ };
@@ -0,0 +1,14 @@
1
+ /// <reference types="node" />
2
+ import type { IncomingHttpHeaders } from "http";
3
+ export type VitePageProps<Data = Record<string, unknown>> = Data & {
4
+ view: string;
5
+ };
6
+ export interface ViteRenderContext<Data = Record<string, unknown>, Session = Record<string, unknown>> extends Record<string, unknown> {
7
+ host: string;
8
+ protocol: string;
9
+ method: string;
10
+ url: string;
11
+ secure: boolean;
12
+ headers: IncomingHttpHeaders;
13
+ session?: Session;
14
+ }
@@ -0,0 +1,8 @@
1
+ import { ViteConfig } from "./ViteConfig.js";
2
+ declare global {
3
+ namespace TsED {
4
+ interface Configuration {
5
+ vite: ViteConfig;
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import { Context } from "@tsed/common";
2
+ import { ViteService } from "../services/ViteService.js";
3
+ export declare class ViteRendererMiddleware {
4
+ protected viteService: ViteService;
5
+ use($ctx: Context): Promise<void>;
6
+ }
@@ -0,0 +1,3 @@
1
+ import type { ViteDevServer } from "vite";
2
+ export declare const VITE_SERVER: unique symbol;
3
+ export type VITE_SERVER = ViteDevServer;
@@ -0,0 +1,14 @@
1
+ /// <reference types="node" />
2
+ import { PlatformContext } from "@tsed/common";
3
+ import { Writable } from "stream";
4
+ import { ViteConfig } from "../interfaces/ViteConfig.js";
5
+ export declare class ViteService {
6
+ static moduleName: string;
7
+ protected config: ViteConfig;
8
+ private enableStream;
9
+ render(viewPath: string, { $ctx, ...opts }: {
10
+ $ctx: PlatformContext;
11
+ } & Record<string, any>): Promise<string | {
12
+ pipe(stream: Writable): void;
13
+ } | undefined>;
14
+ }
package/package.json CHANGED
@@ -1,40 +1,44 @@
1
1
  {
2
2
  "name": "@tsed/vike",
3
- "version": "7.79.4",
4
3
  "description": "Vike package for Ts.ED framework",
4
+ "type": "commonjs",
5
+ "version": "7.80.0",
5
6
  "source": "./src/index.ts",
6
7
  "main": "./lib/cjs/index.js",
7
8
  "module": "./lib/esm/index.js",
8
9
  "typings": "./lib/types/index.d.ts",
9
10
  "exports": {
10
- "types": "./lib/types/index.d.ts",
11
- "import": "./lib/esm/index.js",
12
- "require": "./lib/cjs/index.js",
13
- "default": "./lib/esm/index.js"
11
+ ".": {
12
+ "types": "./lib/types/index.d.ts",
13
+ "import": "./lib/esm/index.js",
14
+ "default": "./lib/cjs/index.js"
15
+ }
14
16
  },
15
17
  "scripts": {
16
18
  "build": "yarn barrels && yarn build:ts",
17
19
  "barrels": "barrels",
18
- "test": "jest --max-workers=2 && jest-coverage-thresholds-bumper",
19
- "build:ts": "tsc --build tsconfig.json && tsc --build tsconfig.esm.json"
20
+ "test": "vitest run",
21
+ "build:ts": "tsc --build tsconfig.json",
22
+ "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
20
23
  },
21
24
  "dependencies": {
22
25
  "sirv": "^2.0.4"
23
26
  },
24
27
  "devDependencies": {
25
- "@tsed/barrels": "7.79.4",
26
- "@tsed/common": "7.79.4",
27
- "@tsed/core": "7.79.4",
28
- "@tsed/di": "7.79.4",
29
- "@tsed/exceptions": "7.79.4",
30
- "@tsed/typescript": "7.79.4",
28
+ "@tsed/barrels": "7.80.0",
29
+ "@tsed/common": "7.80.0",
30
+ "@tsed/core": "7.80.0",
31
+ "@tsed/di": "7.80.0",
32
+ "@tsed/exceptions": "7.80.0",
33
+ "@tsed/typescript": "7.80.0",
31
34
  "eslint": "^8.57.0",
32
- "jest": "^29.7.0",
35
+ "typescript": "4.9.5",
33
36
  "vike": "0.4.160",
34
- "vite": "5.0.13"
37
+ "vite": "5.4.1",
38
+ "vitest": "2.0.4"
35
39
  },
36
40
  "peerDependencies": {
37
- "@tsed/common": "7.79.4",
41
+ "@tsed/common": "7.80.0",
38
42
  "vike": ">=0.4.160",
39
43
  "vite": ">=4"
40
44
  },
@@ -0,0 +1,21 @@
1
+ // @ts-ignore
2
+ import {presets} from "@tsed/vitest/presets";
3
+ import {defineConfig} from "vitest/config";
4
+
5
+ export default defineConfig(
6
+ {
7
+ ...presets,
8
+ test: {
9
+ ...presets.test,
10
+ coverage: {
11
+ ...presets.test.coverage,
12
+ thresholds: {
13
+ statements: 0,
14
+ branches: 0,
15
+ functions: 0,
16
+ lines: 0
17
+ }
18
+ }
19
+ }
20
+ }
21
+ );
package/jest.config.js DELETED
@@ -1,19 +0,0 @@
1
- // For a detailed explanation regarding each configuration property, visit:
2
- // https://jestjs.io/docs/en/configuration.html
3
-
4
- const config = require("@tsed/jest-config");
5
- module.exports = {
6
- ...config,
7
- moduleNameMapper: {
8
- ...config.moduleNameMapper,
9
- "@tsed/vike": "<rootDir>/src/index.ts"
10
- },
11
- coverageThreshold: {
12
- global: {
13
- statements: 0,
14
- branches: 0,
15
- functions: 0,
16
- lines: 0
17
- }
18
- }
19
- };
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
package/tsconfig.esm.json DELETED
@@ -1,42 +0,0 @@
1
- {
2
- "extends": "@tsed/typescript/tsconfig.node.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "module": "ES2020",
6
- "rootDir": "src",
7
- "outDir": "./lib/esm",
8
- "declaration": true,
9
- "declarationDir": "./lib/types",
10
- "composite": true,
11
- "noEmit": false
12
- },
13
- "include": ["src", "src/**/*.json"],
14
- "exclude": [
15
- "node_modules",
16
- "test",
17
- "lib",
18
- "benchmark",
19
- "coverage",
20
- "spec",
21
- "**/*.benchmark.ts",
22
- "**/*.spec.ts",
23
- "keys",
24
- "jest.config.js",
25
- "**/__mock__/**",
26
- "webpack.config.js"
27
- ],
28
- "references": [
29
- {
30
- "path": "../../platform/common"
31
- },
32
- {
33
- "path": "../../core"
34
- },
35
- {
36
- "path": "../../di"
37
- },
38
- {
39
- "path": "../../specs/exceptions"
40
- }
41
- ]
42
- }