tailwind-hyperclay 0.1.13 → 0.1.15

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 (3) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/index.js +8 -12
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.14] - 2026-01-31
4
+
5
+ ### Changed
6
+ - Add fallback module resolution from own node_modules
7
+
8
+
9
+
3
10
  ## [0.1.13] - 2026-01-12
4
11
 
5
12
  ### Changed
package/index.js CHANGED
@@ -54,7 +54,8 @@ async function compileTailwind(html) {
54
54
  // Determine base path for module resolution
55
55
  // - In packaged Electron apps: use app.asar.unpacked/node_modules
56
56
  // - In Electron dev mode or Node.js: use parent of __dirname (node_modules)
57
- let defaultBase = path.join(__dirname, '..'); // Default: node_modules directory
57
+ let defaultBase = path.join(__dirname, '..'); // Default: node_modules directory (when installed as a dep)
58
+ const ownBase = __dirname; // Fallback: resolve from own node_modules (when running from repo)
58
59
 
59
60
  if (process.versions.electron && process.resourcesPath) {
60
61
  const asarUnpackedPath = path.join(process.resourcesPath, 'app.asar.unpacked', 'node_modules');
@@ -70,7 +71,7 @@ async function compileTailwind(html) {
70
71
  const compiler = await compile(inputCSS, {
71
72
  loadStylesheet: async (id, base) => {
72
73
  let resolved;
73
- const searchPaths = [base || defaultBase];
74
+ const searchPaths = [base || defaultBase, ownBase];
74
75
 
75
76
  // Try resolving as-is first (for .css files)
76
77
  try {
@@ -93,13 +94,12 @@ async function compileTailwind(html) {
93
94
  return { content, base: path.dirname(resolved) };
94
95
  },
95
96
  loadModule: async (id, base) => {
96
- const resolved = require.resolve(id, { paths: [base || defaultBase] });
97
+ const resolved = require.resolve(id, { paths: [base || defaultBase, ownBase] });
97
98
  const mod = require(resolved);
98
99
  return { module: mod.default || mod, base: path.dirname(resolved) };
99
100
  },
100
101
  loadPlugin: async (plugin) => {
101
- // Plugins need to be found in the app's node_modules
102
- const resolved = require.resolve(plugin, { paths: [defaultBase] });
102
+ const resolved = require.resolve(plugin, { paths: [defaultBase, ownBase] });
103
103
  const mod = require(resolved);
104
104
  return mod.default || mod;
105
105
  }
@@ -153,20 +153,17 @@ function getTailwindCssName(html) {
153
153
  return null;
154
154
  }
155
155
 
156
- function hasTailwindLink(html, appName) {
157
- return extractHrefs(html).some(url => getTailwindName(url) === appName);
158
- }
159
-
160
156
  function hasAnyTailwindLink(html) {
161
157
  return extractHrefs(html).some(url => getTailwindName(url) !== null);
162
158
  }
163
159
 
164
- function replaceTailwindLink(html, newName) {
160
+ function replaceTailwindLink(html, newName, sitePath) {
161
+ const scopedName = sitePath ? `${sitePath}/${newName}` : newName;
165
162
  return html.replace(
166
163
  /(href\s*=\s*["'])([^"']+)(["'])/gi,
167
164
  (match, prefix, url, suffix) => {
168
165
  if (getTailwindName(url) !== null) {
169
- return `${prefix}https://hyperclay.com/tailwindcss/${newName}.css${suffix}`;
166
+ return `${prefix}/tailwindcss/${scopedName}.css${suffix}`;
170
167
  }
171
168
  return match;
172
169
  }
@@ -178,7 +175,6 @@ module.exports = {
178
175
  compileTailwind,
179
176
  extractCandidates,
180
177
  getTailwindCssName,
181
- hasTailwindLink,
182
178
  hasAnyTailwindLink,
183
179
  replaceTailwindLink
184
180
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-hyperclay",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "On-save Tailwind CSS generator for Hyperclay",
5
5
  "main": "index.js",
6
6
  "scripts": {