ccgauge 1.1.0 → 1.1.2
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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-build-manifest.json +42 -42
- package/.next/standalone/.next/app-path-routes-manifest.json +6 -6
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/blocks/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/export/usage/route.js +1 -1
- package/.next/standalone/.next/server/app/api/export/usage/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/scan/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/usage/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/models/page.js +1 -1
- package/.next/standalone/.next/server/app/models/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/page.js +2 -2
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page.js +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/sessions/page.js +1 -1
- package/.next/standalone/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page.js +2 -2
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/usage/page.js +1 -1
- package/.next/standalone/.next/server/app/usage/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +6 -6
- package/.next/standalone/.next/server/chunks/125.js +1 -1
- package/.next/standalone/.next/server/chunks/567.js +3 -3
- package/.next/standalone/.next/server/chunks/716.js +1 -1
- package/.next/standalone/.next/server/chunks/98.js +1 -1
- package/.next/standalone/.next/server/functions-config-manifest.json +1 -1
- package/.next/standalone/.next/server/middleware-manifest.json +5 -5
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/148-edf90b0918345dc2.js +1 -0
- package/.next/standalone/.next/static/chunks/app/layout-af71188a257674b5.js +1 -0
- package/.next/standalone/.next/static/chunks/app/page-1a147d12fca0b184.js +1 -0
- package/.next/standalone/.next/static/chunks/app/usage/{page-7fcc2a2d931307d5.js → page-051223f62647aadc.js} +1 -1
- package/.next/standalone/.next/static/css/fabb40b2545c70dd.css +5 -0
- package/.next/standalone/package.json +8 -2
- package/.next/standalone/public/codex-logo.webp +0 -0
- package/CHANGELOG.md +160 -0
- package/README.md +136 -384
- package/README.zh-CN.md +146 -398
- package/bin/cli.mjs +30 -190
- package/dist/mcp/server.mjs +11 -11
- package/dist/report/index.mjs +36 -3127
- package/package.json +8 -2
- package/.next/standalone/.next/static/chunks/148-f2cba0b76260b8d3.js +0 -1
- package/.next/standalone/.next/static/chunks/app/layout-0adb4fc0305adf29.js +0 -1
- package/.next/standalone/.next/static/chunks/app/page-3cda7f70ecf5017a.js +0 -1
- package/.next/standalone/.next/static/css/bde47638beb0c717.css +0 -3
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/constants.js +0 -10
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/fontkit/index.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/format-available-values.js +0 -9
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/fetch-css-from-google-fonts.js +0 -28
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/fetch-font-file.js +0 -24
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/fetch-resource.js +0 -46
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/find-font-files-in-css.js +0 -34
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/font-data.json +0 -17669
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-fallback-font-override-metrics.js +0 -62
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-font-axes.js +0 -66
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-google-fonts-url.js +0 -55
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-proxy-agent.js +0 -23
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/google-fonts-metadata.js +0 -8
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/loader.js +0 -175
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/retry.js +0 -18
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/sort-fonts-variant-values.js +0 -26
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/validate-google-font-function-call.js +0 -101
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/get-fallback-metrics-from-font-file.js +0 -85
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/loader.js +0 -78
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/pick-font-file-for-fallback-generation.js +0 -85
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/validate-local-font-function-call.js +0 -66
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/next-font-error.js +0 -11
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/google/loader.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/local/loader.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/amphtml-validator/index.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/amphtml-validator/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/amphtml-validator/validator_wasm.js +0 -2672
- package/.next/standalone/node_modules/next/dist/compiled/babel/bundle.js +0 -227
- package/.next/standalone/node_modules/next/dist/compiled/babel/code-frame.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-block-hoist-plugin.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-config.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-normalize-file.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-normalize-opts.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-plugin-pass.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/generator.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/parser.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/plugin-syntax-jsx.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/plugin-transform-define.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/plugin-transform-modules-commonjs.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/preset-typescript.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/traverse.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/types.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel-packages/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel-packages/packages-bundle.js +0 -335
- package/.next/standalone/node_modules/next/dist/server/capsize-font-metrics.json +0 -181516
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-darwin-arm64/LICENSE +0 -191
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-darwin-arm64/lib/sharp-darwin-arm64.node +0 -0
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-darwin-arm64/package.json +0 -40
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/lib/index.js +0 -1
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/lib/libvips-cpp.8.17.3.dylib +0 -0
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/package.json +0 -36
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/versions.json +0 -30
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/channel.js +0 -177
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/colour.js +0 -195
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/composite.js +0 -212
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/constructor.js +0 -499
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/index.js +0 -16
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/input.js +0 -809
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/is.js +0 -143
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/libvips.js +0 -207
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/operation.js +0 -1016
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/output.js +0 -1666
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/resize.js +0 -595
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/sharp.js +0 -121
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/utility.js +0 -291
- package/.next/standalone/node_modules/next/node_modules/sharp/package.json +0 -202
- package/.next/standalone/public/codex-logo.png +0 -0
- /package/.next/standalone/.next/static/{jncTEohJB76Iq9TUm3G21 → EQqRlXV5HyaCYSZWOVllH}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{jncTEohJB76Iq9TUm3G21 → EQqRlXV5HyaCYSZWOVllH}/_ssgManifest.js +0 -0
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
|
-
let fontFromBuffer;
|
|
6
|
-
try {
|
|
7
|
-
// eslint-disable-next-line @next/internal/typechecked-require -- Module created during build.
|
|
8
|
-
const mod = require('../fontkit').default;
|
|
9
|
-
fontFromBuffer = mod.default || mod;
|
|
10
|
-
}
|
|
11
|
-
catch { }
|
|
12
|
-
const util_1 = require("util");
|
|
13
|
-
const pick_font_file_for_fallback_generation_1 = require("./pick-font-file-for-fallback-generation");
|
|
14
|
-
const get_fallback_metrics_from_font_file_1 = require("./get-fallback-metrics-from-font-file");
|
|
15
|
-
const validate_local_font_function_call_1 = require("./validate-local-font-function-call");
|
|
16
|
-
const nextFontLocalFontLoader = async ({ functionName, variableName, data, emitFontFile, resolve, loaderContext, }) => {
|
|
17
|
-
const { src, display, fallback, preload, variable, adjustFontFallback, declarations, weight: defaultWeight, style: defaultStyle, } = (0, validate_local_font_function_call_1.validateLocalFontFunctionCall)(functionName, data[0]);
|
|
18
|
-
// Load all font files and emit them to the .next output directory
|
|
19
|
-
// Also generate a @font-face CSS for each font file
|
|
20
|
-
const fontFiles = await Promise.all(src.map(async ({ path, style, weight, ext, format }) => {
|
|
21
|
-
const resolved = await resolve(path);
|
|
22
|
-
const fileBuffer = await (0, util_1.promisify)(loaderContext.fs.readFile)(resolved);
|
|
23
|
-
const fontUrl = emitFontFile(fileBuffer, ext, preload, typeof adjustFontFallback === 'undefined' || !!adjustFontFallback);
|
|
24
|
-
// Try to load font metadata from the font file using fontkit.
|
|
25
|
-
// The data is used to calculate the fallback font override values.
|
|
26
|
-
let fontMetadata;
|
|
27
|
-
try {
|
|
28
|
-
fontMetadata = fontFromBuffer === null || fontFromBuffer === void 0 ? void 0 : fontFromBuffer(fileBuffer);
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
console.error(`Failed to load font file: ${resolved}\n${e}`);
|
|
32
|
-
}
|
|
33
|
-
// Check if `font-family` is explicitly defined in `declarations`
|
|
34
|
-
const hasCustomFontFamily = declarations === null || declarations === void 0 ? void 0 : declarations.some(({ prop }) => prop === 'font-family');
|
|
35
|
-
// Get all values that should be added to the @font-face declaration
|
|
36
|
-
const fontFaceProperties = [
|
|
37
|
-
...(declarations
|
|
38
|
-
? declarations.map(({ prop, value }) => [prop, value])
|
|
39
|
-
: []),
|
|
40
|
-
...(hasCustomFontFamily ? [] : [['font-family', variableName]]),
|
|
41
|
-
['src', `url(${fontUrl}) format('${format}')`],
|
|
42
|
-
['font-display', display],
|
|
43
|
-
...((weight !== null && weight !== void 0 ? weight : defaultWeight)
|
|
44
|
-
? [['font-weight', weight !== null && weight !== void 0 ? weight : defaultWeight]]
|
|
45
|
-
: []),
|
|
46
|
-
...((style !== null && style !== void 0 ? style : defaultStyle)
|
|
47
|
-
? [['font-style', style !== null && style !== void 0 ? style : defaultStyle]]
|
|
48
|
-
: []),
|
|
49
|
-
];
|
|
50
|
-
// Generate the @font-face CSS from the font-face properties
|
|
51
|
-
const css = `@font-face {\n${fontFaceProperties
|
|
52
|
-
.map(([property, value]) => `${property}: ${value};`)
|
|
53
|
-
.join('\n')}\n}\n`;
|
|
54
|
-
return {
|
|
55
|
-
css,
|
|
56
|
-
fontMetadata,
|
|
57
|
-
weight,
|
|
58
|
-
style,
|
|
59
|
-
};
|
|
60
|
-
}));
|
|
61
|
-
// Calculate the fallback font override values using the font file metadata
|
|
62
|
-
let adjustFontFallbackMetrics;
|
|
63
|
-
if (adjustFontFallback !== false) {
|
|
64
|
-
const fallbackFontFile = (0, pick_font_file_for_fallback_generation_1.pickFontFileForFallbackGeneration)(fontFiles);
|
|
65
|
-
if (fallbackFontFile.fontMetadata) {
|
|
66
|
-
adjustFontFallbackMetrics = (0, get_fallback_metrics_from_font_file_1.getFallbackMetricsFromFontFile)(fallbackFontFile.fontMetadata, adjustFontFallback === 'Times New Roman' ? 'serif' : 'sans-serif');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
css: fontFiles.map(({ css }) => css).join('\n'),
|
|
71
|
-
fallbackFonts: fallback,
|
|
72
|
-
weight: src.length === 1 ? src[0].weight : undefined,
|
|
73
|
-
style: src.length === 1 ? src[0].style : undefined,
|
|
74
|
-
variable,
|
|
75
|
-
adjustFontFallback: adjustFontFallbackMetrics,
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
exports.default = nextFontLocalFontLoader;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pickFontFileForFallbackGeneration = pickFontFileForFallbackGeneration;
|
|
4
|
-
const next_font_error_1 = require("../next-font-error");
|
|
5
|
-
const NORMAL_WEIGHT = 400;
|
|
6
|
-
const BOLD_WEIGHT = 700;
|
|
7
|
-
/**
|
|
8
|
-
* Convert the weight string to a number so it can be used for comparison.
|
|
9
|
-
* Weights can be defined as a number, 'normal' or 'bold'. https://developer.mozilla.org/docs/Web/CSS/@font-face/font-weight
|
|
10
|
-
*/
|
|
11
|
-
function getWeightNumber(weight) {
|
|
12
|
-
return weight === 'normal'
|
|
13
|
-
? NORMAL_WEIGHT
|
|
14
|
-
: weight === 'bold'
|
|
15
|
-
? BOLD_WEIGHT
|
|
16
|
-
: Number(weight);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Get the distance from normal (400) weight for the provided weight.
|
|
20
|
-
* If it's not a variable font we can just return the distance.
|
|
21
|
-
* If it's a variable font we need to compare its weight range to 400.
|
|
22
|
-
*/
|
|
23
|
-
function getDistanceFromNormalWeight(weight) {
|
|
24
|
-
if (!weight)
|
|
25
|
-
return 0;
|
|
26
|
-
// If it's a variable font the weight is defined with two numbers "100 900", rather than just one "400"
|
|
27
|
-
const [firstWeight, secondWeight] = weight
|
|
28
|
-
.trim()
|
|
29
|
-
.split(/ +/)
|
|
30
|
-
.map(getWeightNumber);
|
|
31
|
-
if (Number.isNaN(firstWeight) || Number.isNaN(secondWeight)) {
|
|
32
|
-
(0, next_font_error_1.nextFontError)(`Invalid weight value in src array: \`${weight}\`.\nExpected \`normal\`, \`bold\` or a number.`);
|
|
33
|
-
}
|
|
34
|
-
// If the weight doesn't have have a second value, it's not a variable font
|
|
35
|
-
// If that's the case, just return the distance from normal weight
|
|
36
|
-
if (!secondWeight) {
|
|
37
|
-
return firstWeight - NORMAL_WEIGHT;
|
|
38
|
-
}
|
|
39
|
-
// Normal weight is within variable font range
|
|
40
|
-
if (firstWeight <= NORMAL_WEIGHT && secondWeight >= NORMAL_WEIGHT) {
|
|
41
|
-
return 0;
|
|
42
|
-
}
|
|
43
|
-
// Normal weight is outside variable font range
|
|
44
|
-
// Return the distance of normal weight to the variable font range
|
|
45
|
-
const firstWeightDistance = firstWeight - NORMAL_WEIGHT;
|
|
46
|
-
const secondWeightDistance = secondWeight - NORMAL_WEIGHT;
|
|
47
|
-
if (Math.abs(firstWeightDistance) < Math.abs(secondWeightDistance)) {
|
|
48
|
-
return firstWeightDistance;
|
|
49
|
-
}
|
|
50
|
-
return secondWeightDistance;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* If multiple font files are provided for a font family, we need to pick one to use for the automatic fallback generation.
|
|
54
|
-
* This function returns the font file that is most likely to be used for the bulk of the text on a page.
|
|
55
|
-
*
|
|
56
|
-
* There are some assumptions here about the text on a page when picking the font file:
|
|
57
|
-
* - Most of the text will have normal weight, use the one closest to 400
|
|
58
|
-
* - Most of the text will have normal style, prefer normal over italic
|
|
59
|
-
* - If two font files have the same distance from normal weight, the thinner one will most likely be the bulk of the text
|
|
60
|
-
*/
|
|
61
|
-
function pickFontFileForFallbackGeneration(fontFiles) {
|
|
62
|
-
return fontFiles.reduce((usedFontFile, currentFontFile) => {
|
|
63
|
-
if (!usedFontFile)
|
|
64
|
-
return currentFontFile;
|
|
65
|
-
const usedFontDistance = getDistanceFromNormalWeight(usedFontFile.weight);
|
|
66
|
-
const currentFontDistance = getDistanceFromNormalWeight(currentFontFile.weight);
|
|
67
|
-
// Prefer normal style if they have the same weight
|
|
68
|
-
if (usedFontDistance === currentFontDistance &&
|
|
69
|
-
(typeof currentFontFile.style === 'undefined' ||
|
|
70
|
-
currentFontFile.style === 'normal')) {
|
|
71
|
-
return currentFontFile;
|
|
72
|
-
}
|
|
73
|
-
const absUsedDistance = Math.abs(usedFontDistance);
|
|
74
|
-
const absCurrentDistance = Math.abs(currentFontDistance);
|
|
75
|
-
// Use closest absolute distance to normal weight
|
|
76
|
-
if (absCurrentDistance < absUsedDistance)
|
|
77
|
-
return currentFontFile;
|
|
78
|
-
// Prefer the thinner font if both have the same absolute distance from normal weight
|
|
79
|
-
if (absUsedDistance === absCurrentDistance &&
|
|
80
|
-
currentFontDistance < usedFontDistance) {
|
|
81
|
-
return currentFontFile;
|
|
82
|
-
}
|
|
83
|
-
return usedFontFile;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateLocalFontFunctionCall = validateLocalFontFunctionCall;
|
|
4
|
-
const constants_1 = require("../constants");
|
|
5
|
-
const format_available_values_1 = require("../format-available-values");
|
|
6
|
-
const next_font_error_1 = require("../next-font-error");
|
|
7
|
-
const extToFormat = {
|
|
8
|
-
woff: 'woff',
|
|
9
|
-
woff2: 'woff2',
|
|
10
|
-
ttf: 'truetype',
|
|
11
|
-
otf: 'opentype',
|
|
12
|
-
eot: 'embedded-opentype',
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Validate the data received from next-swc next-transform-font on next/font/local calls
|
|
16
|
-
*/
|
|
17
|
-
function validateLocalFontFunctionCall(functionName, fontData) {
|
|
18
|
-
if (functionName) {
|
|
19
|
-
(0, next_font_error_1.nextFontError)(`next/font/local has no named exports`);
|
|
20
|
-
}
|
|
21
|
-
let { src, display = 'swap', weight, style, fallback, preload = true, variable, adjustFontFallback, declarations, } = fontData || {};
|
|
22
|
-
if (!constants_1.allowedDisplayValues.includes(display)) {
|
|
23
|
-
(0, next_font_error_1.nextFontError)(`Invalid display value \`${display}\`.\nAvailable display values: ${(0, format_available_values_1.formatAvailableValues)(constants_1.allowedDisplayValues)}`);
|
|
24
|
-
}
|
|
25
|
-
if (!src) {
|
|
26
|
-
(0, next_font_error_1.nextFontError)('Missing required `src` property');
|
|
27
|
-
}
|
|
28
|
-
if (!Array.isArray(src)) {
|
|
29
|
-
src = [{ path: src, weight, style }];
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
if (src.length === 0) {
|
|
33
|
-
(0, next_font_error_1.nextFontError)('Unexpected empty `src` array.');
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
src = src.map((fontFile) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const ext = (_a = /\.(woff|woff2|eot|ttf|otf)$/.exec(fontFile.path)) === null || _a === void 0 ? void 0 : _a[1];
|
|
39
|
-
if (!ext) {
|
|
40
|
-
(0, next_font_error_1.nextFontError)(`Unexpected file \`${fontFile.path}\``);
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
...fontFile,
|
|
44
|
-
ext,
|
|
45
|
-
format: extToFormat[ext],
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
if (Array.isArray(declarations)) {
|
|
49
|
-
declarations.forEach((declaration) => {
|
|
50
|
-
if (['src', 'font-display', 'font-weight', 'font-style'].includes(declaration === null || declaration === void 0 ? void 0 : declaration.prop)) {
|
|
51
|
-
(0, next_font_error_1.nextFontError)(`Invalid declaration prop: \`${declaration.prop}\``);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
src,
|
|
57
|
-
display,
|
|
58
|
-
weight,
|
|
59
|
-
style,
|
|
60
|
-
fallback,
|
|
61
|
-
preload,
|
|
62
|
-
variable,
|
|
63
|
-
adjustFontFallback,
|
|
64
|
-
declarations,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nextFontError = nextFontError;
|
|
4
|
-
/**
|
|
5
|
-
* Throw NextFontError error. Used by the WellKnownErrorsPlugin to format errors thrown by next/font.
|
|
6
|
-
*/
|
|
7
|
-
function nextFontError(message) {
|
|
8
|
-
const err = new Error(message);
|
|
9
|
-
err.name = 'NextFontError';
|
|
10
|
-
throw err;
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('../dist/google/loader')
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('../dist/local/loader')
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"name":"@next/font","license":"MIT","types":"dist/types.d.ts"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{var e={873:(e,r,t)=>{"use strict";var n=t(742);var o=[];e.exports=asap;function asap(e){var r;if(o.length){r=o.pop()}else{r=new RawTask}r.task=e;r.domain=process.domain;n(r)}function RawTask(){this.task=null;this.domain=null}RawTask.prototype.call=function(){if(this.domain){this.domain.enter()}var e=true;try{this.task.call();e=false;if(this.domain){this.domain.exit()}}finally{if(e){n.requestFlush()}this.task=null;this.domain=null;o.push(this)}}},742:(e,r,t)=>{"use strict";var n;var o=typeof setImmediate==="function";e.exports=rawAsap;function rawAsap(e){if(!i.length){requestFlush();s=true}i[i.length]=e}var i=[];var s=false;var a=0;var u=1024;function flush(){while(a<i.length){var e=a;a=a+1;i[e].call();if(a>u){for(var r=0,t=i.length-a;r<t;r++){i[r]=i[r+a]}i.length-=a;a=0}}i.length=0;a=0;s=false}rawAsap.requestFlush=requestFlush;function requestFlush(){var e=process.domain;if(e){if(!n){n=t(639)}n.active=process.domain=null}if(s&&o){setImmediate(flush)}else{process.nextTick(flush)}if(e){n.active=process.domain=e}}},758:(e,r,t)=>{var n={};e["exports"]=n;n.themes={};var o=t(837);var i=n.styles=t(77);var s=Object.defineProperties;var a=new RegExp(/[\r\n]+/g);n.supportsColor=t(725).supportsColor;if(typeof n.enabled==="undefined"){n.enabled=n.supportsColor()!==false}n.enable=function(){n.enabled=true};n.disable=function(){n.enabled=false};n.stripColors=n.strip=function(e){return(""+e).replace(/\x1B\[\d+m/g,"")};var u=n.stylize=function stylize(e,r){if(!n.enabled){return e+""}var t=i[r];if(!t&&r in n){return n[r](e)}return t.open+e+t.close};var l=/[|\\{}()[\]^$+*?.]/g;var escapeStringRegexp=function(e){if(typeof e!=="string"){throw new TypeError("Expected a string")}return e.replace(l,"\\$&")};function build(e){var r=function builder(){return applyStyle.apply(builder,arguments)};r._styles=e;r.__proto__=c;return r}var f=function(){var e={};i.grey=i.gray;Object.keys(i).forEach((function(r){i[r].closeRe=new RegExp(escapeStringRegexp(i[r].close),"g");e[r]={get:function(){return build(this._styles.concat(r))}}}));return e}();var c=s((function colors(){}),f);function applyStyle(){var e=Array.prototype.slice.call(arguments);var r=e.map((function(e){if(e!=null&&e.constructor===String){return e}else{return o.inspect(e)}})).join(" ");if(!n.enabled||!r){return r}var t=r.indexOf("\n")!=-1;var s=this._styles;var u=s.length;while(u--){var l=i[s[u]];r=l.open+r.replace(l.closeRe,l.open)+l.close;if(t){r=r.replace(a,(function(e){return l.close+e+l.open}))}}return r}n.setTheme=function(e){if(typeof e==="string"){console.log("colors.setTheme now only accepts an object, not a string. "+"If you are trying to set a theme from a file, it is now your (the "+"caller's) responsibility to require the file. The old syntax "+"looked like colors.setTheme(__dirname + "+"'/../themes/generic-logging.js'); The new syntax looks like "+"colors.setTheme(require(__dirname + "+"'/../themes/generic-logging.js'));");return}for(var r in e){(function(r){n[r]=function(t){if(typeof e[r]==="object"){var o=t;for(var i in e[r]){o=n[e[r][i]](o)}return o}return n[e[r]](t)}})(r)}};function init(){var e={};Object.keys(f).forEach((function(r){e[r]={get:function(){return build([r])}}}));return e}var p=function sequencer(e,r){var t=r.split("");t=t.map(e);return t.join("")};n.trap=t(822);n.zalgo=t(576);n.maps={};n.maps.america=t(967)(n);n.maps.zebra=t(917)(n);n.maps.rainbow=t(410)(n);n.maps.random=t(409)(n);for(var d in n.maps){(function(e){n[e]=function(r){return p(n.maps[e],r)}})(d)}s(n,init())},822:e=>{e["exports"]=function runTheTrap(e,r){var t="";e=e||"Run the trap, drop the bass";e=e.split("");var n={a:["@","Ą","Ⱥ","Ʌ","Δ","Λ","Д"],b:["ß","Ɓ","Ƀ","ɮ","β","฿"],c:["©","Ȼ","Ͼ"],d:["Ð","Ɗ","Ԁ","ԁ","Ԃ","ԃ"],e:["Ë","ĕ","Ǝ","ɘ","Σ","ξ","Ҽ","੬"],f:["Ӻ"],g:["ɢ"],h:["Ħ","ƕ","Ң","Һ","Ӈ","Ԋ"],i:["༏"],j:["Ĵ"],k:["ĸ","Ҡ","Ӄ","Ԟ"],l:["Ĺ"],m:["ʍ","Ӎ","ӎ","Ԡ","ԡ","൩"],n:["Ñ","ŋ","Ɲ","Ͷ","Π","Ҋ"],o:["Ø","õ","ø","Ǿ","ʘ","Ѻ","ם","","๏"],p:["Ƿ","Ҏ"],q:["্"],r:["®","Ʀ","Ȑ","Ɍ","ʀ","Я"],s:["§","Ϟ","ϟ","Ϩ"],t:["Ł","Ŧ","ͳ"],u:["Ʊ","Ս"],v:["ט"],w:["Ш","Ѡ","Ѽ","൰"],x:["Ҳ","Ӿ","Ӽ","ӽ"],y:["¥","Ұ","Ӌ"],z:["Ƶ","ɀ"]};e.forEach((function(e){e=e.toLowerCase();var r=n[e]||[" "];var o=Math.floor(Math.random()*r.length);if(typeof n[e]!=="undefined"){t+=n[e][o]}else{t+=e}}));return t}},576:e=>{e["exports"]=function zalgo(e,r){e=e||" he is here ";var t={up:["̍","̎","̄","̅","̿","̑","̆","̐","͒","͗","͑","̇","̈","̊","͂","̓","̈","͊","͋","͌","̃","̂","̌","͐","̀","́","̋","̏","̒","̓","̔","̽","̉","ͣ","ͤ","ͥ","ͦ","ͧ","ͨ","ͩ","ͪ","ͫ","ͬ","ͭ","ͮ","ͯ","̾","͛","͆","̚"],down:["̖","̗","̘","̙","̜","̝","̞","̟","̠","̤","̥","̦","̩","̪","̫","̬","̭","̮","̯","̰","̱","̲","̳","̹","̺","̻","̼","ͅ","͇","͈","͉","͍","͎","͓","͔","͕","͖","͙","͚","̣"],mid:["̕","̛","̀","́","͘","̡","̢","̧","̨","̴","̵","̶","͜","͝","͞","͟","͠","͢","̸","̷","͡"," ҉"]};var n=[].concat(t.up,t.down,t.mid);function randomNumber(e){var r=Math.floor(Math.random()*e);return r}function isChar(e){var r=false;n.filter((function(t){r=t===e}));return r}function heComes(e,r){var n="";var o;var i;r=r||{};r["up"]=typeof r["up"]!=="undefined"?r["up"]:true;r["mid"]=typeof r["mid"]!=="undefined"?r["mid"]:true;r["down"]=typeof r["down"]!=="undefined"?r["down"]:true;r["size"]=typeof r["size"]!=="undefined"?r["size"]:"maxi";e=e.split("");for(i in e){if(isChar(i)){continue}n=n+e[i];o={up:0,down:0,mid:0};switch(r.size){case"mini":o.up=randomNumber(8);o.mid=randomNumber(2);o.down=randomNumber(8);break;case"maxi":o.up=randomNumber(16)+3;o.mid=randomNumber(4)+1;o.down=randomNumber(64)+3;break;default:o.up=randomNumber(8)+1;o.mid=randomNumber(6)/2;o.down=randomNumber(8)+1;break}var s=["up","mid","down"];for(var a in s){var u=s[a];for(var l=0;l<=o[u];l++){if(r[u]){n=n+t[u][randomNumber(t[u].length)]}}}}return n}return heComes(e,r)}},967:e=>{e["exports"]=function(e){return function(r,t,n){if(r===" ")return r;switch(t%3){case 0:return e.red(r);case 1:return e.white(r);case 2:return e.blue(r)}}}},410:e=>{e["exports"]=function(e){var r=["red","yellow","green","blue","magenta"];return function(t,n,o){if(t===" "){return t}else{return e[r[n++%r.length]](t)}}}},409:e=>{e["exports"]=function(e){var r=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(t,n,o){return t===" "?t:e[r[Math.round(Math.random()*(r.length-2))]](t)}}},917:e=>{e["exports"]=function(e){return function(r,t,n){return t%2===0?r:e.inverse(r)}}},77:e=>{var r={};e["exports"]=r;var t={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(t).forEach((function(e){var n=t[e];var o=r[e]=[];o.open="["+n[0]+"m";o.close="["+n[1]+"m"}))},274:e=>{"use strict";e.exports=function(e,r){r=r||process.argv;var t=r.indexOf("--");var n=/^-{1,2}/.test(e)?"":"--";var o=r.indexOf(n+e);return o!==-1&&(t===-1?true:o<t)}},725:(e,r,t)=>{"use strict";var n=t(37);var o=t(274);var i=process.env;var s=void 0;if(o("no-color")||o("no-colors")||o("color=false")){s=false}else if(o("color")||o("colors")||o("color=true")||o("color=always")){s=true}if("FORCE_COLOR"in i){s=i.FORCE_COLOR.length===0||parseInt(i.FORCE_COLOR,10)!==0}function translateLevel(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function supportsColor(e){if(s===false){return 0}if(o("color=16m")||o("color=full")||o("color=truecolor")){return 3}if(o("color=256")){return 2}if(e&&!e.isTTY&&s!==true){return 0}var r=s?1:0;if(process.platform==="win32"){var t=n.release().split(".");if(Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586){return Number(t[2])>=14931?3:2}return 1}if("CI"in i){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((function(e){return e in i}))||i.CI_NAME==="codeship"){return 1}return r}if("TEAMCITY_VERSION"in i){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(i.TEAMCITY_VERSION)?1:0}if("TERM_PROGRAM"in i){var a=parseInt((i.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(i.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(i.TERM)){return 2}if(/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(i.TERM)){return 1}if("COLORTERM"in i){return 1}if(i.TERM==="dumb"){return r}return r}function getSupportLevel(e){var r=supportsColor(e);return translateLevel(r)}e.exports={supportsColor:getSupportLevel,stdout:getSupportLevel(process.stdout),stderr:getSupportLevel(process.stderr)}},915:(e,r,t)=>{var n=t(758);e["exports"]=n},356:(e,r,t)=>{"use strict";e.exports=t(730)},52:(e,r,t)=>{"use strict";var n=t(742);function noop(){}var o=null;var i={};function getThen(e){try{return e.then}catch(e){o=e;return i}}function tryCallOne(e,r){try{return e(r)}catch(e){o=e;return i}}function tryCallTwo(e,r,t){try{e(r,t)}catch(e){o=e;return i}}e.exports=Promise;function Promise(e){if(typeof this!=="object"){throw new TypeError("Promises must be constructed via new")}if(typeof e!=="function"){throw new TypeError("Promise constructor's argument is not a function")}this._x=0;this._y=0;this._z=null;this._A=null;if(e===noop)return;doResolve(e,this)}Promise._B=null;Promise._C=null;Promise._D=noop;Promise.prototype.then=function(e,r){if(this.constructor!==Promise){return safeThen(this,e,r)}var t=new Promise(noop);handle(this,new Handler(e,r,t));return t};function safeThen(e,r,t){return new e.constructor((function(n,o){var i=new Promise(noop);i.then(n,o);handle(e,new Handler(r,t,i))}))}function handle(e,r){while(e._y===3){e=e._z}if(Promise._B){Promise._B(e)}if(e._y===0){if(e._x===0){e._x=1;e._A=r;return}if(e._x===1){e._x=2;e._A=[e._A,r];return}e._A.push(r);return}handleResolved(e,r)}function handleResolved(e,r){n((function(){var t=e._y===1?r.onFulfilled:r.onRejected;if(t===null){if(e._y===1){resolve(r.promise,e._z)}else{reject(r.promise,e._z)}return}var n=tryCallOne(t,e._z);if(n===i){reject(r.promise,o)}else{resolve(r.promise,n)}}))}function resolve(e,r){if(r===e){return reject(e,new TypeError("A promise cannot be resolved with itself."))}if(r&&(typeof r==="object"||typeof r==="function")){var t=getThen(r);if(t===i){return reject(e,o)}if(t===e.then&&r instanceof Promise){e._y=3;e._z=r;finale(e);return}else if(typeof t==="function"){doResolve(t.bind(r),e);return}}e._y=1;e._z=r;finale(e)}function reject(e,r){e._y=2;e._z=r;if(Promise._C){Promise._C(e,r)}finale(e)}function finale(e){if(e._x===1){handle(e,e._A);e._A=null}if(e._x===2){for(var r=0;r<e._A.length;r++){handle(e,e._A[r])}e._A=null}}function Handler(e,r,t){this.onFulfilled=typeof e==="function"?e:null;this.onRejected=typeof r==="function"?r:null;this.promise=t}function doResolve(e,r){var t=false;var n=tryCallTwo(e,(function(e){if(t)return;t=true;resolve(r,e)}),(function(e){if(t)return;t=true;reject(r,e)}));if(!t&&n===i){t=true;reject(r,o)}}},941:(e,r,t)=>{"use strict";var n=t(52);e.exports=n;n.prototype.done=function(e,r){var t=arguments.length?this.then.apply(this,arguments):this;t.then(null,(function(e){setTimeout((function(){throw e}),0)}))}},751:(e,r,t)=>{"use strict";var n=t(52);e.exports=n;var o=valuePromise(true);var i=valuePromise(false);var s=valuePromise(null);var a=valuePromise(undefined);var u=valuePromise(0);var l=valuePromise("");function valuePromise(e){var r=new n(n._D);r._y=1;r._z=e;return r}n.resolve=function(e){if(e instanceof n)return e;if(e===null)return s;if(e===undefined)return a;if(e===true)return o;if(e===false)return i;if(e===0)return u;if(e==="")return l;if(typeof e==="object"||typeof e==="function"){try{var r=e.then;if(typeof r==="function"){return new n(r.bind(e))}}catch(e){return new n((function(r,t){t(e)}))}}return valuePromise(e)};var iterableToArray=function(e){if(typeof Array.from==="function"){iterableToArray=Array.from;return Array.from(e)}iterableToArray=function(e){return Array.prototype.slice.call(e)};return Array.prototype.slice.call(e)};n.all=function(e){var r=iterableToArray(e);return new n((function(e,t){if(r.length===0)return e([]);var o=r.length;function res(i,s){if(s&&(typeof s==="object"||typeof s==="function")){if(s instanceof n&&s.then===n.prototype.then){while(s._y===3){s=s._z}if(s._y===1)return res(i,s._z);if(s._y===2)t(s._z);s.then((function(e){res(i,e)}),t);return}else{var a=s.then;if(typeof a==="function"){var u=new n(a.bind(s));u.then((function(e){res(i,e)}),t);return}}}r[i]=s;if(--o===0){e(r)}}for(var i=0;i<r.length;i++){res(i,r[i])}}))};function onSettledFulfill(e){return{status:"fulfilled",value:e}}function onSettledReject(e){return{status:"rejected",reason:e}}function mapAllSettled(e){if(e&&(typeof e==="object"||typeof e==="function")){if(e instanceof n&&e.then===n.prototype.then){return e.then(onSettledFulfill,onSettledReject)}var r=e.then;if(typeof r==="function"){return new n(r.bind(e)).then(onSettledFulfill,onSettledReject)}}return onSettledFulfill(e)}n.allSettled=function(e){return n.all(iterableToArray(e).map(mapAllSettled))};n.reject=function(e){return new n((function(r,t){t(e)}))};n.race=function(e){return new n((function(r,t){iterableToArray(e).forEach((function(e){n.resolve(e).then(r,t)}))}))};n.prototype["catch"]=function(e){return this.then(null,e)};function getAggregateError(e){if(typeof AggregateError==="function"){return new AggregateError(e,"All promises were rejected")}var r=new Error("All promises were rejected");r.name="AggregateError";r.errors=e;return r}n.any=function promiseAny(e){return new n((function(r,t){var o=iterableToArray(e);var i=false;var s=[];function resolveOnce(e){if(!i){i=true;r(e)}}function rejectionCheck(e){s.push(e);if(s.length===o.length){t(getAggregateError(s))}}if(o.length===0){t(getAggregateError(s))}else{o.forEach((function(e){n.resolve(e).then(resolveOnce,rejectionCheck)}))}}))}},419:(e,r,t)=>{"use strict";var n=t(52);e.exports=n;n.prototype.finally=function(e){return this.then((function(r){return n.resolve(e()).then((function(){return r}))}),(function(r){return n.resolve(e()).then((function(){throw r}))}))}},730:(e,r,t)=>{"use strict";e.exports=t(52);t(941);t(419);t(751);t(247);t(611)},247:(e,r,t)=>{"use strict";var n=t(52);var o=t(873);e.exports=n;n.denodeify=function(e,r){if(typeof r==="number"&&r!==Infinity){return denodeifyWithCount(e,r)}else{return denodeifyWithoutCount(e)}};var i="function (err, res) {"+"if (err) { rj(err); } else { rs(res); }"+"}";function denodeifyWithCount(e,r){var t=[];for(var o=0;o<r;o++){t.push("a"+o)}var s=["return function ("+t.join(",")+") {","var self = this;","return new Promise(function (rs, rj) {","var res = fn.call(",["self"].concat(t).concat([i]).join(","),");","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],s)(n,e)}function denodeifyWithoutCount(e){var r=Math.max(e.length-1,3);var t=[];for(var o=0;o<r;o++){t.push("a"+o)}var s=["return function ("+t.join(",")+") {","var self = this;","var args;","var argLength = arguments.length;","if (arguments.length > "+r+") {","args = new Array(arguments.length + 1);","for (var i = 0; i < arguments.length; i++) {","args[i] = arguments[i];","}","}","return new Promise(function (rs, rj) {","var cb = "+i+";","var res;","switch (argLength) {",t.concat(["extra"]).map((function(e,r){return"case "+r+":"+"res = fn.call("+["self"].concat(t.slice(0,r)).concat("cb").join(",")+");"+"break;"})).join(""),"default:","args[argLength] = cb;","res = fn.apply(self, args);","}","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],s)(n,e)}n.nodeify=function(e){return function(){var r=Array.prototype.slice.call(arguments);var t=typeof r[r.length-1]==="function"?r.pop():null;var i=this;try{return e.apply(this,arguments).nodeify(t,i)}catch(e){if(t===null||typeof t=="undefined"){return new n((function(r,t){t(e)}))}else{o((function(){t.call(i,e)}))}}}};n.prototype.nodeify=function(e,r){if(typeof e!="function")return this;this.then((function(t){o((function(){e.call(r,null,t)}))}),(function(t){o((function(){e.call(r,t)}))}))}},611:(e,r,t)=>{"use strict";var n=t(52);e.exports=n;n.enableSynchronous=function(){n.prototype.isPending=function(){return this.getState()==0};n.prototype.isFulfilled=function(){return this.getState()==1};n.prototype.isRejected=function(){return this.getState()==2};n.prototype.getValue=function(){if(this._y===3){return this._z.getValue()}if(!this.isFulfilled()){throw new Error("Cannot get a value of an unfulfilled promise.")}return this._z};n.prototype.getReason=function(){if(this._y===3){return this._z.getReason()}if(!this.isRejected()){throw new Error("Cannot get a rejection reason of a non-rejected promise.")}return this._z};n.prototype.getState=function(){if(this._y===3){return this._z.getState()}if(this._y===-1||this._y===-2){return 0}return this._y}};n.disableSynchronous=function(){n.prototype.isPending=undefined;n.prototype.isFulfilled=undefined;n.prototype.isRejected=undefined;n.prototype.getValue=undefined;n.prototype.getReason=undefined;n.prototype.getState=undefined}},639:e=>{"use strict";e.exports=require("domain")},147:e=>{"use strict";e.exports=require("fs")},685:e=>{"use strict";e.exports=require("http")},687:e=>{"use strict";e.exports=require("https")},318:e=>{"use strict";e.exports=require("next/dist/compiled/commander")},37:e=>{"use strict";e.exports=require("os")},17:e=>{"use strict";e.exports=require("path")},837:e=>{"use strict";e.exports=require("util")},144:e=>{"use strict";e.exports=require("vm")}};var r={};function __nccwpck_require__(t){var n=r[t];if(n!==undefined){return n.exports}var o=r[t]={exports:{}};var i=true;try{e[t](o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete r[t]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t={};(()=>{"use strict";var e=t;const r=__nccwpck_require__(915);const n=__nccwpck_require__(147);const o=__nccwpck_require__(685);const i=__nccwpck_require__(687);const s=__nccwpck_require__(17);const{program:a}=__nccwpck_require__(318);const u=__nccwpck_require__(356);const l=__nccwpck_require__(837);const f=__nccwpck_require__(144);const c="amphtml-validator";function hasPrefix(e,r){return e.indexOf(r)==0}function isHttpOrHttpsUrl(e){return hasPrefix(e,"http://")||hasPrefix(e,"https://")}function readFromFile(e){return new u((function(r,t){n.readFile(e,"utf8",(function(e,n){if(e){t(e)}else{r(n.trim())}}))}))}function readFromReadable(e,r){return new u((function(t,n){const o=[];r.setEncoding("utf8");r.on("data",(function(e){o.push(e)}));r.on("end",(function(){t(o.join(""))}));r.on("error",(function(r){n(new Error("Could not read from "+e+" - "+r.message))}))}))}function readFromStdin(){return readFromReadable("stdin",process.stdin).then((function(e){process.stdin.resume();return e}))}function readFromUrl(e,r){return new u((function(t,n){const s=hasPrefix(e,"http://")?o:i;const a=s.request(e,(function(r){if(r.statusCode!==200){r.resume();n(new Error("Unable to fetch "+e+" - HTTP Status "+r.statusCode))}else{t(r)}}));a.setHeader("User-Agent",r);a.on("error",(function(r){n(new Error("Unable to fetch "+e+" - "+r.message))}));a.end()})).then(readFromReadable.bind(null,e))}function ValidationResult(){this.status="UNKNOWN";this.errors=[]}function ValidationError(){this.severity="UNKNOWN_SEVERITY";this.line=1;this.col=0;this.message="";this.specUrl=null;this.code="UNKNOWN_CODE";this.params=[]}function Validator(e){this.sandbox=f.createContext();try{new f.Script(e).runInContext(this.sandbox)}catch(e){throw new Error("Could not instantiate validator_wasm.js - "+e.message)}}Validator.prototype.init=function(){if(this.sandbox.amp.validator.init){return this.sandbox.amp.validator.init()}else{return u.resolve(undefined)}};Validator.prototype.validateString=function(e,r){const t=this.sandbox.amp.validator.validateString(e,r);const n=new ValidationResult;n.status=t.status;for(let e=0;e<t.errors.length;e++){const r=t.errors[e];const o=new ValidationError;o.severity=r.severity;o.line=r.line;o.col=r.col;o.message=this.sandbox.amp.validator.renderErrorMessage(r);o.specUrl=r.specUrl;o.code=r.code;o.params=r.params;n.errors.push(o)}return n};const p={};function getInstance(e,r){const t=e||"https://cdn.ampproject.org/v0/validator_wasm.js";const n=r||c;if(p.hasOwnProperty(t)){return u.resolve(p[t])}const o=isHttpOrHttpsUrl(t)?readFromUrl(t,n):readFromFile(t);return o.then((function(e){let r;try{r=new Validator(e)}catch(e){throw e}p[t]=r;return r})).then((function(e){return e.init().then((()=>e))}))}e.getInstance=getInstance;function newInstance(e){return new Validator(e)}e.newInstance=newInstance;function logValidationResult(e,t,n){if(t.status==="PASS"){process.stdout.write(e+": "+(n?r.green("PASS"):"PASS")+"\n")}for(let o=0;o<t.errors.length;o++){const i=t.errors[o];let s=e+":"+i.line+":"+i.col+" ";if(n){s+=(i.severity==="ERROR"?r.red:r.magenta)(i.message)}else{s+=i.message}if(i.specUrl){s+=" (see "+i.specUrl+")"}process.stderr.write(s+"\n")}}function main(){a.usage("[options] <fileOrUrlOrMinus...>\n\n"+' Validates the files or urls provided as arguments. If "-" is\n'+" specified, reads from stdin instead.").option("--validator_js <fileOrUrl>","The Validator Javascript.\n"+" Latest published version by default, or\n"+" dist/validator_minified.js (built with build.py)\n"+" for development.","https://cdn.ampproject.org/v0/validator_wasm.js").option("--user-agent <userAgent>","User agent string to use in requests.",c).option("--html_format <AMP|AMP4ADS|AMP4EMAIL>","The input format to be validated.\n"+" AMP by default.","AMP").option("--format <color|text|json>","How to format the output.\n"+' "color" displays errors/warnings/success in\n'+" red/orange/green.\n"+' "text" avoids color (e.g., useful in terminals not\n'+" supporting color).\n"+' "json" emits json corresponding to the ValidationResult\n'+" message in validator.proto.","color").parse(process.argv);const e=a.opts();if(e.length===0){a.outputHelp();process.exit(1)}if(e.html_format!=="AMP"&&e.html_format!=="AMP4ADS"&&e.html_format!=="AMP4EMAIL"){process.stderr.write('--html_format must be set to "AMP", "AMP4ADS", or "AMP4EMAIL".\n',(function(){process.exit(1)}))}if(e.format!=="color"&&e.format!=="text"&&e.format!=="json"){process.stderr.write('--format must be set to "color", "text", or "json".\n',(function(){process.exit(1)}))}const t=[];for(let r=0;r<a.args.length;r++){const n=a.args[r];if(n==="-"){t.push(readFromStdin())}else if(isHttpOrHttpsUrl(n)){t.push(readFromUrl(n,e.userAgent))}else{t.push(readFromFile(n))}}getInstance(e.validator_js,e.userAgent).then((function(n){u.all(t).then((function(r){const t={};let o=false;for(let i=0;i<r.length;i++){const s=n.validateString(r[i],e.html_format);if(e.format==="json"){t[a.args[i]]=s}else{logValidationResult(a.args[i],s,e.format==="color"?true:false)}if(s.status!=="PASS"){o=true}}if(e.format==="json"){process.stdout.write(JSON.stringify(t)+"\n",(function(){process.exit(o?1:0)}))}else if(o){process.stderr.write("",(function(){process.exit(1)}))}else{process.stdout.write("",(function(){process.exit(0)}))}})).catch((function(t){process.stderr.write((e.format=="color"?r.red(t.message):t.message)+"\n",(function(){process.exit(1)}))}))})).catch((function(t){process.stderr.write((e.format=="color"?r.red(t.message):t.message)+"\n",(function(){process.exit(1)}))}))}e.main=main})();module.exports=t})();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"name":"amphtml-validator","main":"index.js","author":"The AMP HTML Authors","license":"Apache-2.0"}
|