xpine 0.0.51 → 0.0.56

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/README.md CHANGED
@@ -453,4 +453,26 @@ export default {
453
453
  }
454
454
  ]
455
455
  }
456
- ```
456
+ ```
457
+
458
+ ### Pages public scripts
459
+
460
+ If you need to add a one-off public script, add a folder in the `/public/scripts` directory called `pages`.
461
+
462
+ For example: `/public/scripts/pages/my-awesome-page/sw.js`
463
+
464
+ Which will result in the public path of `/scripts/pages/my-awesome-page/sw.js`
465
+
466
+ Any `.js` or `.ts` file in this directory will be added as-is to the `public` folder and can be used in a script tag:
467
+
468
+ ```
469
+ <script src="/scripts/pages/my-awesome-page/sw.js" />
470
+ ```
471
+
472
+ ### Standalone public files
473
+
474
+ If you need to add a file that needs direct routing, like a service worker file, add a folder in the `/public` directory called `standalone`.
475
+
476
+ For example : `/public/standalone/my-page/sw.js`
477
+
478
+ Which will result in the public path of `/my-page/sw.js`
package/dist/index.js CHANGED
@@ -884,10 +884,14 @@ async function buildClientSideFiles(alpineDataFiles = [], isDev2, tempClientSide
884
884
  const tempFilePath = path6.join(config.distTempFolder, tempClientSidePath || "./app.ts");
885
885
  fs7.ensureFileSync(tempFilePath);
886
886
  const pagesScriptsGlob = config.publicDir + "/scripts/pages/**/*.{js,ts}";
887
+ const standaloneFolderGlob = config.publicDir + "/standalone/**/*.*";
887
888
  const clientFiles = globSync3(
888
889
  config.publicDir + "/**/*.{js,ts}",
889
890
  {
890
- ignore: pagesScriptsGlob
891
+ ignore: [
892
+ pagesScriptsGlob,
893
+ standaloneFolderGlob
894
+ ]
891
895
  }
892
896
  );
893
897
  convertEntryPointsToSingleFile(alpineDataFiles.concat(clientFiles), tempFilePath);
@@ -977,8 +981,12 @@ async function buildAlpineDataFile(componentData, dataFiles, bundleID) {
977
981
  }
978
982
  async function buildPublicFolderSymlinks() {
979
983
  const files = globSync3(config.publicDir + "/**/*.*", {
980
- ignore: "/**/*.{css,js,ts,tsx,jsx}"
984
+ ignore: [
985
+ "/**/*.{css,js,ts,tsx,jsx}",
986
+ "/**/standalone/**/*.*"
987
+ ]
981
988
  });
989
+ const standaloneFiles = globSync3(config.publicDir + "/standalone/**/*.*");
982
990
  for (const file of files) {
983
991
  try {
984
992
  const newPath = file.replace(config.srcDir, config.distDir);
@@ -990,6 +998,18 @@ async function buildPublicFolderSymlinks() {
990
998
  } catch {
991
999
  }
992
1000
  }
1001
+ for (const file of standaloneFiles) {
1002
+ try {
1003
+ const newPath = file.replace(config.srcDir, config.distDir);
1004
+ const splitNewPath = newPath.split("/").filter((item) => item !== "standalone");
1005
+ const updatedNewPath = splitNewPath.join("/");
1006
+ splitNewPath.pop();
1007
+ const newDir = splitNewPath.join("/");
1008
+ fs7.ensureDirSync(newDir);
1009
+ fs7.symlinkSync(file, updatedNewPath);
1010
+ } catch {
1011
+ }
1012
+ }
993
1013
  }
994
1014
  async function logSize(pathName, type, validExtensions = [".js", ".css"]) {
995
1015
  const files = globSync3(pathName + "/**/*" + (type === "css" ? ".css" : ""));
@@ -1173,7 +1193,7 @@ async function buildSitemap() {
1173
1193
  const filteredPages = allPages.filter((filePath) => {
1174
1194
  return !micromatch([filePath], config.sitemap?.excludePaths || [])?.length;
1175
1195
  });
1176
- const pages = filteredPages.map((filePath) => {
1196
+ let pages = filteredPages.map((filePath) => {
1177
1197
  const replacedExtensions = filePath.replace(regex_default.endsWithFileName, "");
1178
1198
  const replacedPagesPath = replacedExtensions.replace(config.pagesDir, "");
1179
1199
  const replacedDistPath = replacedPagesPath.replace(config.distPagesDir, "");
@@ -1183,6 +1203,7 @@ async function buildSitemap() {
1183
1203
  }).filter((filePath) => {
1184
1204
  return !filePath.includes("+config");
1185
1205
  });
1206
+ pages = [...new Set(pages)];
1186
1207
  const sitemap = `
1187
1208
  <?xml version="1.0" encoding="UTF-8"?>
1188
1209
  <urlset
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../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AAC;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAA;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,YAAY,iBAgDhD;AA4JD,wBAAsB,yBAAyB,kBAiC9C;AAED,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,WAAkB,iBAa9F;AAED,wBAAsB,qBAAqB,CAAC,aAAa,EAAE,aAAa,EAAE,iBAezE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,iBA2FpI;AAED,wBAAgB,gCAAgC,CAAC,kBAAkB,EAAE,MAAM,EAAE,qBAAqB,CAAC,EAAE,MAAM,EAAE,UAe5G;AAED,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAQxE;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAA;AAGD,wBAAsB,eAAe,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO,iBAoDpF;AAED,wBAAsB,YAAY,kBA4CjC"}
@@ -657,10 +657,14 @@ async function buildClientSideFiles(alpineDataFiles = [], isDev3, tempClientSide
657
657
  const tempFilePath = path5.join(config.distTempFolder, tempClientSidePath || "./app.ts");
658
658
  fs7.ensureFileSync(tempFilePath);
659
659
  const pagesScriptsGlob = config.publicDir + "/scripts/pages/**/*.{js,ts}";
660
+ const standaloneFolderGlob = config.publicDir + "/standalone/**/*.*";
660
661
  const clientFiles = globSync3(
661
662
  config.publicDir + "/**/*.{js,ts}",
662
663
  {
663
- ignore: pagesScriptsGlob
664
+ ignore: [
665
+ pagesScriptsGlob,
666
+ standaloneFolderGlob
667
+ ]
664
668
  }
665
669
  );
666
670
  convertEntryPointsToSingleFile(alpineDataFiles.concat(clientFiles), tempFilePath);
@@ -750,8 +754,12 @@ async function buildAlpineDataFile(componentData, dataFiles, bundleID) {
750
754
  }
751
755
  async function buildPublicFolderSymlinks() {
752
756
  const files = globSync3(config.publicDir + "/**/*.*", {
753
- ignore: "/**/*.{css,js,ts,tsx,jsx}"
757
+ ignore: [
758
+ "/**/*.{css,js,ts,tsx,jsx}",
759
+ "/**/standalone/**/*.*"
760
+ ]
754
761
  });
762
+ const standaloneFiles = globSync3(config.publicDir + "/standalone/**/*.*");
755
763
  for (const file of files) {
756
764
  try {
757
765
  const newPath = file.replace(config.srcDir, config.distDir);
@@ -763,6 +771,18 @@ async function buildPublicFolderSymlinks() {
763
771
  } catch {
764
772
  }
765
773
  }
774
+ for (const file of standaloneFiles) {
775
+ try {
776
+ const newPath = file.replace(config.srcDir, config.distDir);
777
+ const splitNewPath = newPath.split("/").filter((item) => item !== "standalone");
778
+ const updatedNewPath = splitNewPath.join("/");
779
+ splitNewPath.pop();
780
+ const newDir = splitNewPath.join("/");
781
+ fs7.ensureDirSync(newDir);
782
+ fs7.symlinkSync(file, updatedNewPath);
783
+ } catch {
784
+ }
785
+ }
766
786
  }
767
787
  async function logSize(pathName, type, validExtensions = [".js", ".css"]) {
768
788
  const files = globSync3(pathName + "/**/*" + (type === "css" ? ".css" : ""));
@@ -946,7 +966,7 @@ async function buildSitemap() {
946
966
  const filteredPages = allPages.filter((filePath) => {
947
967
  return !micromatch([filePath], config.sitemap?.excludePaths || [])?.length;
948
968
  });
949
- const pages = filteredPages.map((filePath) => {
969
+ let pages = filteredPages.map((filePath) => {
950
970
  const replacedExtensions = filePath.replace(regex_default.endsWithFileName, "");
951
971
  const replacedPagesPath = replacedExtensions.replace(config.pagesDir, "");
952
972
  const replacedDistPath = replacedPagesPath.replace(config.distPagesDir, "");
@@ -956,6 +976,7 @@ async function buildSitemap() {
956
976
  }).filter((filePath) => {
957
977
  return !filePath.includes("+config");
958
978
  });
979
+ pages = [...new Set(pages)];
959
980
  const sitemap = `
960
981
  <?xml version="1.0" encoding="UTF-8"?>
961
982
  <urlset
@@ -664,10 +664,14 @@ async function buildClientSideFiles(alpineDataFiles = [], isDev2, tempClientSide
664
664
  const tempFilePath = path5.join(config.distTempFolder, tempClientSidePath || "./app.ts");
665
665
  fs7.ensureFileSync(tempFilePath);
666
666
  const pagesScriptsGlob = config.publicDir + "/scripts/pages/**/*.{js,ts}";
667
+ const standaloneFolderGlob = config.publicDir + "/standalone/**/*.*";
667
668
  const clientFiles = globSync3(
668
669
  config.publicDir + "/**/*.{js,ts}",
669
670
  {
670
- ignore: pagesScriptsGlob
671
+ ignore: [
672
+ pagesScriptsGlob,
673
+ standaloneFolderGlob
674
+ ]
671
675
  }
672
676
  );
673
677
  convertEntryPointsToSingleFile(alpineDataFiles.concat(clientFiles), tempFilePath);
@@ -757,8 +761,12 @@ async function buildAlpineDataFile(componentData, dataFiles, bundleID) {
757
761
  }
758
762
  async function buildPublicFolderSymlinks() {
759
763
  const files = globSync3(config.publicDir + "/**/*.*", {
760
- ignore: "/**/*.{css,js,ts,tsx,jsx}"
764
+ ignore: [
765
+ "/**/*.{css,js,ts,tsx,jsx}",
766
+ "/**/standalone/**/*.*"
767
+ ]
761
768
  });
769
+ const standaloneFiles = globSync3(config.publicDir + "/standalone/**/*.*");
762
770
  for (const file of files) {
763
771
  try {
764
772
  const newPath = file.replace(config.srcDir, config.distDir);
@@ -770,6 +778,18 @@ async function buildPublicFolderSymlinks() {
770
778
  } catch {
771
779
  }
772
780
  }
781
+ for (const file of standaloneFiles) {
782
+ try {
783
+ const newPath = file.replace(config.srcDir, config.distDir);
784
+ const splitNewPath = newPath.split("/").filter((item) => item !== "standalone");
785
+ const updatedNewPath = splitNewPath.join("/");
786
+ splitNewPath.pop();
787
+ const newDir = splitNewPath.join("/");
788
+ fs7.ensureDirSync(newDir);
789
+ fs7.symlinkSync(file, updatedNewPath);
790
+ } catch {
791
+ }
792
+ }
773
793
  }
774
794
  async function logSize(pathName, type, validExtensions = [".js", ".css"]) {
775
795
  const files = globSync3(pathName + "/**/*" + (type === "css" ? ".css" : ""));
@@ -953,7 +973,7 @@ async function buildSitemap() {
953
973
  const filteredPages = allPages.filter((filePath) => {
954
974
  return !micromatch([filePath], config.sitemap?.excludePaths || [])?.length;
955
975
  });
956
- const pages = filteredPages.map((filePath) => {
976
+ let pages = filteredPages.map((filePath) => {
957
977
  const replacedExtensions = filePath.replace(regex_default.endsWithFileName, "");
958
978
  const replacedPagesPath = replacedExtensions.replace(config.pagesDir, "");
959
979
  const replacedDistPath = replacedPagesPath.replace(config.distPagesDir, "");
@@ -963,6 +983,7 @@ async function buildSitemap() {
963
983
  }).filter((filePath) => {
964
984
  return !filePath.includes("+config");
965
985
  });
986
+ pages = [...new Set(pages)];
966
987
  const sitemap = `
967
988
  <?xml version="1.0" encoding="UTF-8"?>
968
989
  <urlset
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xpine",
3
- "version": "0.0.51",
3
+ "version": "0.0.56",
4
4
  "main": "dist/index.js",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-secrets-manager": "^3.758.0",