@sequenceholdings/artifact-studio 0.1.1 → 0.1.3

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 (2) hide show
  1. package/dist/build.js +15 -3
  2. package/package.json +1 -1
package/dist/build.js CHANGED
@@ -1,18 +1,30 @@
1
+ import { existsSync } from 'node:fs';
1
2
  import { mkdir, writeFile } from 'node:fs/promises';
2
3
  import { createRequire } from 'node:module';
3
4
  import { dirname, resolve } from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
5
  import { build as viteBuild } from 'vite';
6
6
  import { sha256Hex } from './hash.js';
7
7
  import { readArtifactStudioSource } from './project.js';
8
8
  const cliRequire = createRequire(import.meta.url);
9
- const cliDir = dirname(fileURLToPath(import.meta.url));
10
9
  const reactDir = dirname(cliRequire.resolve('react/package.json'));
11
10
  const reactDomDir = dirname(cliRequire.resolve('react-dom/package.json'));
12
11
  const atlasUiDir = dirname(cliRequire.resolve('@sequenceholdings/atlas-ui/package.json'));
13
12
  const atlasUiDist = resolve(atlasUiDir, 'dist');
14
13
  const tailwindCssPath = resolve(dirname(cliRequire.resolve('tailwindcss/package.json')), 'index.css');
15
- const twAnimateCssPath = resolve(cliDir, '..', 'node_modules', 'tw-animate-css', 'dist', 'tw-animate.css');
14
+ // tw-animate-css intentionally omits `./package.json` from its exports map
15
+ // (its only exports are CSS files via the `style` condition), so the
16
+ // `cliRequire.resolve('<pkg>/package.json')` trick that works for tailwindcss
17
+ // errors with ERR_PACKAGE_PATH_NOT_EXPORTED. Walk the module search paths
18
+ // and probe for the dist file directly instead.
19
+ const twAnimateCssPath = (() => {
20
+ const searchPaths = cliRequire.resolve.paths('tw-animate-css') ?? [];
21
+ for (const base of searchPaths) {
22
+ const candidate = resolve(base, 'tw-animate-css', 'dist', 'tw-animate.css');
23
+ if (existsSync(candidate))
24
+ return candidate;
25
+ }
26
+ throw new Error('Could not resolve tw-animate-css/dist/tw-animate.css in module search paths');
27
+ })();
16
28
  function isAssetOutput(value) {
17
29
  return value.type === 'asset';
18
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequenceholdings/artifact-studio",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "CLI and SDK types for building Artifact Studio apps",
5
5
  "type": "module",
6
6
  "bin": {