element-vir 4.0.1 → 4.0.2
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/package.json +1 -1
- package/dist/jest/jest.config.d.ts +0 -3
- package/dist/jest/jest.config.js +0 -28
- package/dist/jest/jest.setup.d.ts +0 -1
- package/dist/jest/jest.setup.js +0 -9
- package/dist/jest/read-tsconfig.d.ts +0 -2
- package/dist/jest/read-tsconfig.js +0 -20
- package/dist/vite/always-reload-plugin.d.ts +0 -11
- package/dist/vite/always-reload-plugin.js +0 -77
- package/dist/vite/vite.config.d.ts +0 -6
- package/dist/vite/vite.config.js +0 -8
package/package.json
CHANGED
package/dist/jest/jest.config.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { dirname, join } from 'path';
|
|
2
|
-
import { pathsToModuleNameMapper } from 'ts-jest';
|
|
3
|
-
import { findTsConfigFile, getTsconfigPathAliases } from './read-tsconfig';
|
|
4
|
-
const repoRootDir = dirname(dirname(__dirname));
|
|
5
|
-
const config = {
|
|
6
|
-
preset: 'ts-jest',
|
|
7
|
-
testEnvironment: 'jsdom',
|
|
8
|
-
verbose: false,
|
|
9
|
-
// type tests are caught by the typescript compiler
|
|
10
|
-
testPathIgnorePatterns: ['.type.test.ts'],
|
|
11
|
-
rootDir: repoRootDir,
|
|
12
|
-
silent: false,
|
|
13
|
-
moduleNameMapper: pathsToModuleNameMapper(getTsconfigPathAliases(), {
|
|
14
|
-
prefix: '<rootDir>/',
|
|
15
|
-
}),
|
|
16
|
-
roots: [join(repoRootDir, 'src')],
|
|
17
|
-
setupFilesAfterEnv: [join(__dirname, 'jest.setup.ts')],
|
|
18
|
-
globals: {
|
|
19
|
-
'ts-jest': {
|
|
20
|
-
tsconfig: findTsConfigFile(),
|
|
21
|
-
diagnostics: {
|
|
22
|
-
warnOnly: true,
|
|
23
|
-
ignoreCodes: ['TS151001'],
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
export default config;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/jest/jest.setup.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CustomConsole } from '@jest/console';
|
|
2
|
-
function simpleFormatter(type, message) {
|
|
3
|
-
const consoleIndent = ' ';
|
|
4
|
-
return message
|
|
5
|
-
.split(/\n/)
|
|
6
|
-
.map((line) => consoleIndent + line)
|
|
7
|
-
.join('\n');
|
|
8
|
-
}
|
|
9
|
-
global.console = new CustomConsole(process.stdout, process.stderr, simpleFormatter);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { dirname } from 'path';
|
|
2
|
-
import { findConfigFile, parseJsonConfigFileContent, readConfigFile, sys as tsSys } from 'typescript';
|
|
3
|
-
export function findTsConfigFile() {
|
|
4
|
-
const dirToCheck = __dirname;
|
|
5
|
-
const configFileName = findConfigFile(dirToCheck, tsSys.fileExists, 'tsconfig.json');
|
|
6
|
-
if (!configFileName) {
|
|
7
|
-
throw new Error(`Could not find tsconfig.json file from starting search at "${dirToCheck}"`);
|
|
8
|
-
}
|
|
9
|
-
return configFileName;
|
|
10
|
-
}
|
|
11
|
-
export function getTsconfigPathAliases() {
|
|
12
|
-
const configFileName = findTsConfigFile();
|
|
13
|
-
if (!configFileName) {
|
|
14
|
-
throw new Error(`Failed to find tsconfig.`);
|
|
15
|
-
}
|
|
16
|
-
const configFile = readConfigFile(configFileName, tsSys.readFile);
|
|
17
|
-
const tsConfig = parseJsonConfigFileContent(configFile.config, tsSys, dirname(configFileName));
|
|
18
|
-
const tsConfigPaths = tsConfig.options.paths || {};
|
|
19
|
-
return tsConfigPaths;
|
|
20
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PluginOption } from 'vite';
|
|
2
|
-
/**
|
|
3
|
-
* There are similar plugins out there that try to do this but they aren't aggressive enough. This
|
|
4
|
-
* plugin literally always reloads on save, no questions asked.
|
|
5
|
-
*/
|
|
6
|
-
export declare function alwaysReloadPlugin(config?: Partial<{
|
|
7
|
-
exclusions: string[];
|
|
8
|
-
/** Inclusions apply after exclusions so they will override exclusions. */
|
|
9
|
-
inclusions: string[];
|
|
10
|
-
root: string;
|
|
11
|
-
}>): PluginOption;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { existsSync, lstatSync, readlinkSync } from 'fs';
|
|
3
|
-
import { relative } from 'path';
|
|
4
|
-
/**
|
|
5
|
-
* Include actual paths and symlinked target paths if they exist.
|
|
6
|
-
*
|
|
7
|
-
* This is needed because when removing files from the watcher, sym links have be removed with the
|
|
8
|
-
* path to the symlink itself AND the path to the symlink target or the path will still be watched.
|
|
9
|
-
*/
|
|
10
|
-
function mapToActualPaths(paths) {
|
|
11
|
-
return paths.reduce((accum, path) => {
|
|
12
|
-
if (existsSync(path)) {
|
|
13
|
-
if (lstatSync(path).isSymbolicLink()) {
|
|
14
|
-
console.info('reading symlink from', path);
|
|
15
|
-
// sym links AND the original path both need to be included
|
|
16
|
-
return accum.concat(readlinkSync(path), path);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return accum.concat(path);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return accum;
|
|
24
|
-
}
|
|
25
|
-
}, []);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* There are similar plugins out there that try to do this but they aren't aggressive enough. This
|
|
29
|
-
* plugin literally always reloads on save, no questions asked.
|
|
30
|
-
*/
|
|
31
|
-
export function alwaysReloadPlugin(config = {}) {
|
|
32
|
-
return {
|
|
33
|
-
name: 'alwaysReloadPlugin',
|
|
34
|
-
apply: 'serve',
|
|
35
|
-
config: () => ({ server: { watch: { disableGlobbing: false } } }),
|
|
36
|
-
configureServer({ watcher, ws, config: { logger } }) {
|
|
37
|
-
const { root = process.cwd(), inclusions = [], exclusions = [] } = config;
|
|
38
|
-
let callingAlready = false;
|
|
39
|
-
let loggedAlready = false;
|
|
40
|
-
const reloadCallback = (path) => {
|
|
41
|
-
if (!loggedAlready) {
|
|
42
|
-
loggedAlready = true;
|
|
43
|
-
// log watched stuff so that we can make sure it's not watching too much
|
|
44
|
-
// console.info({watched: watcher.getWatched()});
|
|
45
|
-
}
|
|
46
|
-
// prevent duplicate calls cause the watcher is very eager to call callbacks multiple times in a row
|
|
47
|
-
if (!callingAlready) {
|
|
48
|
-
callingAlready = true;
|
|
49
|
-
ws.send({
|
|
50
|
-
type: 'full-reload',
|
|
51
|
-
path: '*',
|
|
52
|
-
});
|
|
53
|
-
logger.info(`${chalk.green('page reload')} ${chalk.dim(relative(root, path))}`, { clear: true, timestamp: true });
|
|
54
|
-
/**
|
|
55
|
-
* Debounce reloads calls so that they don't get spammed. If you're saving
|
|
56
|
-
* faster than this, then what the heck are you doing anyway?
|
|
57
|
-
*/
|
|
58
|
-
setTimeout(() => {
|
|
59
|
-
callingAlready = false;
|
|
60
|
-
}, 100);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
if (exclusions.length) {
|
|
64
|
-
watcher.unwatch(mapToActualPaths(exclusions));
|
|
65
|
-
// ignore macOS file system metadata stuff
|
|
66
|
-
watcher.unwatch('./**/.DS_Store');
|
|
67
|
-
}
|
|
68
|
-
if (inclusions.length) {
|
|
69
|
-
watcher.add(inclusions);
|
|
70
|
-
}
|
|
71
|
-
if (!watcher.listeners('change').includes(reloadCallback)) {
|
|
72
|
-
watcher.on('change', reloadCallback);
|
|
73
|
-
watcher.on('add', reloadCallback);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
package/dist/vite/vite.config.js
DELETED