@aldinn/astro 0.1.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,15 @@
1
+ export interface AstroFontOptions {
2
+ fonts: string[];
3
+ cdnBaseUrl?: string;
4
+ }
5
+ /**
6
+ * Astro integration to inject Soroborno font stylesheets
7
+ */
8
+ export declare function sorobornoAstro(options: AstroFontOptions): {
9
+ name: string;
10
+ hooks: {
11
+ 'astro:config:setup': ({ injectScript }: any) => void;
12
+ };
13
+ };
14
+ export default sorobornoAstro;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB;;;iDAMT,GAAG;;EAcjD;AAED,eAAe,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ import { getFontStylesheetUrl } from '@aldinn/core';
2
+ /**
3
+ * Astro integration to inject Soroborno font stylesheets
4
+ */
5
+ export function sorobornoAstro(options) {
6
+ const { fonts = [], cdnBaseUrl } = options;
7
+ return {
8
+ name: '@aldinn/astro',
9
+ hooks: {
10
+ 'astro:config:setup': ({ injectScript }) => {
11
+ for (const fontId of fonts) {
12
+ const url = getFontStylesheetUrl(fontId, cdnBaseUrl);
13
+ injectScript('head-inline', `
14
+ const link = document.createElement('link');
15
+ link.rel = 'stylesheet';
16
+ link.href = '${url}';
17
+ link.crossOrigin = 'anonymous';
18
+ document.head.appendChild(link);
19
+ `);
20
+ }
21
+ }
22
+ }
23
+ };
24
+ }
25
+ export default sorobornoAstro;
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAOpD;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAyB;IACtD,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE3C,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE;YACL,oBAAoB,EAAE,CAAC,EAAE,YAAY,EAAO,EAAE,EAAE;gBAC9C,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE,CAAC;oBAC3B,MAAM,GAAG,GAAG,oBAAoB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;oBACrD,YAAY,CAAC,aAAa,EAAE;;;2BAGX,GAAG;;;WAGnB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAED,eAAe,cAAc,CAAC"}
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@aldinn/astro",
3
+ "version": "0.1.0",
4
+ "description": "Astro integration for Soroborno fonts with automated CSS injection",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.cjs",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "dependencies": {
16
+ "@aldinn/core": "^0.1.0"
17
+ },
18
+ "scripts": {
19
+ "build": "tsc"
20
+ },
21
+ "keywords": ["bangla", "fonts", "astro", "astro-integration", "soroborno"],
22
+ "author": "Taraldinn",
23
+ "license": "MIT"
24
+ }
package/src/index.ts ADDED
@@ -0,0 +1,33 @@
1
+ import { getFontStylesheetUrl } from '@aldinn/core';
2
+
3
+ export interface AstroFontOptions {
4
+ fonts: string[];
5
+ cdnBaseUrl?: string;
6
+ }
7
+
8
+ /**
9
+ * Astro integration to inject Soroborno font stylesheets
10
+ */
11
+ export function sorobornoAstro(options: AstroFontOptions) {
12
+ const { fonts = [], cdnBaseUrl } = options;
13
+
14
+ return {
15
+ name: '@aldinn/astro',
16
+ hooks: {
17
+ 'astro:config:setup': ({ injectScript }: any) => {
18
+ for (const fontId of fonts) {
19
+ const url = getFontStylesheetUrl(fontId, cdnBaseUrl);
20
+ injectScript('head-inline', `
21
+ const link = document.createElement('link');
22
+ link.rel = 'stylesheet';
23
+ link.href = '${url}';
24
+ link.crossOrigin = 'anonymous';
25
+ document.head.appendChild(link);
26
+ `);
27
+ }
28
+ }
29
+ }
30
+ };
31
+ }
32
+
33
+ export default sorobornoAstro;
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src",
6
+ "module": "ESNext",
7
+ "moduleResolution": "Bundler"
8
+ },
9
+ "include": ["src/**/*"]
10
+ }