@typed/vite-plugin 0.0.10 → 0.0.12
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/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/vite-plugin.d.ts +25 -8
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.js +287 -87
- package/dist/vite-plugin.js.map +1 -1
- package/package.json +8 -7
- package/src/index.ts +0 -3
- package/src/vite-plugin.ts +422 -105
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +0 -3
- package/src/browser.ts +0 -4
- package/src/server.ts +0 -4
- package/src/virtual-modules.d.ts +0 -39
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":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PluginOption } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* The Configuration for the Typed Plugin. All file paths can be relative to sourceDirectory or
|
|
4
|
+
* can be absolute, path.resolve is used to stitch things together.
|
|
5
|
+
*/
|
|
2
6
|
export interface PluginOptions {
|
|
3
7
|
/**
|
|
4
|
-
* The directory in which you have your
|
|
8
|
+
* The directory in which you have your application.
|
|
9
|
+
* This can be relative to the current working directory or absolute.
|
|
5
10
|
*/
|
|
6
|
-
readonly
|
|
11
|
+
readonly sourceDirectory: string;
|
|
7
12
|
/**
|
|
8
|
-
* The
|
|
13
|
+
* The file path to your tsconfig.json file.
|
|
9
14
|
*/
|
|
10
|
-
readonly tsConfig
|
|
15
|
+
readonly tsConfig?: string;
|
|
11
16
|
/**
|
|
12
|
-
*
|
|
17
|
+
* The file path to your server entry file
|
|
13
18
|
*/
|
|
14
|
-
readonly
|
|
19
|
+
readonly serverFilePath?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The output directory for your client code
|
|
22
|
+
*/
|
|
23
|
+
readonly clientOutputDirectory?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The output directory for your server code
|
|
26
|
+
*/
|
|
27
|
+
readonly serverOutputDirectory?: string;
|
|
28
|
+
/**
|
|
29
|
+
* File globs to use to look for your HTML entry points.
|
|
30
|
+
*/
|
|
31
|
+
readonly htmlFileGlobs?: readonly string[];
|
|
15
32
|
}
|
|
16
|
-
export default function makePlugin({ directory, tsConfig,
|
|
33
|
+
export default function makePlugin({ sourceDirectory: directory, tsConfig, serverFilePath, clientOutputDirectory, serverOutputDirectory, htmlFileGlobs, }: PluginOptions): PluginOption[];
|
|
17
34
|
//# sourceMappingURL=vite-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAqB,YAAY,EAA6B,MAAM,MAAM,CAAA;AAIjF;;;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;CAC3C;AAYD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,eAAe,EAAE,SAAS,EAC1B,QAAQ,EACR,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,GACd,EAAE,aAAa,GAAG,YAAY,EAAE,CA0QhC"}
|
package/dist/vite-plugin.js
CHANGED
|
@@ -1,114 +1,314 @@
|
|
|
1
1
|
import { existsSync } from 'fs';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { setupTsProject,
|
|
2
|
+
import { readFile } from 'fs/promises';
|
|
3
|
+
import { basename, dirname, join, relative, resolve } from 'path';
|
|
4
|
+
import { setupTsProject, makeBrowserModule, makeHtmlModule, makeRuntimeModule, readDirectory, readModules, } from '@typed/compiler';
|
|
5
|
+
import glob from 'fast-glob';
|
|
5
6
|
import { ts } from 'ts-morph';
|
|
6
|
-
// @ts-expect-error
|
|
7
|
-
import
|
|
7
|
+
// @ts-expect-error Unable to resolve types w/ NodeNext
|
|
8
|
+
import vavite from 'vavite';
|
|
9
|
+
import compression from 'vite-plugin-compression';
|
|
8
10
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
9
11
|
const cwd = process.cwd();
|
|
10
12
|
const PLUGIN_NAME = '@typed/vite-plugin';
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
13
|
+
const RUNTIME_VIRTUAL_ENTRYPOINT_PREFIX = 'runtime';
|
|
14
|
+
const BROWSER_VIRTUAL_ENTRYPOINT_PREFIX = 'browser';
|
|
15
|
+
const HTML_VIRTUAL_ENTRYPOINT_PREFIX = 'html';
|
|
16
|
+
const VIRTUAL_ID_PREFIX = '\0';
|
|
17
|
+
export default function makePlugin({ sourceDirectory: directory, tsConfig, serverFilePath, clientOutputDirectory, serverOutputDirectory, htmlFileGlobs, }) {
|
|
18
|
+
// Resolved options
|
|
14
19
|
const sourceDirectory = resolve(cwd, directory);
|
|
15
|
-
const tsConfigFilePath = resolve(sourceDirectory, tsConfig);
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const serverExists = existsSync(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
const tsConfigFilePath = resolve(sourceDirectory, tsConfig ?? 'tsconfig.json');
|
|
21
|
+
const resolvedServerFilePath = resolve(sourceDirectory, serverFilePath ?? 'server.ts');
|
|
22
|
+
const resolvedServerOutputDirectory = resolve(sourceDirectory, serverOutputDirectory ?? 'dist/server');
|
|
23
|
+
const resolvedClientOutputDirectory = resolve(sourceDirectory, clientOutputDirectory ?? 'dist/client');
|
|
24
|
+
console.log(sourceDirectory, tsConfigFilePath, resolvedServerFilePath, resolvedServerOutputDirectory, resolvedClientOutputDirectory);
|
|
25
|
+
const virtualIds = new Set();
|
|
26
|
+
const dependentsMap = new Map();
|
|
27
|
+
const sourceFilePathToVirtualId = new Map();
|
|
28
|
+
let devServer;
|
|
29
|
+
let project;
|
|
30
|
+
const serverExists = existsSync(resolvedServerFilePath);
|
|
31
|
+
const plugins = [
|
|
32
|
+
tsconfigPaths({
|
|
33
|
+
projects: [join(sourceDirectory, 'tsconfig.json')],
|
|
34
|
+
}),
|
|
35
|
+
...(serverExists
|
|
36
|
+
? [
|
|
37
|
+
vavite({
|
|
38
|
+
serverEntry: resolvedServerFilePath,
|
|
39
|
+
serveClientAssetsInDev: true,
|
|
40
|
+
}),
|
|
41
|
+
]
|
|
42
|
+
: []),
|
|
43
|
+
];
|
|
44
|
+
const setupProject = () => {
|
|
45
|
+
info(`Setting up TypeScript project...`);
|
|
46
|
+
const project = setupTsProject(tsConfigFilePath);
|
|
47
|
+
info(`Setup TypeScript project.`);
|
|
48
|
+
return project;
|
|
49
|
+
};
|
|
50
|
+
const handleFileChange = async (path, event) => {
|
|
51
|
+
if (/\.tsx?$/.test(path)) {
|
|
52
|
+
switch (event) {
|
|
53
|
+
case 'create': {
|
|
54
|
+
project.addSourceFileAtPath(path);
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
case 'update': {
|
|
58
|
+
const sourceFile = project.getSourceFile(path);
|
|
59
|
+
if (sourceFile) {
|
|
60
|
+
sourceFile.refreshFromFileSystemSync();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
project.addSourceFileAtPath(path);
|
|
64
|
+
}
|
|
65
|
+
if (devServer) {
|
|
66
|
+
const dependents = dependentsMap.get(path.replace(/.ts(x)?/, '.js$1'));
|
|
67
|
+
for (const dependent of dependents ?? []) {
|
|
68
|
+
const id = sourceFilePathToVirtualId.get(dependent) ?? dependent;
|
|
69
|
+
const mod = devServer.moduleGraph.getModuleById(id);
|
|
70
|
+
if (mod) {
|
|
71
|
+
info(`reloading ${id}`);
|
|
72
|
+
await devServer.reloadModule(mod);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case 'delete': {
|
|
79
|
+
await project.getSourceFile(path)?.deleteImmediately();
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
31
82
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const virtualModulePlugin = {
|
|
86
|
+
name: PLUGIN_NAME,
|
|
87
|
+
config(config, env) {
|
|
88
|
+
// Configure Build steps when running with vavite
|
|
89
|
+
if (env.mode === 'multibuild') {
|
|
90
|
+
const clientBuild = {
|
|
91
|
+
outDir: resolvedClientOutputDirectory,
|
|
92
|
+
rollupOptions: {
|
|
93
|
+
input: buildClientInput(findHtmlFiles(sourceDirectory, htmlFileGlobs)),
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
const serverBuild = {
|
|
97
|
+
ssr: true,
|
|
98
|
+
outDir: resolvedServerOutputDirectory,
|
|
99
|
+
rollupOptions: {
|
|
100
|
+
input: resolvedServerFilePath,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
45
103
|
config.buildSteps = [
|
|
46
104
|
{
|
|
47
105
|
name: 'client',
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
outDir: 'dist/client',
|
|
51
|
-
rollupOptions: { input: resolve(sourceDirectory, 'index.html') },
|
|
52
|
-
},
|
|
53
|
-
},
|
|
106
|
+
// @ts-expect-error Unable to resolve types w/ NodeNext
|
|
107
|
+
config: { build: clientBuild, plugins: [compression()] },
|
|
54
108
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
outDir: 'dist/server',
|
|
61
|
-
rollupOptions: { input: serverFilePath },
|
|
109
|
+
...(serverExists
|
|
110
|
+
? [
|
|
111
|
+
{
|
|
112
|
+
name: 'server',
|
|
113
|
+
config: { build: serverBuild },
|
|
62
114
|
},
|
|
63
|
-
|
|
64
|
-
|
|
115
|
+
]
|
|
116
|
+
: []),
|
|
65
117
|
];
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
configureServer(server) {
|
|
122
|
+
devServer = server;
|
|
123
|
+
server.watcher.on('all', (event, path) => {
|
|
124
|
+
if (event === 'change') {
|
|
125
|
+
handleFileChange(path, 'update');
|
|
126
|
+
}
|
|
127
|
+
else if (event === 'add') {
|
|
128
|
+
handleFileChange(path, 'create');
|
|
129
|
+
}
|
|
130
|
+
else if (event === 'unlink') {
|
|
131
|
+
handleFileChange(path, 'delete');
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
async watchChange(path, { event }) {
|
|
136
|
+
handleFileChange(path, event);
|
|
137
|
+
},
|
|
138
|
+
closeBundle() {
|
|
139
|
+
if (project) {
|
|
140
|
+
const diagnostics = project.getPreEmitDiagnostics();
|
|
141
|
+
if (diagnostics.length > 0) {
|
|
142
|
+
this.error(project.formatDiagnosticsWithColorAndContext(diagnostics));
|
|
143
|
+
}
|
|
66
144
|
}
|
|
67
145
|
},
|
|
68
146
|
async resolveId(id, importer) {
|
|
69
|
-
if (id
|
|
70
|
-
|
|
147
|
+
if (id.startsWith(RUNTIME_VIRTUAL_ENTRYPOINT_PREFIX)) {
|
|
148
|
+
const virtualId = VIRTUAL_ID_PREFIX + `${importer}?modules=${parseModulesFromId(id, importer)}`;
|
|
149
|
+
virtualIds.add(virtualId);
|
|
150
|
+
return virtualId;
|
|
71
151
|
}
|
|
72
|
-
if (id
|
|
73
|
-
|
|
152
|
+
if (id.startsWith(BROWSER_VIRTUAL_ENTRYPOINT_PREFIX)) {
|
|
153
|
+
const virtualId = VIRTUAL_ID_PREFIX + `${importer}?modules=${parseModulesFromId(id, importer)}&browser`;
|
|
154
|
+
virtualIds.add(virtualId);
|
|
155
|
+
return virtualId;
|
|
74
156
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (id.startsWith('.')) {
|
|
80
|
-
const tsPath = resolve(sourceDirectory, id.replace(/.js(x)?$/, '.ts$1'));
|
|
81
|
-
if (existsSync(tsPath)) {
|
|
82
|
-
return tsPath;
|
|
83
|
-
}
|
|
84
|
-
const jsPath = resolve(sourceDirectory, id);
|
|
85
|
-
if (existsSync(jsPath)) {
|
|
86
|
-
return tsPath;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
157
|
+
if (id.startsWith(HTML_VIRTUAL_ENTRYPOINT_PREFIX)) {
|
|
158
|
+
const virtualId = VIRTUAL_ID_PREFIX + `${importer}?source=${parseModulesFromId(id, importer)}`;
|
|
159
|
+
virtualIds.add(virtualId);
|
|
160
|
+
return virtualId;
|
|
89
161
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
162
|
+
// Virtual modules have problems with resolving relative paths due to not
|
|
163
|
+
// having a real directory to work with thus the need to resolve them manually.
|
|
164
|
+
if (importer?.startsWith(VIRTUAL_ID_PREFIX) && id.startsWith('.')) {
|
|
165
|
+
return findRelativeFile(importer, id);
|
|
94
166
|
}
|
|
95
|
-
|
|
96
|
-
|
|
167
|
+
},
|
|
168
|
+
async load(id) {
|
|
169
|
+
if (virtualIds.has(id)) {
|
|
170
|
+
// Setup the TypeScript project if it hasn't been already
|
|
171
|
+
if (!project) {
|
|
172
|
+
project = setupProject();
|
|
173
|
+
}
|
|
174
|
+
// Build our virtual module as a SourceFile
|
|
175
|
+
const sourceFile = await buildVirtualModule(project, id, sourceDirectory, resolvedServerOutputDirectory, resolvedClientOutputDirectory, devServer);
|
|
176
|
+
const filePath = sourceFile.getFilePath();
|
|
177
|
+
sourceFilePathToVirtualId.set(filePath, id);
|
|
178
|
+
// If we're in a development evnironment, we need to track the dependencies of
|
|
179
|
+
// our virtual module so we can reload them when they change.
|
|
180
|
+
if (devServer) {
|
|
181
|
+
const importModuleSpecifiers = await Promise.all(sourceFile.getLiteralsReferencingOtherSourceFiles().map((l) => l.getLiteralText()));
|
|
182
|
+
for (const specifier of importModuleSpecifiers) {
|
|
183
|
+
let resolved =
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
185
|
+
(await virtualModulePlugin.resolveId.apply(this, [specifier, filePath])) || specifier;
|
|
186
|
+
if (resolved.startsWith('.')) {
|
|
187
|
+
resolved = resolve(dirname(filePath), resolved);
|
|
188
|
+
}
|
|
189
|
+
const current = dependentsMap.get(resolved) ?? new Set();
|
|
190
|
+
current.add(filePath);
|
|
191
|
+
dependentsMap.set(resolved, current);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const diagnostics = sourceFile.getPreEmitDiagnostics();
|
|
195
|
+
const relativeFilePath = relative(sourceDirectory, filePath);
|
|
196
|
+
if (diagnostics.length > 0) {
|
|
197
|
+
info(project.formatDiagnosticsWithColorAndContext(diagnostics));
|
|
198
|
+
info(sourceFile.getFullText());
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
info(`${relativeFilePath} virtual module successfuly typed-checked.`);
|
|
202
|
+
}
|
|
203
|
+
const output = ts.transpileModule(sourceFile.getFullText(), {
|
|
204
|
+
compilerOptions: project.getCompilerOptions(),
|
|
205
|
+
});
|
|
206
|
+
return {
|
|
207
|
+
code: output.outputText,
|
|
208
|
+
map: output.sourceMapText,
|
|
209
|
+
moduleSideEffects: false,
|
|
210
|
+
};
|
|
97
211
|
}
|
|
98
212
|
},
|
|
99
213
|
};
|
|
214
|
+
plugins.push(virtualModulePlugin);
|
|
215
|
+
return plugins;
|
|
100
216
|
}
|
|
101
|
-
function
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
217
|
+
async function buildVirtualModule(project, id, sourceDirectory, serverOutputDirectory, clientOutputDirectory, devServer) {
|
|
218
|
+
// Parse our virtual ID into the original importer and whatever query was passed to it
|
|
219
|
+
const [importer, query] = id.split(VIRTUAL_ID_PREFIX)[1].split('?');
|
|
220
|
+
// If the query is for a runtime module, read the directory and transform it into a module.
|
|
221
|
+
if (query.includes('modules=')) {
|
|
222
|
+
const moduleDirectory = resolve(dirname(importer), query.split('modules=')[1].split('&')[0]);
|
|
223
|
+
const relativeDirectory = relative(sourceDirectory, moduleDirectory);
|
|
224
|
+
const directory = await readDirectory(moduleDirectory);
|
|
225
|
+
const moduleTree = readModules(project, directory);
|
|
226
|
+
const isBrowser = query.includes('&browser');
|
|
227
|
+
info(`Building ${isBrowser ? 'browser' : 'runtime'} module for ${relativeDirectory}...`);
|
|
228
|
+
const mod = isBrowser
|
|
229
|
+
? makeBrowserModule(project, moduleTree, importer)
|
|
230
|
+
: makeRuntimeModule(project, moduleTree, importer);
|
|
231
|
+
info(`Built ${isBrowser ? 'browser' : 'runtime'} module for ${relativeDirectory}.`);
|
|
232
|
+
return mod;
|
|
233
|
+
}
|
|
234
|
+
// If the query is for an HTML file, read the file and transform it into a module.
|
|
235
|
+
const htmlFile = query.split('source=')[1];
|
|
236
|
+
const htmlFilePath = resolve(dirname(importer), htmlFile + '.html');
|
|
237
|
+
const relativeHtmlFilePath = relative(sourceDirectory, htmlFilePath);
|
|
238
|
+
let html = '';
|
|
239
|
+
info(`Building html module for ${relativeHtmlFilePath}...`);
|
|
240
|
+
// If there's a dev server, use it to transform the HTML for development
|
|
241
|
+
if (devServer) {
|
|
242
|
+
html = (await readFile(htmlFilePath, 'utf-8')).toString();
|
|
243
|
+
html = await devServer.transformIndexHtml(getRelativePath(sourceDirectory, htmlFilePath), html);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
// Otherwise, read the already transformed file from the output directory.
|
|
247
|
+
html = (await readFile(resolve(clientOutputDirectory, relative(sourceDirectory, htmlFilePath)), 'utf-8')).toString();
|
|
248
|
+
}
|
|
249
|
+
const module = await makeHtmlModule({
|
|
250
|
+
project,
|
|
251
|
+
filePath: htmlFilePath,
|
|
252
|
+
html,
|
|
253
|
+
importer,
|
|
254
|
+
serverOutputDirectory,
|
|
255
|
+
clientOutputDirectory,
|
|
256
|
+
devServer,
|
|
108
257
|
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
258
|
+
info(`Built html module for ${relativeHtmlFilePath}.`);
|
|
259
|
+
return module;
|
|
260
|
+
}
|
|
261
|
+
function findRelativeFile(importer, id) {
|
|
262
|
+
const dir = getVirtualSourceDirectory(importer);
|
|
263
|
+
const tsPath = resolve(dir, id.replace(/.js(x)?$/, '.ts$1'));
|
|
264
|
+
if (existsSync(tsPath)) {
|
|
265
|
+
return tsPath;
|
|
266
|
+
}
|
|
267
|
+
const jsPath = resolve(dir, id);
|
|
268
|
+
if (existsSync(jsPath)) {
|
|
269
|
+
return tsPath;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function getVirtualSourceDirectory(id) {
|
|
273
|
+
return dirname(id.split(VIRTUAL_ID_PREFIX)[1].split('?')[0]);
|
|
274
|
+
}
|
|
275
|
+
function parseModulesFromId(id, importer) {
|
|
276
|
+
const pages = id
|
|
277
|
+
.replace(RUNTIME_VIRTUAL_ENTRYPOINT_PREFIX + ':', '')
|
|
278
|
+
.replace(BROWSER_VIRTUAL_ENTRYPOINT_PREFIX + ':', '')
|
|
279
|
+
.replace(HTML_VIRTUAL_ENTRYPOINT_PREFIX + ':', '');
|
|
280
|
+
if (pages === '') {
|
|
281
|
+
throw new Error(`[${PLUGIN_NAME}]: No pages were specified from ${importer}`);
|
|
282
|
+
}
|
|
283
|
+
return pages;
|
|
284
|
+
}
|
|
285
|
+
function findHtmlFiles(directory, htmlFileGlobs) {
|
|
286
|
+
if (htmlFileGlobs) {
|
|
287
|
+
// eslint-disable-next-line import/no-named-as-default-member
|
|
288
|
+
return glob.sync([...htmlFileGlobs], { cwd: directory });
|
|
289
|
+
}
|
|
290
|
+
// eslint-disable-next-line import/no-named-as-default-member
|
|
291
|
+
return glob.sync(['**/*.html', '!' + '**/node_modules/**', '!' + '**/dist/**'], {
|
|
292
|
+
cwd: directory,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function buildClientInput(htmlFilePaths) {
|
|
296
|
+
const input = {};
|
|
297
|
+
for (const htmlFilePath of htmlFilePaths) {
|
|
298
|
+
const htmlFile = basename(htmlFilePath, '.html');
|
|
299
|
+
input[htmlFile] = htmlFilePath;
|
|
300
|
+
}
|
|
301
|
+
return input;
|
|
302
|
+
}
|
|
303
|
+
function getRelativePath(from, to) {
|
|
304
|
+
const path = relative(from, to);
|
|
305
|
+
if (!path.startsWith('.')) {
|
|
306
|
+
return './' + path;
|
|
307
|
+
}
|
|
308
|
+
return path;
|
|
309
|
+
}
|
|
310
|
+
function info(message) {
|
|
311
|
+
const date = new Date();
|
|
312
|
+
console.info(`[${PLUGIN_NAME}] ${date.toISOString()};`, `${message}`);
|
|
113
313
|
}
|
|
114
314
|
//# sourceMappingURL=vite-plugin.js.map
|
package/dist/vite-plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin.js","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEpC,4CAA4C;AAE5C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAElF,OAAO,EAAW,EAAE,EAAE,MAAM,UAAU,CAAA;AACtC,0EAA0E;AAC1E,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE1C,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAiB/C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;AAEzB,MAAM,WAAW,GAAG,oBAAoB,CAAA;AACxC,MAAM,0BAA0B,GAAG,uBAAuB,CAAA;AAC1D,MAAM,yBAAyB,GAAG,sBAAsB,CAAA;AAExD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAiB;IAC9E,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;IAC/C,MAAM,gBAAgB,GAAG,OAAO,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAA;IAE3D,OAAO,CAAC,IAAI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C,CAAC,GAAG,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAA;KACzD;IAED,6DAA6D;IAC7D,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,oBAAoB,EAAE,GAAG,GAAG,YAAY,CAAC,EAAE;QAC9E,GAAG,EAAE,SAAS;KACf,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,aAAgC;IACxD,MAAM,KAAK,GAA2B,EAAE,CAAA;IAExC,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;QACxC,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;QAEhD,KAAK,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAA;KAC/B;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,eAAe,CAAC,IAAY,EAAE,EAAU;IAC/C,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IAE/B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACzB,OAAO,IAAI,GAAG,IAAI,CAAA;KACnB;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,IAAI,CAAC,OAAe;IAC3B,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;IAEvB,OAAO,CAAC,IAAI,CAAC,IAAI,WAAW,KAAK,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC,CAAA;AACvE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typed/vite-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -21,16 +21,17 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@typed/compiler": "0.0.
|
|
25
|
-
"
|
|
26
|
-
"vavite": "^1.5.2"
|
|
24
|
+
"@typed/compiler": "0.0.9",
|
|
25
|
+
"fast-glob": "^3.2.12",
|
|
26
|
+
"vavite": "^1.5.2",
|
|
27
|
+
"vite-plugin-compression": "^0.5.1",
|
|
28
|
+
"vite-tsconfig-paths": "^4.0.3"
|
|
27
29
|
},
|
|
28
30
|
"devDependencies": {
|
|
29
31
|
"ts-morph": "^17.0.1",
|
|
30
|
-
"vite": "^4.0.4"
|
|
31
|
-
"vite-tsconfig-paths": "^4.0.3"
|
|
32
|
+
"vite": "^4.0.4"
|
|
32
33
|
},
|
|
33
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "56bedc36b94c3875141cd9fae20f165bcc2454a6",
|
|
34
35
|
"publishConfig": {
|
|
35
36
|
"access": "public"
|
|
36
37
|
}
|
package/src/index.ts
CHANGED