Files
dealplustech/node_modules/astro/dist/assets/fonts/providers/local.js
Kunthawat 5171a789e9 fix: Final restoration with port 80
 COMPLETED:
1. Dockerfile uses port 80 (astro preview)
2. BaseLayout imports globals.css
3. globals.css with Tailwind v4 @theme syntax
4. index.astro has Header, Footer, FixedContact
5. All image references fixed to existing files
6. Hero uses hdpe_pipe_main.jpg
7. Product cards use hdpe001.jpg
8. pt-20 on main for fixed header

 TESTED LOCALLY:
- Build: 15 pages in 1.27s
- Docker build successful
- Port 80 working
- Images load
- CSS works

Ready for Easypanel deployment.
2026-03-12 08:58:56 +07:00

70 lines
2.1 KiB
JavaScript

import { createRequire } from "node:module";
import { fileURLToPath, pathToFileURL } from "node:url";
class LocalFontProvider {
name = "local";
config;
#fontFileReader;
#root;
constructor({
fontFileReader
}) {
this.config = void 0;
this.#fontFileReader = fontFileReader;
this.#root = void 0;
}
init(context) {
this.#root = context.root;
}
#resolveEntrypoint(root, entrypoint) {
const require2 = createRequire(root);
try {
return pathToFileURL(require2.resolve(entrypoint));
} catch {
return new URL(entrypoint, root);
}
}
#normalizeSource(value) {
const isValue = typeof value === "string" || value instanceof URL;
const url = (isValue ? value : value.url).toString();
const tech = isValue ? void 0 : value.tech;
return {
url: fileURLToPath(this.#resolveEntrypoint(this.#root ?? new URL(import.meta.url), url)),
tech
};
}
resolveFont(options) {
return {
fonts: options.options?.variants.map((variant) => {
const shouldInfer = variant.weight === void 0 || variant.style === void 0;
const data = {
// If it should be inferred, we don't want to set the value
weight: variant.weight,
style: variant.style,
src: [],
unicodeRange: variant.unicodeRange,
display: variant.display,
stretch: variant.stretch,
featureSettings: variant.featureSettings,
variationSettings: variant.variationSettings
};
data.src = variant.src.map((rawSource, index) => {
const source = this.#normalizeSource(rawSource);
if (shouldInfer && index === 0) {
const result = this.#fontFileReader.extract({
family: options.familyName,
url: source.url
});
if (variant.weight === void 0) data.weight = result.weight;
if (variant.style === void 0) data.style = result.style;
}
return source;
});
return data;
}) ?? []
};
}
}
export {
LocalFontProvider
};