coralite 0.28.3 → 0.28.5

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/lib/index.js CHANGED
@@ -9725,7 +9725,7 @@ customElements.define("${componentId}", ${componentId.replace(/[-.:]/g, "_")});
9725
9725
  },
9726
9726
  bundle: true,
9727
9727
  write: false,
9728
- treeShaking: true,
9728
+ treeShaking: false,
9729
9729
  sourcemap: mode === "production" ? false : "inline",
9730
9730
  minify: mode === "production",
9731
9731
  format: "esm",
@@ -9959,7 +9959,7 @@ ScriptManager.prototype.compileAllInstances = async function(instances, mode) {
9959
9959
  },
9960
9960
  bundle: true,
9961
9961
  write: false,
9962
- treeShaking: true,
9962
+ treeShaking: false,
9963
9963
  sourcemap: mode === "production" ? false : "inline",
9964
9964
  minify: mode === "production",
9965
9965
  format: "esm",
@@ -10578,6 +10578,7 @@ function createPlugin({
10578
10578
  // plugins/static-assets.js
10579
10579
  import { createRequire } from "node:module";
10580
10580
  import { dirname as dirname4, join as join2 } from "node:path";
10581
+ import { existsSync as existsSync2 } from "node:fs";
10581
10582
  import { cp, mkdir } from "node:fs/promises";
10582
10583
  var staticAssetPlugin = (assets = []) => {
10583
10584
  return createPlugin({
@@ -10585,13 +10586,32 @@ var staticAssetPlugin = (assets = []) => {
10585
10586
  onBeforeBuild: async function() {
10586
10587
  const outputDir = this.options.output || join2(process.cwd(), "dist");
10587
10588
  for (const asset of assets) {
10588
- if (!asset.pkg || !asset.path || !asset.dest) {
10589
- throw new Error("staticAssetPlugin requires assets to have pkg, path, and dest properties.");
10589
+ if (!asset.dest) {
10590
+ throw new Error("staticAssetPlugin requires assets to have a dest property.");
10591
+ }
10592
+ const dest = join2(outputDir, asset.dest);
10593
+ if (asset.src) {
10594
+ await mkdir(dirname4(dest), { recursive: true });
10595
+ await cp(asset.src, dest, { recursive: true });
10596
+ continue;
10597
+ }
10598
+ if (!asset.pkg || !asset.path) {
10599
+ throw new Error("staticAssetPlugin requires assets to have pkg and path properties when src is not provided.");
10590
10600
  }
10591
10601
  const require2 = createRequire(import.meta.url);
10592
- const pkgPath = dirname4(require2.resolve(`${asset.pkg}/package.json`));
10602
+ let pkgPath;
10603
+ try {
10604
+ pkgPath = dirname4(require2.resolve(`${asset.pkg}/package.json`));
10605
+ } catch (e) {
10606
+ pkgPath = dirname4(require2.resolve(asset.pkg));
10607
+ while (pkgPath !== "/" && !existsSync2(join2(pkgPath, "package.json"))) {
10608
+ pkgPath = dirname4(pkgPath);
10609
+ }
10610
+ if (pkgPath === "/") {
10611
+ throw new Error(`staticAssetPlugin could not resolve package.json for package: ${asset.pkg}`);
10612
+ }
10613
+ }
10593
10614
  const src = join2(pkgPath, asset.path);
10594
- const dest = join2(outputDir, asset.dest);
10595
10615
  await mkdir(dirname4(dest), { recursive: true });
10596
10616
  await cp(src, dest, { recursive: true });
10597
10617
  }