@swarm.ing/pieui 3.0.8 → 3.0.9

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/cli.js CHANGED
@@ -199637,6 +199637,109 @@ var writeIfChanged = (filePath, contents) => {
199637
199637
  import_node_fs21.default.mkdirSync(import_node_path21.default.dirname(filePath), { recursive: true });
199638
199638
  import_node_fs21.default.writeFileSync(filePath, contents, "utf8");
199639
199639
  };
199640
+ var tailwindMajor = (frontendRoot) => {
199641
+ try {
199642
+ const pkg = import_node_path21.default.join(frontendRoot, "node_modules", "tailwindcss", "package.json");
199643
+ const { version } = JSON.parse(import_node_fs21.default.readFileSync(pkg, "utf8"));
199644
+ return parseInt(String(version).split(".")[0], 10) || 0;
199645
+ } catch {
199646
+ return 0;
199647
+ }
199648
+ };
199649
+ var findTailwindConfig = (frontendRoot) => {
199650
+ for (const name of [
199651
+ "tailwind.config.js",
199652
+ "tailwind.config.cjs",
199653
+ "tailwind.config.mjs",
199654
+ "tailwind.config.ts"
199655
+ ]) {
199656
+ const candidate = import_node_path21.default.join(frontendRoot, name);
199657
+ if (import_node_fs21.default.existsSync(candidate))
199658
+ return candidate;
199659
+ }
199660
+ return null;
199661
+ };
199662
+ var packageType = (frontendRoot) => {
199663
+ try {
199664
+ const pkg = JSON.parse(import_node_fs21.default.readFileSync(import_node_path21.default.join(frontendRoot, "package.json"), "utf8"));
199665
+ return pkg.type === "module" ? "module" : "commonjs";
199666
+ } catch {
199667
+ return "commonjs";
199668
+ }
199669
+ };
199670
+ var scaffoldTailwindV3 = (frontendRoot, dir) => {
199671
+ if (tailwindMajor(frontendRoot) !== 3)
199672
+ return;
199673
+ const config = findTailwindConfig(frontendRoot);
199674
+ if (!config)
199675
+ return;
199676
+ writeIfChanged(import_node_path21.default.join(dir, "postcss.config.js"), `// The harness is a separate Next app, so it needs its own PostCSS config —
199677
+ // without it the project's \`@tailwind\` directives are never processed and the
199678
+ // preview renders completely unstyled.
199679
+ module.exports = { plugins: { tailwindcss: {}, autoprefixer: {} } }
199680
+ `);
199681
+ if (config.endsWith(".ts")) {
199682
+ console.log(`[pieui] ${import_node_path21.default.basename(config)} cannot be re-exported from the ` + `harness; if the preview renders unstyled, make its \`content\` ` + `globs absolute.`);
199683
+ return;
199684
+ }
199685
+ const rewrite = `const toAbsolute = (glob) =>
199686
+ typeof glob === 'string' && !isAbsolute(glob)
199687
+ ? join(projectRoot, glob.replace(/^\\.\\//, ''))
199688
+ : glob
199689
+
199690
+ const declared = Array.isArray(base.content)
199691
+ ? base.content
199692
+ : (base.content && base.content.files) || []
199693
+ `;
199694
+ const banner = `// Tailwind v3 resolves \`content\` globs against the build CWD, which for this
199695
+ // harness is this directory — the project's own relative globs would match
199696
+ // nothing and no utilities would be emitted. Re-export the project's config
199697
+ // (theme, plugins and all) with every relative glob made absolute.
199698
+ `;
199699
+ const asEsm = config.endsWith(".mjs") || packageType(frontendRoot) === "module";
199700
+ if (asEsm) {
199701
+ writeIfChanged(import_node_path21.default.join(dir, "tailwind.config.mjs"), `${banner}import { isAbsolute, join } from 'node:path'
199702
+ import base from '../../${import_node_path21.default.basename(config)}'
199703
+
199704
+ const projectRoot = new URL('../../', import.meta.url).pathname
199705
+
199706
+ ${rewrite}
199707
+ export default { ...base, content: declared.map(toAbsolute) }
199708
+ `);
199709
+ return;
199710
+ }
199711
+ writeIfChanged(import_node_path21.default.join(dir, "tailwind.config.js"), `${banner}const { isAbsolute, join, resolve } = require('node:path')
199712
+
199713
+ const projectRoot = resolve(__dirname, '..', '..')
199714
+ const base = require(join(projectRoot, '${import_node_path21.default.basename(config)}'))
199715
+
199716
+ ${rewrite}
199717
+ module.exports = { ...base, content: declared.map(toAbsolute) }
199718
+ `);
199719
+ };
199720
+ var linkPublicAssets = (frontendRoot, dir) => {
199721
+ const source = import_node_path21.default.join(frontendRoot, "public");
199722
+ if (!import_node_fs21.default.existsSync(source))
199723
+ return;
199724
+ const target = import_node_path21.default.join(dir, "public");
199725
+ try {
199726
+ let existing = null;
199727
+ try {
199728
+ existing = import_node_fs21.default.lstatSync(target);
199729
+ } catch {
199730
+ existing = null;
199731
+ }
199732
+ if (existing) {
199733
+ if (existing.isSymbolicLink() && import_node_path21.default.resolve(dir, import_node_fs21.default.readlinkSync(target)) === source) {
199734
+ return;
199735
+ }
199736
+ import_node_fs21.default.rmSync(target, { recursive: true, force: true });
199737
+ }
199738
+ import_node_fs21.default.symlinkSync(source, target, "dir");
199739
+ } catch (error) {
199740
+ console.log(`[pieui] could not link public/ into the harness (${String(error)}); ` + `static assets may 404 in the preview.`);
199741
+ }
199742
+ };
199640
199743
  var scaffoldHarness = (frontendRoot, registryName, hasProviders) => {
199641
199744
  const dir = import_node_path21.default.join(frontendRoot, REGISTRY_DIR);
199642
199745
  writeIfChanged(import_node_path21.default.join(dir, "package.json"), JSON.stringify({ name: "pie-registry-preview", version: "0.0.0", private: true }, null, 2) + `
@@ -199820,6 +199923,8 @@ export default function PreviewClient() {
199820
199923
  )
199821
199924
  }
199822
199925
  `);
199926
+ scaffoldTailwindV3(frontendRoot, dir);
199927
+ linkPublicAssets(frontendRoot, dir);
199823
199928
  writeIfChanged(import_node_path21.default.join(dir, ".gitignore"), `*
199824
199929
  `);
199825
199930
  return dir;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/code/commands/registry.ts"],"names":[],"mappings":"AAyBA,KAAK,eAAe,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AA+QD,eAAO,MAAM,eAAe,WAChB,KAAK,GAAG,OAAO,SACjB,eAAe,KACtB,IAyDF,CAAA"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/code/commands/registry.ts"],"names":[],"mappings":"AAyBA,KAAK,eAAe,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAgbD,eAAO,MAAM,eAAe,WAChB,KAAK,GAAG,OAAO,SACjB,eAAe,KACtB,IAyDF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarm.ing/pieui",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "description": "A React component library featuring PieCard component",
5
5
  "repository": {
6
6
  "type": "git",