From ecde90f89d7f3c68d5463d71ee7341ab4674ae31 Mon Sep 17 00:00:00 2001 From: babayaga Date: Wed, 24 Dec 2025 11:47:18 +0100 Subject: [PATCH] latest | cache bust 1/2 --- .../domain-expansion/.changeset/README.md | 8 - .../domain-expansion/.changeset/config.json | 14 -- .../domain-expansion/.github/renovate.json | 19 -- .../.github/workflows/changesets.yml | 53 ---- .../domain-expansion/.github/workflows/ci.yml | 147 ----------- .../.github/workflows/preview-mode.yml | 50 ---- .../.github/workflows/release.yml | 68 ------ .../.github/workflows/todo-tracking.yml | 25 -- packages/domain-expansion/.husky/pre-commit | 3 - .../domain-expansion/.vscode/settings.json | 4 - packages/domain-expansion/package-lock.json | 29 ++- packages/imagetools/plugin/hooks/load.js | 10 +- packages/imagetools_3/api/utils/getImage.js | 6 +- .../api/utils/getProcessedImage.js | 14 +- packages/imagetools_3/api/utils/getSrcset.js | 4 +- packages/imagetools_3/astroViteConfigs.js | 12 +- packages/imagetools_3/components/Img.astro | 13 +- packages/imagetools_3/integration/index.js | 15 +- packages/imagetools_3/package.json | 3 +- packages/imagetools_3/plugin/hooks/load.js | 1 + packages/imagetools_3/plugin/utils/cache.js | 1 - packages/imagetools_3/utils/runtimeChecks.js | 17 +- packages/polymech/package.json | 1 + packages/polymech/src/base/collections.ts | 2 +- .../polymech/src/components/Breadcrumb.astro | 2 +- .../polymech/src/components/GalleryK.astro | 63 +++-- .../src/components/RelativeImage.astro | 230 ++++++++++-------- packages/polymech/src/layouts/Resources.astro | 9 +- .../src/routes/product/[lang]/[slug].astro | 7 +- .../polymech/src/utils/path-resolution.ts | 3 +- 30 files changed, 261 insertions(+), 572 deletions(-) delete mode 100644 packages/domain-expansion/.changeset/README.md delete mode 100644 packages/domain-expansion/.changeset/config.json delete mode 100644 packages/domain-expansion/.github/renovate.json delete mode 100644 packages/domain-expansion/.github/workflows/changesets.yml delete mode 100644 packages/domain-expansion/.github/workflows/ci.yml delete mode 100644 packages/domain-expansion/.github/workflows/preview-mode.yml delete mode 100644 packages/domain-expansion/.github/workflows/release.yml delete mode 100644 packages/domain-expansion/.github/workflows/todo-tracking.yml delete mode 100644 packages/domain-expansion/.husky/pre-commit delete mode 100644 packages/domain-expansion/.vscode/settings.json diff --git a/packages/domain-expansion/.changeset/README.md b/packages/domain-expansion/.changeset/README.md deleted file mode 100644 index e5b6d8d..0000000 --- a/packages/domain-expansion/.changeset/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Changesets - -Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works -with multi-package repos, or single-package repos to help you version and publish your code. You can -find the full documentation for it [in our repository](https://github.com/changesets/changesets) - -We have a quick list of common questions to get you started engaging with this project in -[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/packages/domain-expansion/.changeset/config.json b/packages/domain-expansion/.changeset/config.json deleted file mode 100644 index 2da19d4..0000000 --- a/packages/domain-expansion/.changeset/config.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", - "changelog": "@changesets/cli/changelog", - "commit": false, - "fixed": [], - "linked": [], - "access": "public", - "baseBranch": "main", - "updateInternalDependencies": "patch", - "ignore": [ - "@domain-expansion-test/*", - "docs" - ] -} diff --git a/packages/domain-expansion/.github/renovate.json b/packages/domain-expansion/.github/renovate.json deleted file mode 100644 index 6cc37d1..0000000 --- a/packages/domain-expansion/.github/renovate.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": ["config:recommended"], - "dependencyDashboard": true, - "lockFileMaintenance": { - "enabled": true - }, - "postUpdateOptions": ["pnpmDedupe"], - "packageRules": [ - { - "groupName": "all dependencies", - "groupSlug": "all", - "matchPackagePatterns": ["*"], - "schedule": ["before 4am on Monday"], - "rangeStrategy": "bump" - } - ], - "ignoreDeps": ["node"] -} diff --git a/packages/domain-expansion/.github/workflows/changesets.yml b/packages/domain-expansion/.github/workflows/changesets.yml deleted file mode 100644 index dbde33a..0000000 --- a/packages/domain-expansion/.github/workflows/changesets.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Surface PR Changesets - -on: pull_request - -permissions: - pull-requests: write - checks: write - statuses: write - -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Get changed files in the .changeset folder - id: changed-files - uses: tj-actions/changed-files@v35 - with: - files: | - .changeset/**/*.md - - - name: Check if any changesets contain minor or major changes - id: check - run: | - echo "Checking for changesets marked as minor or major" - echo "found=false" >> $GITHUB_OUTPUT - - regex="[\"']astro[\"']: (minor|major)" - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do - if [[ $(cat $file) =~ $regex ]]; then - version="${BASH_REMATCH[1]}" - echo "version=$version" >> $GITHUB_OUTPUT - echo "found=true" >> $GITHUB_OUTPUT - echo "$file has a $version release tag" - fi - done - - - name: Add label - uses: actions/github-script@v6 - if: steps.check.outputs.found == 'true' - env: - issue_number: ${{ github.event.number }} - with: - script: | - github.rest.issues.addLabels({ - issue_number: process.env.issue_number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['semver: ${{ steps.check.outputs.version }}'] - }); diff --git a/packages/domain-expansion/.github/workflows/ci.yml b/packages/domain-expansion/.github/workflows/ci.yml deleted file mode 100644 index ab92a6c..0000000 --- a/packages/domain-expansion/.github/workflows/ci.yml +++ /dev/null @@ -1,147 +0,0 @@ -name: CI - -on: - workflow_dispatch: - push: - branches: - - main - merge_group: - pull_request: - paths-ignore: - - "**/*.md" - - ".github/ISSUE_TEMPLATE/**" - -# Automatically cancel older in-progress jobs on the same branch -concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} - cancel-in-progress: true - -defaults: - run: - shell: bash - -env: - FORCE_COLOR: true - ASTRO_TELEMETRY_DISABLED: true - # 7 GiB by default on GitHub, setting to 6 GiB - # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources - NODE_OPTIONS: --max-old-space-size=6144 - -jobs: - # Build primes out Turbo build cache and pnpm cache - build: - name: "Build - Node ${{ matrix.NODE_VERSION }}" - runs-on: ubuntu-latest - timeout-minutes: 3 - strategy: - matrix: - NODE_VERSION: [20, 22] - fail-fast: false - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v2 - - - name: Setup node@${{ matrix.NODE_VERSION }} - uses: actions/setup-node@main - with: - node-version: ${{ matrix.NODE_VERSION }} - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Build Packages - run: pnpm run package:build - - lint: - name: Lint - runs-on: ubuntu-latest - timeout-minutes: 5 - needs: build - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v2 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Format Check - run: pnpm run lint - - test: - name: "Test: Node ${{ matrix.NODE_VERSION }}" - runs-on: ubuntu-latest - timeout-minutes: 10 - needs: build - strategy: - matrix: - NODE_VERSION: [20, 22] - fail-fast: false - env: - NODE_VERSION: ${{ matrix.NODE_VERSION }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Cache turbo build setup - uses: actions/cache@v4 - with: - path: .turbo - key: ${{ runner.os }}-${{ matrix.NODE_VERSION }}-turbo-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ matrix.NODE_VERSION }}-turbo- - - - name: Setup PNPM - uses: pnpm/action-setup@v2 - - - name: Setup node@${{ matrix.NODE_VERSION }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.NODE_VERSION }} - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Build Packages - run: pnpm run package:build - - - name: Test - run: pnpm test - working-directory: package - - duplicated-packages: - name: Check for duplicated dependencies - runs-on: ubuntu-latest - env: - NODE_VERSION: 22 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v2 - - - name: Setup node@${{ matrix.NODE_VERSION }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.NODE_VERSION }} - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Check duplicated dependencies - run: pnpm dedupe --prefer-offline --check diff --git a/packages/domain-expansion/.github/workflows/preview-mode.yml b/packages/domain-expansion/.github/workflows/preview-mode.yml deleted file mode 100644 index 5d9b742..0000000 --- a/packages/domain-expansion/.github/workflows/preview-mode.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Preview mode - -on: - pull_request: - types: - - synchronize - - opened - - reopened - -env: - FORCE_COLOR: true - -jobs: - no-preview: - name: Block Preview mode - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - issues: write - pull-requests: write - steps: - - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v2 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Check for preview mode - # Fails if in preview mode - run: pnpm changeset pre enter foo - - - name: Remove Preview Label - uses: actions-ecosystem/action-remove-labels@v1 - with: - labels: preview - - - name: Add Label - if: ${{ failure() }} - uses: actions-ecosystem/action-add-labels@v1 - with: - labels: preview diff --git a/packages/domain-expansion/.github/workflows/release.yml b/packages/domain-expansion/.github/workflows/release.yml deleted file mode 100644 index fcbc9bf..0000000 --- a/packages/domain-expansion/.github/workflows/release.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Release - -on: - push: - branches: - - main - pull_request: - types: - - opened - - reopened - - synchronize - - labeled - -defaults: - run: - shell: bash - -env: - FORCE_COLOR: true - -jobs: - changelog: - name: Changelog PR or Release - runs-on: ubuntu-latest - if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'preview') }} - permissions: - contents: write - id-token: write - steps: - - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v2 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: "pnpm" - registry-url: 'https://registry.npmjs.org' - - - name: Install dependencies - run: pnpm install - - - name: Build Packages - run: pnpm run package:build - - - name: Publish preview - if: ${{ contains(github.event.pull_request.labels.*.name, 'preview') }} - run: pnpm exec changeset publish - env: - # Use Node auth from above - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Create Release Pull Request or Publish - id: changesets - if: ${{ github.event_name == 'push' }} - uses: changesets/action@v1 - with: - # Note: pnpm install after versioning is necessary to refresh lockfile - version: pnpm run version - publish: pnpm exec changeset publish - commit: '[ci] release' - title: '[ci] release' - env: - GITHUB_TOKEN: ${{ secrets.COMMIT_TOKEN }} - # Needs access to publish to npm - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/packages/domain-expansion/.github/workflows/todo-tracking.yml b/packages/domain-expansion/.github/workflows/todo-tracking.yml deleted file mode 100644 index 5feb5fe..0000000 --- a/packages/domain-expansion/.github/workflows/todo-tracking.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: TODO Tracking - -on: - push: - # branches: [main] - -permissions: - issues: read - repository-projects: read - contents: read - -jobs: - track-todos: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run tdg-github-action - uses: ribtoks/tdg-github-action@master - with: - TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO: ${{ github.repository }} - SHA: ${{ github.sha }} - REF: ${{ github.ref }} - DRY_RUN: false - COMMENT_ON_ISSUES: true diff --git a/packages/domain-expansion/.husky/pre-commit b/packages/domain-expansion/.husky/pre-commit deleted file mode 100644 index 9c1cf54..0000000 --- a/packages/domain-expansion/.husky/pre-commit +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -node_modules/.bin/lint-staged diff --git a/packages/domain-expansion/.vscode/settings.json b/packages/domain-expansion/.vscode/settings.json deleted file mode 100644 index a91ae0b..0000000 --- a/packages/domain-expansion/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "editor.defaultFormatter": "prettier", - "editor.gotoLocation.multipleDefinitions": "goto" -} diff --git a/packages/domain-expansion/package-lock.json b/packages/domain-expansion/package-lock.json index 1ec9436..ba9d679 100644 --- a/packages/domain-expansion/package-lock.json +++ b/packages/domain-expansion/package-lock.json @@ -343,6 +343,13 @@ "fs-extra": "^8.1.0" } }, + "node_modules/@manypkg/find-root/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@manypkg/find-root/node_modules/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -434,11 +441,16 @@ } }, "node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "version": "24.3.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.3.tgz", + "integrity": "sha512-GKBNHjoNw3Kra1Qg5UXttsY5kiWMEfoHq2TmXb+b1rcm6N7B3wTrFYIf/oSZ1xNQ+hVVijgLkiDZh7jRRsh+Gw==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "undici-types": "~7.10.0" + } }, "node_modules/ansi-colors": { "version": "4.1.3", @@ -1920,6 +1932,15 @@ "node": ">=8.0" } }, + "node_modules/undici-types": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz", + "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", diff --git a/packages/imagetools/plugin/hooks/load.js b/packages/imagetools/plugin/hooks/load.js index f09d5b7..f5430ce 100644 --- a/packages/imagetools/plugin/hooks/load.js +++ b/packages/imagetools/plugin/hooks/load.js @@ -20,26 +20,18 @@ export default async function load(id) { const { search, searchParams } = fileURL; - id = id.replace(search, ""); - + id = id.replace(search, ""); const ext = path.extname(id).slice(1); - if (!supportedImageTypes.includes(ext)) return null; - debugger - const { default: astroViteConfigs } = await import( // @ts-ignore "../../astroViteConfigs.js" ); - const { environment, projectBase, assetFileNames } = astroViteConfigs; - const src = await getSrcPath(id); - const rootRelativePosixSrc = path.posix.normalize( path.relative("", src).split(path.sep).join(path.posix.sep) ); - const getHash = (width) => objectHash( { width, options, rootRelativePosixSrc }, diff --git a/packages/imagetools_3/api/utils/getImage.js b/packages/imagetools_3/api/utils/getImage.js index c857a87..c3f8aef 100644 --- a/packages/imagetools_3/api/utils/getImage.js +++ b/packages/imagetools_3/api/utils/getImage.js @@ -50,7 +50,7 @@ export default async function ({ imageWidth, imageHeight, imageFormat - } = await getProcessedImage(src, transformConfigs, { skipCache: true }); + } = await getProcessedImage(src, transformConfigs, { skipCache: false }); src = path; @@ -114,9 +114,7 @@ export default async function ({ return returnObject; } catch (error) { - console.error(`Error processing images:: ${src}`, error, error.stack); - debugger - + console.error(`Error processing images:: ${src}`, error, error.stack); throw error; } } diff --git a/packages/imagetools_3/api/utils/getProcessedImage.js b/packages/imagetools_3/api/utils/getProcessedImage.js index 08a86b3..7523507 100644 --- a/packages/imagetools_3/api/utils/getProcessedImage.js +++ b/packages/imagetools_3/api/utils/getProcessedImage.js @@ -55,12 +55,18 @@ export default async function getProcessedImage( let path = src.replace(/\\/g, `/`); + // @todo : remove this let imagePath = isRemote ? join(cwd, path) : await getSrcPath(src); - + if(!existsSync(imagePath)) { + console.log("getProcessedImage::imagePath does not exist", imagePath); + return { + path, + base, + rest, + }; + } const imageBuffer = await fs.readFile(imagePath); - - const { image, imageWidth, imageHeight, imageFormat } = - await getImageDetails(imageBuffer, width, height, aspect, skipCache); + const { image, imageWidth, imageHeight, imageFormat } = await getImageDetails(imageBuffer, width, height, aspect); return { path, diff --git a/packages/imagetools_3/api/utils/getSrcset.js b/packages/imagetools_3/api/utils/getSrcset.js index 75f411d..a9337ed 100644 --- a/packages/imagetools_3/api/utils/getSrcset.js +++ b/packages/imagetools_3/api/utils/getSrcset.js @@ -27,9 +27,9 @@ export default async function getSrcset( : ""; const [cleanSrc] = src.split("?"); - const id = `${cleanSrc}?${params.slice(1)}`; - const fullPath = await getSrcPath(cleanSrc); + // @todo : remove this + const fullPath = await getSrcPath(id); const { default: load } = await import("../../plugin/hooks/load.js"); // @ts-ignore let srcset = null diff --git a/packages/imagetools_3/astroViteConfigs.js b/packages/imagetools_3/astroViteConfigs.js index af59ac4..8b2d327 100644 --- a/packages/imagetools_3/astroViteConfigs.js +++ b/packages/imagetools_3/astroViteConfigs.js @@ -1,12 +1,12 @@ export default { - "environment": "build", + "environment": "dev", "isSsrBuild": false, "projectBase": "", - "publicDir": "C:\\Users\\zx\\Desktop\\polymech\\site-min\\public\\", - "rootDir": "C:\\Users\\zx\\Desktop\\polymech\\site-min\\", - "mode": "production", - "outDir": "C:\\Users\\zx\\Desktop\\polymech\\site-min\\dist\\", - "assetsDir": "_astro", + "publicDir": "C:\\Users\\zx\\Desktop\\polymech\\site2\\public\\", + "rootDir": "C:\\Users\\zx\\Desktop\\polymech\\site2\\", + "mode": "dev", + "outDir": "dist", + "assetsDir": "/_astro", "sourcemap": false, "assetFileNames": "/_astro/[name]@[width].[hash][extname]" } \ No newline at end of file diff --git a/packages/imagetools_3/components/Img.astro b/packages/imagetools_3/components/Img.astro index 36c03ab..53cc055 100644 --- a/packages/imagetools_3/components/Img.astro +++ b/packages/imagetools_3/components/Img.astro @@ -2,9 +2,18 @@ import renderImg from "../api/renderImg.js"; import type { ImgConfigOptions } from "../types.d"; -declare interface Props extends ImgConfigOptions {} +declare interface Props extends ImgConfigOptions { + s?: string; +} -const { link, style, img } = await renderImg(Astro.props as Props); +const { s, ...rest } = Astro.props as Props; + +if (s) { + const separator = rest.src.includes("?") ? "&" : "?"; + rest.src = `${rest.src}${separator}s=${s}`; +} + +const { link, style, img } = await renderImg(rest); --- diff --git a/packages/imagetools_3/integration/index.js b/packages/imagetools_3/integration/index.js index 5f0cc1a..a20b4f2 100644 --- a/packages/imagetools_3/integration/index.js +++ b/packages/imagetools_3/integration/index.js @@ -55,11 +55,11 @@ export default { ); const { mode, outDir, assetsDir, isSsrBuild } = astroViteConfigs; - + if (mode === "production") { // 1. Define the manifest path in the current working directory. const manifestPath = path.join(process.cwd(), "./imagetools-manifest.json") - + // 2. Read the manifest from the previous build, if it exists. let previousAssets = new Map(); @@ -78,7 +78,7 @@ export default { // 4. Merge previous and current assets. Current assets overwrite previous ones. const allAssets = new Map([...previousAssets, ...currentAssets]); logger.info(`[imagetools] Replaying ${allAssets.size} image(s) from the persistent manifest.`); - if(allAssets.size === 0) { + if (allAssets.size === 0) { logger.info('[imagetools] No images to process.'); console.timeEnd('[imagetools] build:done'); return; @@ -88,6 +88,7 @@ export default { await pMap( [...allAssets.entries()], async ([assetPath, { hash, image, buffer }]) => { + logger.info(`[imagetools] Processing image ${assetPath}...`); try { await saveAndCopyAsset( hash, @@ -103,7 +104,7 @@ export default { } }, // higher concurrency causes sharp/vips errors as well - { concurrency: 1 } + { concurrency: 10 } ); // 6. Write the updated asset list back to the manifest for the next build. @@ -116,11 +117,11 @@ export default { return [key, { hash, buffer }]; } ); - - const manifestContent = JSON.stringify(serializableAssets,null,2); + + const manifestContent = JSON.stringify(serializableAssets, null, 2); logger.info(`[imagetools] Writing manifest (${(manifestContent.length / 1024).toFixed(2)} KB)...`); console.time('[imagetools] Manifest write took'); - await writeFile(manifestPath, manifestContent); + await writeFile(manifestPath, manifestContent); console.timeEnd('[imagetools] Manifest write took'); } catch (error) { logger.error("Failed to write the asset manifest."); diff --git a/packages/imagetools_3/package.json b/packages/imagetools_3/package.json index 5919f56..d452f47 100644 --- a/packages/imagetools_3/package.json +++ b/packages/imagetools_3/package.json @@ -14,8 +14,7 @@ "scripts": { "test:watch": "vitest", "test": "vitest run", - "test:src": "vitest run tests/src.js", - "test:image": "vitest run tests/image.js" + "test:src": "vitest run tests/src.js" }, "repository": { "type": "git", diff --git a/packages/imagetools_3/plugin/hooks/load.js b/packages/imagetools_3/plugin/hooks/load.js index a50f8c8..9bda1d4 100644 --- a/packages/imagetools_3/plugin/hooks/load.js +++ b/packages/imagetools_3/plugin/hooks/load.js @@ -106,6 +106,7 @@ export default async function load(id) { config, type, }) + const dataUri = `data:${type};base64,${( buffer || (await getCachedBuffer(hash, image)) ).toString("base64")}` diff --git a/packages/imagetools_3/plugin/utils/cache.js b/packages/imagetools_3/plugin/utils/cache.js index d99269a..5a4f2df 100644 --- a/packages/imagetools_3/plugin/utils/cache.js +++ b/packages/imagetools_3/plugin/utils/cache.js @@ -8,7 +8,6 @@ export async function getCachedBuffer(hash, image) { return fs.promises.readFile(cacheFilePath); } const buffer = await image.clone().toBuffer(); - console.log(`write ${cacheFilePath}`); await fs.promises.writeFile(cacheFilePath, buffer); return buffer; } diff --git a/packages/imagetools_3/utils/runtimeChecks.js b/packages/imagetools_3/utils/runtimeChecks.js index 4de890f..ae71025 100644 --- a/packages/imagetools_3/utils/runtimeChecks.js +++ b/packages/imagetools_3/utils/runtimeChecks.js @@ -85,12 +85,17 @@ fs.existsSync(fsCachePath) || fs.mkdirSync(fsCachePath, { recursive: true }); const cache_dir = () => { if (!GlobalConfigOptions.cacheRoot) return false; - const dir = path.resolve(resolve(GlobalConfigOptions.cacheRoot, false, { - "POLYMECH-CACHE": get_var("POLYMECH-CACHE") - })) - if (!exists(dir)) { - mkdir(dir); - } + let dir; + if (!exists(GlobalConfigOptions.cacheRoot)) { + dir = path.resolve(resolve(GlobalConfigOptions.cacheRoot, false, { + "POLYMECH-CACHE": get_var("POLYMECH-CACHE") + })) + if (!exists(dir)) { + mkdir(dir); + } + }else{ + dir = GlobalConfigOptions.cacheRoot + } return dir + "/"; } // @todo : cache dir diff --git a/packages/polymech/package.json b/packages/polymech/package.json index b212c98..69cb750 100644 --- a/packages/polymech/package.json +++ b/packages/polymech/package.json @@ -12,6 +12,7 @@ "./base/*": "./dist/base/*", "./model/*": "./dist/model/*", "./config/*": "./dist/config/*", + "./utils/*": "./dist/utils/*", "./pages/*": "./src/pages/*", "./routes/*": "./src/routes/*", "./components/*": "./src/components/*", diff --git a/packages/polymech/src/base/collections.ts b/packages/polymech/src/base/collections.ts index 2216ef4..ae87234 100644 --- a/packages/polymech/src/base/collections.ts +++ b/packages/polymech/src/base/collections.ts @@ -491,7 +491,7 @@ export async function generateBreadcrumbs( const segmentPath = arr.slice(0, index + 1).join('/'); const label = segment .split('-') - .map(word => word.charAt(0).toUpperCase() + word.slice(1)) + .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) .join(' '); breadcrumbs.push({ diff --git a/packages/polymech/src/components/Breadcrumb.astro b/packages/polymech/src/components/Breadcrumb.astro index 8db634b..c1bb8c4 100644 --- a/packages/polymech/src/components/Breadcrumb.astro +++ b/packages/polymech/src/components/Breadcrumb.astro @@ -34,7 +34,7 @@ function generateBreadcrumbs(path: string, collection: string, pageTitle?: strin // Format segment label let label = segment .split('-') - .map(word => word.charAt(0).toUpperCase() + word.slice(1)) + .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) .join(' '); // Use page title for the last segment if provided diff --git a/packages/polymech/src/components/GalleryK.astro b/packages/polymech/src/components/GalleryK.astro index 8431075..166f55c 100644 --- a/packages/polymech/src/components/GalleryK.astro +++ b/packages/polymech/src/components/GalleryK.astro @@ -1,5 +1,5 @@ --- -import { Img, Picture } from "imagetools/components"; +import { Img } from "imagetools/components"; import Translate from "./i18n.astro" import { translate } from "@/base/i18n"; @@ -46,7 +46,7 @@ const mergedLightboxSettings = { SHOW_DESCRIPTION: lightboxSettings.SHOW_DESCRIPTION ?? IMAGE_SETTINGS.LIGHTBOX.SHOW_DESCRIPTION, }; const locale = Astro.currentLocale || "en"; - +console.log(`LGallery Images`, images) ---