dh-remixer-sdk 0.0.2 → 0.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dh-remixer-sdk",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "templates",
@@ -3,5 +3,8 @@
3
3
  "index.tsx",
4
4
  "filemap.json",
5
5
  "public/.htaccess",
6
- "public/robots.txt"
6
+ "public/robots.txt",
7
+ ".gitignore",
8
+ "tsconfig.json",
9
+ "vite.config.ts"
7
10
  ]
@@ -4,5 +4,8 @@
4
4
  "package.json": "package.json",
5
5
  "filemap.json": "filemap.json",
6
6
  ".htaccess": "public/.htaccess",
7
- "robots.txt": "public/robots.txt"
7
+ "robots.txt": "public/robots.txt",
8
+ ".gitignore": ".gitignore",
9
+ "tsconfig.json": "tsconfig.json",
10
+ "vite.config.ts": "vite.config.ts"
8
11
  }
@@ -8,7 +8,7 @@
8
8
  "start": "vite preview --host 0.0.0.0 --mode production --port ${PORT:-4173}",
9
9
  "dev": "vite --host 0.0.0.0 --port ${PORT:-4173} --mode development",
10
10
  "lint": "echo 'Linting not implemented!'",
11
- "remixer-sdk:update": "npm install remixer-sdk@latest && mv new.package.json package.json"
11
+ "remixer-sdk:update": "npm cache clean --force && npm install dh-remixer-sdk@latest && mv new.package.json package.json"
12
12
  },
13
13
  "dependencies": {
14
14
  "@internationalized/date": "3.10.0",
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "experimentalDecorators": true,
5
+ "useDefineForClassFields": false,
6
+ "module": "ES2015",
7
+ "lib": [
8
+ "ES2022",
9
+ "DOM",
10
+ "DOM.Iterable"
11
+ ],
12
+ "skipLibCheck": true,
13
+ "types": [
14
+ "node"
15
+ ],
16
+ "moduleResolution": "bundler",
17
+ "isolatedModules": true,
18
+ "moduleDetection": "force",
19
+ "allowJs": true,
20
+ "jsx": "react-jsx",
21
+ "jsxImportSource": "react",
22
+ "esModuleInterop": true,
23
+ "paths": {
24
+ "@/*": [
25
+ "./*"
26
+ ]
27
+ },
28
+ "allowImportingTsExtensions": true,
29
+ "noEmit": true
30
+ }
31
+ }
@@ -0,0 +1,95 @@
1
+ import { defineConfig, Plugin, ResolvedConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+ import path from "path";
4
+ import fs from "fs";
5
+
6
+ const VIRTUAL_PREFIX = '\0tailwind-cdn:';
7
+
8
+ // Transforms CSS imports to inject as <style type="text/tailwindcss"> for Tailwind CDN
9
+ function tailwindCdnPlugin(): Plugin {
10
+ let config: ResolvedConfig;
11
+
12
+ return {
13
+ name: 'vite-plugin-tailwind-cdn',
14
+ enforce: 'pre',
15
+
16
+ configResolved(resolvedConfig) {
17
+ config = resolvedConfig;
18
+ },
19
+
20
+ async resolveId(id, importer) {
21
+ if (!id.endsWith('.css') || id.includes('node_modules')) {
22
+ return null;
23
+ }
24
+
25
+ let resolved: string | null = null;
26
+
27
+ // Use Vite's resolver to handle aliases (e.g., @/, ~/, etc.)
28
+ const resolution = await this.resolve(id, importer, { skipSelf: true });
29
+ if (resolution) {
30
+ resolved = resolution.id;
31
+ }
32
+ // Fallback for absolute paths
33
+ else if (path.isAbsolute(id)) {
34
+ resolved = id;
35
+ }
36
+ // Fallback for relative imports
37
+ else if (importer && (id.startsWith('./') || id.startsWith('../'))) {
38
+ const importerDir = importer.startsWith(VIRTUAL_PREFIX)
39
+ ? path.dirname(importer.slice(VIRTUAL_PREFIX.length))
40
+ : path.dirname(importer);
41
+ resolved = path.resolve(importerDir, id);
42
+ }
43
+
44
+ if (resolved && fs.existsSync(resolved)) {
45
+ return VIRTUAL_PREFIX + resolved + '.js';
46
+ }
47
+
48
+ return null;
49
+ },
50
+
51
+ load(id) {
52
+ if (!id.startsWith(VIRTUAL_PREFIX)) {
53
+ return null;
54
+ }
55
+
56
+ const realPath = id.slice(VIRTUAL_PREFIX.length).replace(/\.js$/, '');
57
+
58
+ if (!fs.existsSync(realPath)) {
59
+ return null;
60
+ }
61
+
62
+ const cssContent = fs.readFileSync(realPath, 'utf-8');
63
+
64
+ return `
65
+ (function() {
66
+ if (typeof document !== 'undefined') {
67
+ const css = ${JSON.stringify(cssContent)};
68
+ const style = document.createElement('style');
69
+ style.type = 'text/tailwindcss';
70
+ style.setAttribute('data-file', ${JSON.stringify(realPath)});
71
+ style.textContent = css;
72
+ document.head.appendChild(style);
73
+ }
74
+ })();
75
+ export default {};
76
+ `;
77
+ }
78
+ };
79
+ }
80
+
81
+ export default defineConfig({
82
+ plugins: [
83
+ tailwindCdnPlugin(),
84
+ react(),
85
+ ],
86
+ resolve: {
87
+ alias: {
88
+ "@": path.resolve(__dirname, "."),
89
+ },
90
+ },
91
+ build: {
92
+ outDir: "out",
93
+ target: "es2022"
94
+ }
95
+ });