astro 1.1.7 → 1.2.1

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.
Files changed (38) hide show
  1. package/dist/@types/astro.d.ts +4 -2
  2. package/dist/cli/index.js +56 -23
  3. package/dist/core/add/index.js +73 -69
  4. package/dist/core/build/generate.js +3 -1
  5. package/dist/core/build/vite-plugin-analyzer.js +7 -1
  6. package/dist/{vite-plugin-astro → core/compile}/compile.d.ts +3 -8
  7. package/dist/{vite-plugin-astro → core/compile}/compile.js +23 -56
  8. package/dist/core/compile/index.d.ts +3 -0
  9. package/dist/core/compile/index.js +7 -0
  10. package/dist/core/compile/style.d.ts +5 -0
  11. package/dist/core/compile/style.js +31 -0
  12. package/dist/core/compile/types.d.ts +7 -0
  13. package/dist/core/compile/types.js +0 -0
  14. package/dist/core/config.d.ts +6 -2
  15. package/dist/core/config.js +58 -37
  16. package/dist/core/dev/index.d.ts +1 -0
  17. package/dist/core/dev/index.js +4 -2
  18. package/dist/core/endpoint/dev/index.d.ts +2 -0
  19. package/dist/core/endpoint/index.d.ts +2 -0
  20. package/dist/core/endpoint/index.js +2 -1
  21. package/dist/core/messages.d.ts +2 -1
  22. package/dist/core/messages.js +5 -4
  23. package/dist/core/util.d.ts +13 -0
  24. package/dist/core/util.js +10 -2
  25. package/dist/runtime/server/astro-global.js +1 -1
  26. package/dist/runtime/server/render/page.js +1 -1
  27. package/dist/runtime/server/serialize.js +24 -14
  28. package/dist/vite-plugin-astro/hmr.d.ts +1 -1
  29. package/dist/vite-plugin-astro/hmr.js +3 -1
  30. package/dist/vite-plugin-astro/index.js +18 -26
  31. package/dist/vite-plugin-markdown-legacy/index.js +16 -10
  32. package/dist/vite-style-transform/index.d.ts +2 -0
  33. package/dist/vite-style-transform/index.js +5 -0
  34. package/dist/vite-style-transform/style-transform.d.ts +10 -0
  35. package/dist/vite-style-transform/style-transform.js +36 -0
  36. package/dist/{vite-plugin-astro/styles.d.ts → vite-style-transform/transform-with-vite.d.ts} +0 -0
  37. package/dist/{vite-plugin-astro/styles.js → vite-style-transform/transform-with-vite.js} +0 -0
  38. package/package.json +8 -7
@@ -0,0 +1,36 @@
1
+ import { fileURLToPath } from "url";
2
+ import { createTransformStyleWithViteFn } from "./transform-with-vite.js";
3
+ function createViteStyleTransformer(viteConfig) {
4
+ return {
5
+ transformStyleWithVite: createTransformStyleWithViteFn(viteConfig)
6
+ };
7
+ }
8
+ function getNormalizedIDForPostCSS(filename) {
9
+ try {
10
+ const filenameURL = new URL(`file://${filename}`);
11
+ return fileURLToPath(filenameURL);
12
+ } catch (err) {
13
+ return filename;
14
+ }
15
+ }
16
+ function createTransformStyles(viteStyleTransformer, filename, ssr, pluginContext) {
17
+ if (!pluginContext.addWatchFile) {
18
+ pluginContext.addWatchFile = () => {
19
+ };
20
+ }
21
+ const normalizedID = getNormalizedIDForPostCSS(filename);
22
+ return async function(styleSource, lang) {
23
+ const result = await viteStyleTransformer.transformStyleWithVite.call(pluginContext, {
24
+ id: normalizedID,
25
+ source: styleSource,
26
+ lang,
27
+ ssr,
28
+ viteDevServer: viteStyleTransformer.viteDevServer
29
+ });
30
+ return result;
31
+ };
32
+ }
33
+ export {
34
+ createTransformStyles,
35
+ createViteStyleTransformer
36
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "1.1.7",
3
+ "version": "1.2.1",
4
4
  "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
5
5
  "type": "module",
6
6
  "author": "withastro",
@@ -82,7 +82,7 @@
82
82
  "vendor"
83
83
  ],
84
84
  "dependencies": {
85
- "@astrojs/compiler": "^0.23.5",
85
+ "@astrojs/compiler": "^0.24.0",
86
86
  "@astrojs/language-server": "^0.23.0",
87
87
  "@astrojs/markdown-remark": "^1.1.1",
88
88
  "@astrojs/telemetry": "^1.0.0",
@@ -93,8 +93,11 @@
93
93
  "@babel/plugin-transform-react-jsx": "^7.17.12",
94
94
  "@babel/traverse": "^7.18.2",
95
95
  "@babel/types": "^7.18.4",
96
- "@proload/core": "^0.3.2",
96
+ "@proload/core": "^0.3.3",
97
97
  "@proload/plugin-tsm": "^0.2.1",
98
+ "@types/babel__core": "^7.1.19",
99
+ "@types/html-escaper": "^3.0.0",
100
+ "@types/yargs-parser": "^21.0.0",
98
101
  "boxen": "^6.2.1",
99
102
  "ci-info": "^3.3.1",
100
103
  "common-ancestor-path": "^1.0.1",
@@ -139,7 +142,6 @@
139
142
  },
140
143
  "devDependencies": {
141
144
  "@playwright/test": "^1.22.2",
142
- "@types/babel__core": "^7.1.19",
143
145
  "@types/babel__generator": "^7.6.4",
144
146
  "@types/babel__traverse": "^7.17.1",
145
147
  "@types/chai": "^4.3.1",
@@ -148,7 +150,6 @@
148
150
  "@types/debug": "^4.1.7",
149
151
  "@types/diff": "^5.0.2",
150
152
  "@types/estree": "^0.0.51",
151
- "@types/html-escaper": "^3.0.0",
152
153
  "@types/mime": "^2.0.3",
153
154
  "@types/mocha": "^9.1.1",
154
155
  "@types/parse5": "^6.0.3",
@@ -158,7 +159,6 @@
158
159
  "@types/rimraf": "^3.0.2",
159
160
  "@types/send": "^0.17.1",
160
161
  "@types/unist": "^2.0.6",
161
- "@types/yargs-parser": "^21.0.0",
162
162
  "ast-types": "^0.14.2",
163
163
  "astro-scripts": "0.0.7",
164
164
  "chai": "^4.3.6",
@@ -178,7 +178,8 @@
178
178
  "dev": "astro-scripts dev --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.ts\"",
179
179
  "postbuild": "astro-scripts copy \"src/**/*.astro\"",
180
180
  "benchmark": "node test/benchmark/dev.bench.js && node test/benchmark/build.bench.js",
181
- "test": "mocha --exit --timeout 20000 --ignore **/lit-element.test.js && mocha --timeout 20000 **/lit-element.test.js",
181
+ "test:unit": "mocha --exit --timeout 2000 ./test/units/**/*.test.js",
182
+ "test": "pnpm run test:unit && mocha --exit --timeout 20000 --ignore **/lit-element.test.js && mocha --timeout 20000 **/lit-element.test.js",
182
183
  "test:match": "mocha --timeout 20000 -g",
183
184
  "test:e2e": "playwright test",
184
185
  "test:e2e:match": "playwright test -g"