@typestyles/astro 0.0.0-unstable.168f14777615

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.cjs ADDED
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => typestyles
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+ var import_vite = __toESM(require("@typestyles/vite"), 1);
37
+ function typestyles(options = {}) {
38
+ return {
39
+ name: "typestyles",
40
+ hooks: {
41
+ "astro:config:setup"({ updateConfig }) {
42
+ updateConfig({
43
+ vite: {
44
+ plugins: [(0, import_vite.default)(options)]
45
+ }
46
+ });
47
+ }
48
+ }
49
+ };
50
+ }
@@ -0,0 +1,22 @@
1
+ import { AstroIntegration } from 'astro';
2
+ import { TypestylesPluginOptions } from '@typestyles/vite';
3
+ export { TypestylesPluginOptions } from '@typestyles/vite';
4
+
5
+ /**
6
+ * Astro integration for typestyles.
7
+ *
8
+ * - **Dev** (`astro dev`): uses the Vite plugin in runtime mode so styles update via HMR.
9
+ * - **Production** (`astro build`): set `mode: 'build'` and `extract.modules` so CSS is
10
+ * emitted at build time and `__TYPESTYLES_RUNTIME_DISABLED__` strips client `<style>` injection.
11
+ *
12
+ * Point `extract.modules` at one or more side-effect entry files (relative to the Astro project
13
+ * root) that import every module registering typestyles for the site.
14
+ *
15
+ * **HMR:** `.astro` frontmatter runs only on the server, so the Vite plugin cannot hot-replace
16
+ * styles until those modules also run in the browser. In dev, add a client `<script>` that
17
+ * dynamically imports the same entry (e.g. `if (import.meta.env.DEV) void import('./typestyles-entry')`)
18
+ * and avoid inlining `getRegisteredCss()` in dev, or updates will appear stuck until a full reload.
19
+ */
20
+ declare function typestyles(options?: TypestylesPluginOptions): AstroIntegration;
21
+
22
+ export { typestyles as default };
@@ -0,0 +1,22 @@
1
+ import { AstroIntegration } from 'astro';
2
+ import { TypestylesPluginOptions } from '@typestyles/vite';
3
+ export { TypestylesPluginOptions } from '@typestyles/vite';
4
+
5
+ /**
6
+ * Astro integration for typestyles.
7
+ *
8
+ * - **Dev** (`astro dev`): uses the Vite plugin in runtime mode so styles update via HMR.
9
+ * - **Production** (`astro build`): set `mode: 'build'` and `extract.modules` so CSS is
10
+ * emitted at build time and `__TYPESTYLES_RUNTIME_DISABLED__` strips client `<style>` injection.
11
+ *
12
+ * Point `extract.modules` at one or more side-effect entry files (relative to the Astro project
13
+ * root) that import every module registering typestyles for the site.
14
+ *
15
+ * **HMR:** `.astro` frontmatter runs only on the server, so the Vite plugin cannot hot-replace
16
+ * styles until those modules also run in the browser. In dev, add a client `<script>` that
17
+ * dynamically imports the same entry (e.g. `if (import.meta.env.DEV) void import('./typestyles-entry')`)
18
+ * and avoid inlining `getRegisteredCss()` in dev, or updates will appear stuck until a full reload.
19
+ */
20
+ declare function typestyles(options?: TypestylesPluginOptions): AstroIntegration;
21
+
22
+ export { typestyles as default };
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ // src/index.ts
2
+ import typestylesVite from "@typestyles/vite";
3
+ function typestyles(options = {}) {
4
+ return {
5
+ name: "typestyles",
6
+ hooks: {
7
+ "astro:config:setup"({ updateConfig }) {
8
+ updateConfig({
9
+ vite: {
10
+ plugins: [typestylesVite(options)]
11
+ }
12
+ });
13
+ }
14
+ }
15
+ };
16
+ }
17
+ export {
18
+ typestyles as default
19
+ };
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@typestyles/astro",
3
+ "version": "0.0.0-unstable.168f14777615",
4
+ "description": "Astro integration for typestyles (dev HMR, production CSS extraction)",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "keywords": [
25
+ "astro",
26
+ "astro-integration",
27
+ "typestyles",
28
+ "css-in-js"
29
+ ],
30
+ "license": "Apache-2.0",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/dbanksdesign/typestyles",
34
+ "directory": "packages/astro"
35
+ },
36
+ "peerDependencies": {
37
+ "astro": ">=4.0.0"
38
+ },
39
+ "dependencies": {
40
+ "@typestyles/vite": "0.0.0-unstable.168f14777615"
41
+ },
42
+ "devDependencies": {
43
+ "astro": "^5.6.1",
44
+ "tsup": "^8.0.0",
45
+ "typescript": "^5.4.0"
46
+ },
47
+ "scripts": {
48
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean --external astro,@typestyles/vite",
49
+ "typecheck": "tsc --noEmit"
50
+ }
51
+ }