@jay-framework/vite-plugin 0.5.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.
@@ -0,0 +1,7 @@
1
+ import { JayRollupConfig } from '@jay-framework/rollup-plugin';
2
+ export { JayRollupConfig } from '@jay-framework/rollup-plugin';
3
+ import { Plugin } from 'vite';
4
+
5
+ declare function jayRuntime(jayOptions?: JayRollupConfig): Plugin;
6
+
7
+ export { jayRuntime };
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const rollupPlugin = require("@jay-framework/rollup-plugin");
4
+ function jayRuntime(jayOptions = {}) {
5
+ const jayContext = new rollupPlugin.JayPluginContext(jayOptions);
6
+ return {
7
+ enforce: "pre",
8
+ ...rollupPlugin.jayRuntime(jayOptions, jayContext)
9
+ };
10
+ }
11
+ exports.jayRuntime = jayRuntime;
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@jay-framework/vite-plugin",
3
+ "version": "0.5.0",
4
+ "license": "Apache-2.0",
5
+ "main": "dist/index.js",
6
+ "keywords": [
7
+ "jay",
8
+ "secure",
9
+ "vite-plugin"
10
+ ],
11
+ "files": [
12
+ "dist",
13
+ "readme.md"
14
+ ],
15
+ "scripts": {
16
+ "build": "npm run build:js && npm run build:types",
17
+ "build:watch": "npm run build:js -- --watch & npm run build:types -- --watch",
18
+ "build:js": "vite build",
19
+ "build:types": "tsup lib/index.ts --dts-only --format cjs",
20
+ "build:check-types": "tsc",
21
+ "clean": "rimraf dist",
22
+ "confirm": "npm run clean && npm run build && npm run build:check-types && npm run test",
23
+ "test": ":",
24
+ "test:watch": ":"
25
+ },
26
+ "dependencies": {
27
+ "@jay-framework/rollup-plugin": "workspace:^"
28
+ },
29
+ "devDependencies": {
30
+ "@jay-framework/component": "workspace:^",
31
+ "@jay-framework/dev-environment": "workspace:^",
32
+ "@jay-framework/runtime": "workspace:^",
33
+ "@jay-framework/secure": "workspace:^",
34
+ "@types/node": "^20.11.5",
35
+ "tsup": "^8.0.1",
36
+ "typescript": "^5.3.3",
37
+ "vite": "^5.0.11",
38
+ "vitest": "^1.2.1"
39
+ }
40
+ }
package/readme.md ADDED
@@ -0,0 +1,62 @@
1
+ # Jay Vite Plugin
2
+
3
+ The plugin transform `.jay-html` files and jay component files as part of a vite build.
4
+
5
+ The plugin is a regular vite plugin setup in the `vite.config.ts` file.
6
+
7
+ An example config
8
+
9
+ ```typescript
10
+ import { resolve } from 'path';
11
+ import Inspect from 'vite-plugin-inspect';
12
+ import { defineConfig } from 'vitest/config';
13
+ import { JayRollupConfig, jayRuntime } from '@jay-framework/vite-plugin';
14
+ import { rimrafSync } from 'rimraf';
15
+
16
+ const root = resolve(__dirname);
17
+ const jayOptions: JayRollupConfig = {
18
+ tsConfigFilePath: resolve(root, 'tsconfig.json'),
19
+ outputDir: 'build/@jay-framework/runtime',
20
+ };
21
+
22
+ export default defineConfig(({ mode }) => {
23
+ const external =
24
+ mode === 'production'
25
+ ? []
26
+ : [
27
+ '@jay-framework/component',
28
+ '@jay-framework/reactive',
29
+ '@jay-framework/runtime',
30
+ '@jay-framework/secure',
31
+ ];
32
+ rimrafSync(resolve(root, 'build'));
33
+
34
+ return {
35
+ plugins: [Inspect(), jayRuntime(jayOptions)],
36
+ worker: {
37
+ plugins: () => [jayRuntime(jayOptions)],
38
+ },
39
+ root,
40
+ optimizeDeps: { entries: [] },
41
+ build: {
42
+ emptyOutDir: true,
43
+ minify: false,
44
+ target: 'es2020',
45
+ rollupOptions: { external },
46
+ },
47
+ };
48
+ });
49
+ ```
50
+
51
+ See full example at [counter](../../../examples/jay/counter)
52
+
53
+ ## configuration:
54
+
55
+ The plugin configuration `JayRollupConfig` includes
56
+
57
+ - `tsConfigFilePath?: string` - optional - path for the tsconfig file to use for building jay files.
58
+ - `tsCompilerOptionsOverrides?: CompilerOptions` - optional - path for compiler options used for building jay files
59
+ - `outputDir?: string` - optional - output dir to write individual transformed / generated files into.
60
+ - `isWorker?: boolean` - not need for vite (required when using rollup directly without vite)
61
+ - `compilerPatternFiles?: string[]` - compiler pattern files used for secure file splitting.
62
+ See more info at [secure](..%2F..%2Fruntime%2Fsecure)