@analogjs/vite-plugin-angular 1.7.0-beta.7 → 1.7.0-beta.9
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/README.md +65 -1
- package/package.json +1 -1
- package/src/lib/angular-jit-plugin.js +5 -18
- package/src/lib/angular-jit-plugin.js.map +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,29 @@ A Vite plugin for building Angular applications
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
With npm:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @analogjs/vite-plugin-angular --save-dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
With pnpm:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
pnpm install @analogjs/vite-plugin-angular --save-dev
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
With yarn:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
yarn install @analogjs/vite-plugin-angular --dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
With bun:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
bun install @analogjs/vite-plugin-angular --dev
|
|
29
|
+
```
|
|
8
30
|
|
|
9
31
|
## Setup
|
|
10
32
|
|
|
@@ -23,3 +45,45 @@ export default defineConfig({
|
|
|
23
45
|
plugins: [angular()],
|
|
24
46
|
});
|
|
25
47
|
```
|
|
48
|
+
|
|
49
|
+
## Setting up the TypeScript config
|
|
50
|
+
|
|
51
|
+
The integration needs a `tsconfig.app.json` at the root of the project for compilation.
|
|
52
|
+
|
|
53
|
+
Create a `tsconfig.app.json` in the root of the project.
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"extends": "./tsconfig.json",
|
|
58
|
+
"compileOnSave": false,
|
|
59
|
+
"compilerOptions": {
|
|
60
|
+
"baseUrl": "./",
|
|
61
|
+
"outDir": "./dist/out-tsc",
|
|
62
|
+
"forceConsistentCasingInFileNames": true,
|
|
63
|
+
"strict": true,
|
|
64
|
+
"noImplicitOverride": true,
|
|
65
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
66
|
+
"noImplicitReturns": true,
|
|
67
|
+
"noFallthroughCasesInSwitch": true,
|
|
68
|
+
"sourceMap": true,
|
|
69
|
+
"declaration": false,
|
|
70
|
+
"downlevelIteration": true,
|
|
71
|
+
"experimentalDecorators": true,
|
|
72
|
+
"moduleResolution": "node",
|
|
73
|
+
"importHelpers": true,
|
|
74
|
+
"noEmit": false,
|
|
75
|
+
"target": "es2020",
|
|
76
|
+
"module": "es2020",
|
|
77
|
+
"lib": ["es2020", "dom"],
|
|
78
|
+
"skipLibCheck": true
|
|
79
|
+
},
|
|
80
|
+
"angularCompilerOptions": {
|
|
81
|
+
"enableI18nLegacyMessageIdFormat": false,
|
|
82
|
+
"strictInjectionParameters": true,
|
|
83
|
+
"strictInputAccessModifiers": true,
|
|
84
|
+
"strictTemplates": true
|
|
85
|
+
},
|
|
86
|
+
"files": [],
|
|
87
|
+
"include": ["src/**/*.ts"]
|
|
88
|
+
}
|
|
89
|
+
```
|
package/package.json
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
+
import { preprocessCSS } from 'vite';
|
|
1
2
|
export function jitPlugin({ inlineStylesExtension, }) {
|
|
2
|
-
let
|
|
3
|
-
let watchMode = false;
|
|
4
|
-
let viteServer;
|
|
5
|
-
let cssPlugin;
|
|
3
|
+
let config;
|
|
6
4
|
return {
|
|
7
5
|
name: '@analogjs/vite-plugin-angular-jit',
|
|
8
|
-
config(_config
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
buildStart({ plugins }) {
|
|
12
|
-
if (Array.isArray(plugins)) {
|
|
13
|
-
cssPlugin = plugins.find((plugin) => plugin.name === 'vite:css');
|
|
14
|
-
}
|
|
15
|
-
styleTransform = watchMode
|
|
16
|
-
? viteServer.pluginContainer.transform
|
|
17
|
-
: cssPlugin.transform;
|
|
18
|
-
},
|
|
19
|
-
configureServer(server) {
|
|
20
|
-
viteServer = server;
|
|
6
|
+
config(_config) {
|
|
7
|
+
config = _config;
|
|
21
8
|
},
|
|
22
9
|
resolveId(id) {
|
|
23
10
|
if (id.startsWith('virtual:angular')) {
|
|
@@ -31,7 +18,7 @@ export function jitPlugin({ inlineStylesExtension, }) {
|
|
|
31
18
|
const decodedStyles = Buffer.from(decodeURIComponent(styleId), 'base64').toString();
|
|
32
19
|
let styles = '';
|
|
33
20
|
try {
|
|
34
|
-
const compiled = await
|
|
21
|
+
const compiled = await preprocessCSS(decodedStyles, `${styleId}.${inlineStylesExtension}?direct`, config);
|
|
35
22
|
styles = compiled?.code;
|
|
36
23
|
}
|
|
37
24
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-jit-plugin.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-angular/src/lib/angular-jit-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"angular-jit-plugin.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-angular/src/lib/angular-jit-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAE,MAAM,MAAM,CAAC;AAE7C,MAAM,UAAU,SAAS,CAAC,EACxB,qBAAqB,GAGtB;IACC,IAAI,MAAW,CAAC;IAEhB,OAAO;QACL,IAAI,EAAE,mCAAmC;QACzC,MAAM,CAAC,OAAO;YACZ,MAAM,GAAG,OAAO,CAAC;QACnB,CAAC;QACD,SAAS,CAAC,EAAU;YAClB,IAAI,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBACrC,OAAO,KAAK,EAAE,EAAE,CAAC;YACnB,CAAC;YAED,OAAO;QACT,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAU;YACnB,IAAI,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC,EAAE,CAAC;gBACrD,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;gBAE7C,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAC/B,kBAAkB,CAAC,OAAO,CAAC,EAC3B,QAAQ,CACT,CAAC,QAAQ,EAAE,CAAC;gBAEb,IAAI,MAAM,GAAuB,EAAE,CAAC;gBAEpC,IAAI,CAAC;oBACH,MAAM,QAAQ,GAAG,MAAM,aAAa,CAClC,aAAa,EACb,GAAG,OAAO,IAAI,qBAAqB,SAAS,EAC5C,MAAM,CACP,CAAC;oBACF,MAAM,GAAG,QAAQ,EAAE,IAAI,CAAC;gBAC1B,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACxB,CAAC;gBAED,OAAO,oBAAoB,MAAM,IAAI,CAAC;YACxC,CAAC;YAED,OAAO;QACT,CAAC;KACF,CAAC;AACJ,CAAC"}
|