@typed/vite-plugin 0.0.26 → 0.0.28
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/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/resolveTypedConfig.d.ts +7 -0
- package/dist/resolveTypedConfig.d.ts.map +1 -0
- package/dist/resolveTypedConfig.js +12 -0
- package/dist/resolveTypedConfig.js.map +1 -0
- package/dist/vite-plugin.d.ts +3 -55
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.js +102 -408
- package/dist/vite-plugin.js.map +1 -1
- package/package.json +6 -4
- package/src/constants.ts +1 -0
- package/src/index.ts +6 -0
- package/src/resolveTypedConfig.test.ts +40 -0
- package/src/resolveTypedConfig.ts +21 -0
- package/src/vite-plugin.ts +144 -640
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,uBAAuB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAA"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,kBAAkB,CAAA;AAEpC,eAAe,KAAK,CAAA;AAEpB,cAAc,kBAAkB,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,kBAAkB,CAAA;AAEpC,eAAe,KAAK,CAAA;AAEpB,cAAc,kBAAkB,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Option } from '@fp-ts/core/Option';
|
|
2
|
+
import type { ResolvedOptions } from '@typed/compiler';
|
|
3
|
+
import { resolveConfig } from 'vite';
|
|
4
|
+
export declare function resolveTypedConfig(...args: ArgsOf<typeof resolveConfig>): Promise<Option<ResolvedOptions>>;
|
|
5
|
+
type ArgsOf<T> = T extends (...args: infer A) => any ? A : never;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=resolveTypedConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveTypedConfig.d.ts","sourceRoot":"","sources":["../src/resolveTypedConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAKpC,wBAAsB,kBAAkB,CACtC,GAAG,IAAI,EAAE,MAAM,CAAC,OAAO,aAAa,CAAC,GACpC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CASlC;AAED,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,KAAK,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { none, some } from '@fp-ts/core/Option';
|
|
2
|
+
import { resolveConfig } from 'vite';
|
|
3
|
+
import { PLUGIN_NAME } from './constants.js';
|
|
4
|
+
export async function resolveTypedConfig(...args) {
|
|
5
|
+
const config = await resolveConfig(...args);
|
|
6
|
+
const typedPlugin = config.plugins.find((p) => p.name === PLUGIN_NAME);
|
|
7
|
+
if (!typedPlugin) {
|
|
8
|
+
return none();
|
|
9
|
+
}
|
|
10
|
+
return some(typedPlugin.resolvedOptions);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=resolveTypedConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveTypedConfig.js","sourceRoot":"","sources":["../src/resolveTypedConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAe,MAAM,oBAAoB,CAAA;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAG,IAAkC;IAErC,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,GAAG,IAAI,CAAC,CAAA;IAC3C,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAwB,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAA;IAE5F,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,IAAI,EAAE,CAAA;KACd;IAED,OAAO,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,CAAA;AAC1C,CAAC"}
|
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ResolvedOptions } from '@typed/compiler';
|
|
2
2
|
import type { Plugin, PluginOption } from 'vite';
|
|
3
|
+
import { PLUGIN_NAME } from './constants.js';
|
|
3
4
|
/**
|
|
4
5
|
* The Configuration for the Typed Plugin. All file paths can be relative to sourceDirectory or
|
|
5
6
|
* can be absolute, path.resolve is used to stitch things together.
|
|
@@ -44,62 +45,9 @@ export interface PluginOptions {
|
|
|
44
45
|
*/
|
|
45
46
|
readonly isStaticBuild?: boolean;
|
|
46
47
|
}
|
|
47
|
-
export declare const PLUGIN_NAME = "@typed/vite-plugin";
|
|
48
48
|
export interface TypedVitePlugin extends Plugin {
|
|
49
49
|
readonly name: typeof PLUGIN_NAME;
|
|
50
50
|
readonly resolvedOptions: ResolvedOptions;
|
|
51
51
|
}
|
|
52
|
-
export
|
|
53
|
-
readonly entryFiles: EntryFile[];
|
|
54
|
-
readonly modules: {
|
|
55
|
-
[importer: string]: Record<string, ManifestEntry>;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
export interface ClientManifest extends Manifest {
|
|
59
|
-
readonly entryFiles: HtmlEntryFile[];
|
|
60
|
-
readonly modules: {
|
|
61
|
-
[importer: string]: Record<string, ManifestEntry>;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
export type EntryFile = HtmlEntryFile | TsEntryFile;
|
|
65
|
-
export interface HtmlEntryFile {
|
|
66
|
-
readonly type: 'html';
|
|
67
|
-
readonly filePath: string;
|
|
68
|
-
readonly imports: string[];
|
|
69
|
-
readonly basePath: string;
|
|
70
|
-
}
|
|
71
|
-
export interface TsEntryFile {
|
|
72
|
-
readonly type: 'ts';
|
|
73
|
-
readonly filePath: string;
|
|
74
|
-
}
|
|
75
|
-
export type ManifestEntry = ApiManifestEntry | ExpressManifestEntry | HtmlManifestEntry | RuntimeManifestEntry | BrowserManifestEntry;
|
|
76
|
-
export interface ApiManifestEntry extends ApiModuleTreeJson {
|
|
77
|
-
readonly type: 'api';
|
|
78
|
-
}
|
|
79
|
-
export interface ExpressManifestEntry extends ApiModuleTreeJson {
|
|
80
|
-
readonly type: 'express';
|
|
81
|
-
}
|
|
82
|
-
export interface HtmlManifestEntry {
|
|
83
|
-
readonly type: 'html';
|
|
84
|
-
readonly filePath: string;
|
|
85
|
-
}
|
|
86
|
-
export interface BrowserManifestEntry extends ModuleTreeJsonWithFallback {
|
|
87
|
-
readonly type: 'browser';
|
|
88
|
-
}
|
|
89
|
-
export interface RuntimeManifestEntry extends ModuleTreeJsonWithFallback {
|
|
90
|
-
readonly type: 'runtime';
|
|
91
|
-
}
|
|
92
|
-
export interface ResolvedOptions {
|
|
93
|
-
readonly sourceDirectory: string;
|
|
94
|
-
readonly tsConfig: string;
|
|
95
|
-
readonly serverFilePath: string;
|
|
96
|
-
readonly clientOutputDirectory: string;
|
|
97
|
-
readonly serverOutputDirectory: string;
|
|
98
|
-
readonly htmlFiles: readonly string[];
|
|
99
|
-
readonly debug: boolean;
|
|
100
|
-
readonly saveGeneratedModules: boolean;
|
|
101
|
-
readonly isStaticBuild: boolean;
|
|
102
|
-
readonly base: string;
|
|
103
|
-
}
|
|
104
|
-
export default function makePlugin({ sourceDirectory: directory, tsConfig, serverFilePath, clientOutputDirectory, serverOutputDirectory, htmlFileGlobs, debug, saveGeneratedModules, isStaticBuild, }: PluginOptions): PluginOption[];
|
|
52
|
+
export default function makePlugin(pluginOptions: PluginOptions): PluginOption[];
|
|
105
53
|
//# sourceMappingURL=vite-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAIjF,OAAO,KAAK,EAAa,MAAM,EAAE,YAAY,EAA6B,MAAM,MAAM,CAAA;AAItF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAEhC;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAEhC;;OAEG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAEvC;;OAEG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAEvC;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAE1C;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;IAExB;;OAEG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAEvC;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CACjC;AAID,MAAM,WAAW,eAAgB,SAAQ,MAAM;IAC7C,QAAQ,CAAC,IAAI,EAAE,OAAO,WAAW,CAAA;IACjC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAA;CAC1C;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,aAAa,EAAE,aAAa,GAAG,YAAY,EAAE,CAuK/E"}
|