create project

This commit is contained in:
ismailsosic
2022-12-27 12:05:56 +01:00
parent 2a33a2d3de
commit cd2143287c
16035 changed files with 2489703 additions and 0 deletions

3
kitabcitab/node_modules/@next/env/README.md generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# `@next/env`
Next.js' util for loading dotenv files in with the proper priorities

1
kitabcitab/node_modules/@next/env/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
(()=>{var e={840:e=>{"use strict";function _interpolate(e,r,n){const t=e.match(/(.?\${*[\w]*(?::-)?[\w]*}*)/g)||[];return t.reduce((function(e,o,s){const c=/(.?)\${*([\w]*(?::-)?[\w]*)?}*/g.exec(o);if(!c||c.length===0){return e}const i=c[1];let a,_;if(i==="\\"){_=c[0];a=_.replace("\\$","$")}else{const o=c[2].split(":-");const l=o[0];_=c[0].substring(i.length);a=Object.prototype.hasOwnProperty.call(r,l)?r[l]:n.parsed[l]||o[1]||"";if(o.length>1&&a){const r=t[s+1];t[s+1]="";e=e.replace(r,"")}a=_interpolate(a,r,n)}return e.replace(_,a)}),e)}function expand(e){const r=e.ignoreProcessEnv?{}:process.env;for(const n in e.parsed){const t=Object.prototype.hasOwnProperty.call(r,n)?r[n]:e.parsed[n];e.parsed[n]=_interpolate(t,r,e)}for(const n in e.parsed){r[n]=e.parsed[n]}return e}e.exports.j=expand},358:(e,r,n)=>{var t;const o=n(147);const s=n(17);const c=n(37);function log(e){console.log(`[dotenv][DEBUG] ${e}`)}const i="\n";const a=/^\s*([\w.-]+)\s*=\s*(.*)?\s*$/;const _=/\\n/g;const l=/\r\n|\n|\r/;function parse(e,r){const n=Boolean(r&&r.debug);const t={};e.toString().split(l).forEach((function(e,r){const o=e.match(a);if(o!=null){const e=o[1];let r=o[2]||"";const n=r.length-1;const s=r[0]==='"'&&r[n]==='"';const c=r[0]==="'"&&r[n]==="'";if(c||s){r=r.substring(1,n);if(s){r=r.replace(_,i)}}else{r=r.trim()}t[e]=r}else if(n){log(`did not match key and value when parsing line ${r+1}: ${e}`)}}));return t}function resolveHome(e){return e[0]==="~"?s.join(c.homedir(),e.slice(1)):e}function config(e){let r=s.resolve(process.cwd(),".env");let n="utf8";let t=false;if(e){if(e.path!=null){r=resolveHome(e.path)}if(e.encoding!=null){n=e.encoding}if(e.debug!=null){t=true}}try{const e=parse(o.readFileSync(r,{encoding:n}),{debug:t});Object.keys(e).forEach((function(r){if(!Object.prototype.hasOwnProperty.call(process.env,r)){process.env[r]=e[r]}else if(t){log(`"${r}" is already defined in \`process.env\` and will not be overwritten`)}}));return{parsed:e}}catch(e){return{error:e}}}t=config;e.exports.Q=parse},147:e=>{"use strict";e.exports=require("fs")},37:e=>{"use strict";e.exports=require("os")},17:e=>{"use strict";e.exports=require("path")}};var r={};function __nccwpck_require__(n){var t=r[n];if(t!==undefined){return t.exports}var o=r[n]={exports:{}};var s=true;try{e[n](o,o.exports,__nccwpck_require__);s=false}finally{if(s)delete r[n]}return o.exports}(()=>{__nccwpck_require__.n=e=>{var r=e&&e.__esModule?()=>e["default"]:()=>e;__nccwpck_require__.d(r,{a:r});return r}})();(()=>{__nccwpck_require__.d=(e,r)=>{for(var n in r){if(__nccwpck_require__.o(r,n)&&!__nccwpck_require__.o(e,n)){Object.defineProperty(e,n,{enumerable:true,get:r[n]})}}}})();(()=>{__nccwpck_require__.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r)})();(()=>{__nccwpck_require__.r=e=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n={};(()=>{"use strict";__nccwpck_require__.r(n);__nccwpck_require__.d(n,{processEnv:()=>processEnv,loadEnvConfig:()=>loadEnvConfig});var e=__nccwpck_require__(147);var r=__nccwpck_require__.n(e);var t=__nccwpck_require__(17);var o=__nccwpck_require__.n(t);var s=__nccwpck_require__(358);var c=__nccwpck_require__(840);let i=undefined;let a=undefined;let _=[];let l=[];function processEnv(e,r,n=console,o=false){var a;if(!i){i=Object.assign({},process.env)}if(!o&&(process.env.__NEXT_PROCESSED_ENV||e.length===0)){return process.env}process.env.__NEXT_PROCESSED_ENV="true";const _=Object.assign({},i);const p={};for(const o of e){try{let e={};e.parsed=s.Q(o.contents);e=(0,c.j)(e);if(e.parsed&&!l.some((e=>e.contents===o.contents&&e.path===o.path))){n.info(`Loaded env from ${t.join(r||"",o.path)}`)}for(const r of Object.keys(e.parsed||{})){if(typeof p[r]==="undefined"&&typeof _[r]==="undefined"){p[r]=(a=e.parsed)===null||a===void 0?void 0:a[r]}}}catch(e){n.error(`Failed to load env from ${t.join(r||"",o.path)}`,e)}}return Object.assign(process.env,p)}function loadEnvConfig(r,n,o=console,s=false){if(!i){i=Object.assign({},process.env)}if(a&&!s){return{combinedEnv:a,loadedEnvFiles:_}}process.env=Object.assign({},i);l=_;_=[];const c=process.env.NODE_ENV==="test";const p=c?"test":n?"development":"production";const u=[`.env.${p}.local`,p!=="test"&&`.env.local`,`.env.${p}`,".env"].filter(Boolean);for(const n of u){const s=t.join(r,n);try{const r=e.statSync(s);if(!r.isFile()){continue}const t=e.readFileSync(s,"utf8");_.push({path:n,contents:t})}catch(e){if(e.code!=="ENOENT"){o.error(`Failed to load env from ${n}`,e)}}}a=processEnv(_,r,o,s);return{combinedEnv:a,loadedEnvFiles:_}}})();module.exports=n})();

38
kitabcitab/node_modules/@next/env/package.json generated vendored Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "@next/env",
"version": "13.1.1",
"keywords": [
"react",
"next",
"next.js",
"dotenv"
],
"description": "Next.js dotenv file loading",
"repository": {
"type": "git",
"url": "https://github.com/vercel/next.js",
"directory": "packages/next-env"
},
"author": "Next.js Team <support@vercel.com>",
"license": "MIT",
"main": "dist/index.js",
"types": "types/index.d.ts",
"files": [
"dist",
"types"
],
"scripts": {
"dev": "ncc build ./index.ts -w -o dist/",
"prerelease": "rimraf ./dist/",
"types": "tsc index.ts --declaration --emitDeclarationOnly --declarationDir types --esModuleInterop",
"release": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register",
"build": "pnpm release && pnpm types",
"prepublishOnly": "cd ../../ && turbo run build"
},
"devDependencies": {
"@vercel/ncc": "0.34.0",
"dotenv": "10.0.0",
"dotenv-expand": "8.0.1",
"rimraf": "3.0.2"
}
}

17
kitabcitab/node_modules/@next/env/types/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
export declare type Env = {
[key: string]: string | undefined;
};
export declare type LoadedEnvFiles = Array<{
path: string;
contents: string;
}>;
declare type Log = {
info: (...args: any[]) => void;
error: (...args: any[]) => void;
};
export declare function processEnv(loadedEnvFiles: LoadedEnvFiles, dir?: string, log?: Log, forceReload?: boolean): Env;
export declare function loadEnvConfig(dir: string, dev?: boolean, log?: Log, forceReload?: boolean): {
combinedEnv: Env;
loadedEnvFiles: LoadedEnvFiles;
};
export {};

View File

@@ -0,0 +1,4 @@
# `@next/eslint-plugin-next`
Documentation for `@next/eslint-plugin-next` can be found at:
https://nextjs.org/docs/basic-features/eslint#eslint-plugin

View File

@@ -0,0 +1,68 @@
"use strict";
module.exports = {
rules: {
"google-font-display": require("./rules/google-font-display"),
"google-font-preconnect": require("./rules/google-font-preconnect"),
"inline-script-id": require("./rules/inline-script-id"),
"next-script-for-ga": require("./rules/next-script-for-ga"),
"no-assign-module-variable": require("./rules/no-assign-module-variable"),
"no-before-interactive-script-outside-document": require("./rules/no-before-interactive-script-outside-document"),
"no-css-tags": require("./rules/no-css-tags"),
"no-document-import-in-page": require("./rules/no-document-import-in-page"),
"no-duplicate-head": require("./rules/no-duplicate-head"),
"no-head-element": require("./rules/no-head-element"),
"no-head-import-in-document": require("./rules/no-head-import-in-document"),
"no-html-link-for-pages": require("./rules/no-html-link-for-pages"),
"no-img-element": require("./rules/no-img-element"),
"no-page-custom-font": require("./rules/no-page-custom-font"),
"no-script-component-in-head": require("./rules/no-script-component-in-head"),
"no-styled-jsx-in-document": require("./rules/no-styled-jsx-in-document"),
"no-sync-scripts": require("./rules/no-sync-scripts"),
"no-title-in-document-head": require("./rules/no-title-in-document-head"),
"no-typos": require("./rules/no-typos"),
"no-unwanted-polyfillio": require("./rules/no-unwanted-polyfillio")
},
configs: {
recommended: {
plugins: [
"@next/next"
],
rules: {
// warnings
"@next/next/google-font-display": "warn",
"@next/next/google-font-preconnect": "warn",
"@next/next/next-script-for-ga": "warn",
"@next/next/no-before-interactive-script-outside-document": "warn",
"@next/next/no-css-tags": "warn",
"@next/next/no-head-element": "warn",
"@next/next/no-html-link-for-pages": "warn",
"@next/next/no-img-element": "warn",
"@next/next/no-page-custom-font": "warn",
"@next/next/no-styled-jsx-in-document": "warn",
"@next/next/no-sync-scripts": "warn",
"@next/next/no-title-in-document-head": "warn",
"@next/next/no-typos": "warn",
"@next/next/no-unwanted-polyfillio": "warn",
// errors
"@next/next/inline-script-id": "error",
"@next/next/no-assign-module-variable": "error",
"@next/next/no-document-import-in-page": "error",
"@next/next/no-duplicate-head": "error",
"@next/next/no-head-import-in-document": "error",
"@next/next/no-script-component-in-head": "error"
}
},
"core-web-vitals": {
plugins: [
"@next/next"
],
extends: [
"plugin:@next/next/recommended"
],
rules: {
"@next/next/no-html-link-for-pages": "error",
"@next/next/no-sync-scripts": "error"
}
}
}
};

View File

@@ -0,0 +1,51 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var _nodeAttributes = _interopRequireDefault(require("../utils/node-attributes"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var url = "https://nextjs.org/docs/messages/google-font-display";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Enforce font-display behavior with Google Fonts.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
JSXOpeningElement: function JSXOpeningElement(node) {
var message;
if (node.name.name !== "link") {
return;
}
var attributes = new _nodeAttributes.default(node);
if (!attributes.has("href") || !attributes.hasValue("href")) {
return;
}
var hrefValue = attributes.value("href");
var isGoogleFont = typeof hrefValue === "string" && hrefValue.startsWith("https://fonts.googleapis.com/css");
if (isGoogleFont) {
var params = new URLSearchParams(hrefValue.split("?")[1]);
var displayValue = params.get("display");
if (!params.has("display")) {
message = "A font-display parameter is missing (adding `&display=optional` is recommended).";
} else if (displayValue === "auto" || displayValue === "block" || displayValue === "fallback") {
message = "".concat(displayValue[0].toUpperCase() + displayValue.slice(1), " is not recommended.");
}
}
if (message) {
context.report({
node: node,
message: "".concat(message, " See: ").concat(url)
});
}
}
};
}
});

View File

@@ -0,0 +1,41 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var _nodeAttributes = _interopRequireDefault(require("../utils/node-attributes"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var url = "https://nextjs.org/docs/messages/google-font-preconnect";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Ensure `preconnect` is used with Google Fonts.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
JSXOpeningElement: function JSXOpeningElement(node) {
if (node.name.name !== "link") {
return;
}
var attributes = new _nodeAttributes.default(node);
if (!attributes.has("href") || !attributes.hasValue("href")) {
return;
}
var hrefValue = attributes.value("href");
var preconnectMissing = !attributes.has("rel") || !attributes.hasValue("rel") || attributes.value("rel") !== "preconnect";
if (typeof hrefValue === "string" && hrefValue.startsWith("https://fonts.gstatic.com") && preconnectMissing) {
context.report({
node: node,
message: '`rel="preconnect"` is missing from Google Font. See: '.concat(url)
});
}
}
};
}
});

View File

@@ -0,0 +1,59 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var url = "https://nextjs.org/docs/messages/inline-script-id";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Enforce `id` attribute on `next/script` components with inline content.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
var nextScriptImportName = null;
return {
ImportDeclaration: function ImportDeclaration(node) {
if (node.source.value === "next/script") {
nextScriptImportName = node.specifiers[0].local.name;
}
},
JSXElement: function JSXElement(node) {
if (nextScriptImportName == null) return;
if (node.openingElement && node.openingElement.name && node.openingElement.name.name !== nextScriptImportName) {
return;
}
var attributeNames = new Set();
var hasNonCheckableSpreadAttribute = false;
node.openingElement.attributes.forEach(function(attribute) {
// Early return if we already have a non-checkable spread attribute, for better performance
if (hasNonCheckableSpreadAttribute) return;
if (attribute.type === "JSXAttribute") {
attributeNames.add(attribute.name.name);
} else if (attribute.type === "JSXSpreadAttribute") {
if (attribute.argument && attribute.argument.properties) {
attribute.argument.properties.forEach(function(property) {
attributeNames.add(property.key.name);
});
} else {
// JSXSpreadAttribute without properties is not checkable
hasNonCheckableSpreadAttribute = true;
}
}
});
// https://github.com/vercel/next.js/issues/34030
// If there is a non-checkable spread attribute, we simply ignore them
if (hasNonCheckableSpreadAttribute) return;
if (node.children.length > 0 || attributeNames.has("dangerouslySetInnerHTML")) {
if (!attributeNames.has("id")) {
context.report({
node: node,
message: "`next/script` components with inline content must specify an `id` attribute. See: ".concat(url)
});
}
}
}
};
}
});

View File

@@ -0,0 +1,70 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var _nodeAttributes = _interopRequireDefault(require("../utils/node-attributes"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var SUPPORTED_SRCS = [
"www.google-analytics.com/analytics.js",
"www.googletagmanager.com/gtag/js",
];
var SUPPORTED_HTML_CONTENT_URLS = [
"www.google-analytics.com/analytics.js",
"www.googletagmanager.com/gtm.js",
];
var description = "Prefer `next/script` component when using the inline script for Google Analytics.";
var url = "https://nextjs.org/docs/messages/next-script-for-ga";
var ERROR_MSG = "".concat(description, " See: ").concat(url);
// Check if one of the items in the list is a substring of the passed string
var containsStr = function(str, strList) {
return strList.some(function(s) {
return str.includes(s);
});
};
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: description,
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
JSXOpeningElement: function JSXOpeningElement(node) {
if (node.name.name !== "script") {
return;
}
if (node.attributes.length === 0) {
return;
}
var attributes = new _nodeAttributes.default(node);
// Check if the Alternative async tag is being used to add GA.
// https://developers.google.com/analytics/devguides/collection/analyticsjs#alternative_async_tag
// https://developers.google.com/analytics/devguides/collection/gtagjs
if (typeof attributes.value("src") === "string" && containsStr(attributes.value("src"), SUPPORTED_SRCS)) {
return context.report({
node: node,
message: ERROR_MSG
});
}
// Check if inline script is being used to add GA.
// https://developers.google.com/analytics/devguides/collection/analyticsjs#the_google_analytics_tag
// https://developers.google.com/tag-manager/quickstart
if (attributes.value("dangerouslySetInnerHTML") && attributes.value("dangerouslySetInnerHTML").length > 0) {
var htmlContent = attributes.value("dangerouslySetInnerHTML")[0].value.quasis && attributes.value("dangerouslySetInnerHTML")[0].value.quasis[0].value.raw;
if (htmlContent && containsStr(htmlContent, SUPPORTED_HTML_CONTENT_URLS)) {
context.report({
node: node,
message: ERROR_MSG
});
}
}
}
};
}
});

View File

@@ -0,0 +1,35 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var url = "https://nextjs.org/docs/messages/no-assign-module-variable";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent assignment to the `module` variable.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
VariableDeclaration: function VariableDeclaration(node) {
// Checks node.declarations array for variable with id.name of `module`
var moduleVariableFound = node.declarations.some(function(declaration) {
if ("name" in declaration.id) {
return declaration.id.name === "module";
}
return false;
});
// Return early if no `module` variable is found
if (!moduleVariableFound) {
return;
}
context.report({
node: node,
message: "Do not assign to the variable `module`. See: ".concat(url)
});
}
};
}
});

View File

@@ -0,0 +1,84 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var path = _interopRequireWildcard(require("path"));
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
var url = "https://nextjs.org/docs/messages/no-before-interactive-script-outside-document";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent usage of `next/script`'s `beforeInteractive` strategy outside of `pages/_document.js`.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
var scriptImportName = null;
return {
'ImportDeclaration[source.value="next/script"] > ImportDefaultSpecifier': function(node) {
scriptImportName = node.local.name;
},
JSXOpeningElement: function JSXOpeningElement(node) {
if (!scriptImportName) {
return;
}
if (node.name && node.name.name !== scriptImportName) {
return;
}
var strategy = node.attributes.find(function(child) {
return child.name && child.name.name === "strategy";
});
if (!strategy || !strategy.value || strategy.value.value !== "beforeInteractive") {
return;
}
var document = context.getFilename().split("pages")[1];
if (document && path.parse(document).name.startsWith("_document")) {
return;
}
context.report({
node: node,
message: "`next/script`'s `beforeInteractive` strategy should not be used outside of `pages/_document.js`. See: ".concat(url)
});
}
};
}
});

View File

@@ -0,0 +1,39 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var url = "https://nextjs.org/docs/messages/no-css-tags";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent manual stylesheet tags.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
JSXOpeningElement: function JSXOpeningElement(node) {
if (node.name.name !== "link") {
return;
}
if (node.attributes.length === 0) {
return;
}
var attributes = node.attributes.filter(function(attr) {
return attr.type === "JSXAttribute";
});
if (attributes.find(function(attr) {
return attr.name.name === "rel" && attr.value.value === "stylesheet";
}) && attributes.find(function(attr) {
return attr.name.name === "href" && attr.value.type === "Literal" && !/^https?/.test(attr.value.value);
})) {
context.report({
node: node,
message: "Do not include stylesheets manually. See: ".concat(url)
});
}
}
};
}
});

View File

@@ -0,0 +1,72 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var path = _interopRequireWildcard(require("path"));
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
var url = "https://nextjs.org/docs/messages/no-document-import-in-page";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent importing `next/document` outside of `pages/_document.js`.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
ImportDeclaration: function ImportDeclaration(node) {
if (node.source.value !== "next/document") {
return;
}
var paths = context.getFilename().split("pages");
var page = paths[paths.length - 1];
if (!page || page.startsWith("".concat(path.sep, "_document")) || page.startsWith("".concat(path.posix.sep, "_document"))) {
return;
}
context.report({
node: node,
message: "`<Document />` from `next/document` should not be imported outside of `pages/_document.js`. See: ".concat(url)
});
}
};
}
});

View File

@@ -0,0 +1,54 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var url = "https://nextjs.org/docs/messages/no-duplicate-head";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent duplicate usage of `<Head>` in `pages/_document.js`.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
var documentImportName;
return {
ImportDeclaration: function ImportDeclaration(node) {
if (node.source.value === "next/document") {
var documentImport = node.specifiers.find(function(param) {
var type = param.type;
return type === "ImportDefaultSpecifier";
});
if (documentImport && documentImport.local) {
documentImportName = documentImport.local.name;
}
}
},
ReturnStatement: function ReturnStatement(node) {
var ancestors = context.getAncestors();
var documentClass = ancestors.find(function(ancestorNode) {
return ancestorNode.type === "ClassDeclaration" && ancestorNode.superClass && "name" in ancestorNode.superClass && ancestorNode.superClass.name === documentImportName;
});
if (!documentClass) {
return;
}
// @ts-expect-error - `node.argument` could be a `JSXElement` which has property `children`
if (node.argument && "children" in node.argument && node.argument.children) {
// @ts-expect-error - `node.argument` could be a `JSXElement` which has property `children`
var headComponents = node.argument.children.filter(function(childrenNode) {
return childrenNode.openingElement && childrenNode.openingElement.name && childrenNode.openingElement.name.name === "Head";
});
if (headComponents.length > 1) {
for(var i = 1; i < headComponents.length; i++){
context.report({
node: headComponents[i],
message: "Do not include multiple instances of `<Head/>`. See: ".concat(url)
});
}
}
}
}
};
}
});

View File

@@ -0,0 +1,34 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var path = require("path");
var url = "https://nextjs.org/docs/messages/no-head-element";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent usage of `<head>` element.",
category: "HTML",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
JSXOpeningElement: function JSXOpeningElement(node) {
var paths = context.getFilename();
var isInAppDir = function() {
return (paths.includes("app".concat(path.sep)) || paths.includes("app".concat(path.posix.sep))) && !paths.includes("pages".concat(path.sep)) && !paths.includes("pages".concat(path.posix.sep));
};
// Only lint the <head> element in pages directory
if (node.name.name !== "head" || isInAppDir()) {
return;
}
context.report({
node: node,
message: "Do not use `<head>` element. Use `<Head />` from `next/head` instead. See: ".concat(url)
});
}
};
}
});

View File

@@ -0,0 +1,74 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var path = _interopRequireWildcard(require("path"));
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
var url = "https://nextjs.org/docs/messages/no-head-import-in-document";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent usage of `next/head` in `pages/_document.js`.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
ImportDeclaration: function ImportDeclaration(node) {
if (node.source.value !== "next/head") {
return;
}
var document = context.getFilename().split("pages")[1];
if (!document) {
return;
}
var ref = path.parse(document), name = ref.name, dir = ref.dir;
if (name.startsWith("_document") || dir === "/_document" && name === "index") {
context.report({
node: node,
message: "`next/head` should not be imported in `pages".concat(document, "`. Use `<Head />` from `next/document` instead. See: ").concat(url)
});
}
}
};
}
});

View File

@@ -0,0 +1,192 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var path = _interopRequireWildcard(require("path"));
var fs = _interopRequireWildcard(require("fs"));
var _getRootDirs = require("../utils/get-root-dirs");
var _url = require("../utils/url");
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
return arr2;
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally{
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally{
if (_d) throw _e;
}
}
return _arr;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(n);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
var pagesDirWarning = (0, _url).execOnce(function(pagesDirs) {
console.warn("Pages directory cannot be found at ".concat(pagesDirs.join(" or "), ". ") + "If using a custom path, please configure with the `no-html-link-for-pages` rule in your eslint config file.");
});
// Cache for fs.existsSync lookup.
// Prevent multiple blocking IO requests that have already been calculated.
var fsExistsSyncCache = {};
var url = "https://nextjs.org/docs/messages/no-html-link-for-pages";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent usage of `<a>` elements to navigate to internal Next.js pages.",
category: "HTML",
recommended: true,
url: url
},
type: "problem",
schema: [
{
oneOf: [
{
type: "string"
},
{
type: "array",
uniqueItems: true,
items: {
type: "string"
}
},
]
},
]
},
/**
* Creates an ESLint rule listener.
*/ create: function create(context) {
var ruleOptions = context.options;
var _ruleOptions = _slicedToArray(ruleOptions, 1), customPagesDirectory = _ruleOptions[0];
var rootDirs = (0, _getRootDirs).getRootDirs(context);
var pagesDirs = (customPagesDirectory ? [
customPagesDirectory
] : rootDirs.map(function(dir) {
return [
path.join(dir, "pages"),
path.join(dir, "src", "pages"),
];
})).flat();
var foundPagesDirs = pagesDirs.filter(function(dir) {
if (fsExistsSyncCache[dir] === undefined) {
fsExistsSyncCache[dir] = fs.existsSync(dir);
}
return fsExistsSyncCache[dir];
});
if (foundPagesDirs.length === 0) {
pagesDirWarning(pagesDirs);
return {};
}
var pageUrls = (0, _url).getUrlFromPagesDirectories("/", foundPagesDirs);
return {
JSXOpeningElement: function JSXOpeningElement(node) {
if (node.name.name !== "a") {
return;
}
if (node.attributes.length === 0) {
return;
}
var target = node.attributes.find(function(attr) {
return attr.type === "JSXAttribute" && attr.name.name === "target";
});
if (target && target.value.value === "_blank") {
return;
}
var href = node.attributes.find(function(attr) {
return attr.type === "JSXAttribute" && attr.name.name === "href";
});
if (!href || href.value && href.value.type !== "Literal") {
return;
}
var hasDownloadAttr = node.attributes.find(function(attr) {
return attr.type === "JSXAttribute" && attr.name.name === "download";
});
if (hasDownloadAttr) {
return;
}
var hrefPath = (0, _url).normalizeURL(href.value.value);
// Outgoing links are ignored
if (/^(https?:\/\/|\/\/)/.test(hrefPath)) {
return;
}
pageUrls.forEach(function(pageUrl) {
if (pageUrl.test((0, _url).normalizeURL(hrefPath))) {
context.report({
node: node,
message: "Do not use an `<a>` element to navigate to `".concat(hrefPath, "`. Use `<Link />` from `next/link` instead. See: ").concat(url)
});
}
});
}
};
}
});

View File

@@ -0,0 +1,35 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var url = "https://nextjs.org/docs/messages/no-img-element";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent usage of `<img>` element due to slower LCP and higher bandwidth.",
category: "HTML",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
JSXOpeningElement: function JSXOpeningElement(node) {
var ref, ref1, ref2, ref3;
if (node.name.name !== "img") {
return;
}
if (node.attributes.length === 0) {
return;
}
if (((ref = node.parent) === null || ref === void 0 ? void 0 : (ref1 = ref.parent) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.openingElement) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.name) === null || ref3 === void 0 ? void 0 : ref3.name) === "picture") {
return;
}
context.report({
node: node,
message: "Using `<img>` could result in slower LCP and higher bandwidth. Use `<Image />` from `next/image` instead to utilize Image Optimization. See: ".concat(url)
});
}
};
}
});

View File

@@ -0,0 +1,126 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var _nodeAttributes = _interopRequireDefault(require("../utils/node-attributes"));
var _path = require("path");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var url = "https://nextjs.org/docs/messages/no-page-custom-font";
function isIdentifierMatch(id1, id2) {
return id1 === null && id2 === null || id1 && id2 && id1.name === id2.name;
}
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent page-only custom fonts.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
var paths = context.getFilename().split("pages");
var page = paths[paths.length - 1];
// outside of a file within `pages`, bail
if (!page) {
return {};
}
var is_Document = page.startsWith("".concat(_path.sep, "_document")) || page.startsWith("".concat(_path.posix.sep, "_document"));
var documentImportName;
var localDefaultExportId;
var exportDeclarationType;
return {
ImportDeclaration: function ImportDeclaration(node) {
if (node.source.value === "next/document") {
var documentImport = node.specifiers.find(function(param) {
var type = param.type;
return type === "ImportDefaultSpecifier";
});
if (documentImport && documentImport.local) {
documentImportName = documentImport.local.name;
}
}
},
ExportDefaultDeclaration: function ExportDefaultDeclaration(node) {
exportDeclarationType = node.declaration.type;
if (node.declaration.type === "FunctionDeclaration") {
localDefaultExportId = node.declaration.id;
return;
}
if (node.declaration.type === "ClassDeclaration" && node.declaration.superClass && "name" in node.declaration.superClass && node.declaration.superClass.name === documentImportName) {
localDefaultExportId = node.declaration.id;
}
},
JSXOpeningElement: function JSXOpeningElement(node) {
if (node.name.name !== "link") {
return;
}
var ancestors = context.getAncestors();
// if `export default <name>` is further down within the file after the
// currently traversed component, then `localDefaultExportName` will
// still be undefined
if (!localDefaultExportId) {
// find the top level of the module
var program = ancestors.find(function(ancestor) {
return ancestor.type === "Program";
});
// go over each token to find the combination of `export default <name>`
for(var i = 0; i <= program.tokens.length - 1; i++){
if (localDefaultExportId) {
break;
}
var token = program.tokens[i];
if (token.type === "Keyword" && token.value === "export") {
var nextToken = program.tokens[i + 1];
if (nextToken && nextToken.type === "Keyword" && nextToken.value === "default") {
var maybeIdentifier = program.tokens[i + 2];
if (maybeIdentifier && maybeIdentifier.type === "Identifier") {
localDefaultExportId = {
name: maybeIdentifier.value
};
}
}
}
}
}
var parentComponent = ancestors.find(function(ancestor) {
// export default class ... extends ...
if (exportDeclarationType === "ClassDeclaration") {
return ancestor.type === exportDeclarationType && "superClass" in ancestor && ancestor.superClass && "name" in ancestor.superClass && ancestor.superClass.name === documentImportName;
}
if ("id" in ancestor) {
// export default function ...
if (exportDeclarationType === "FunctionDeclaration") {
return ancestor.type === exportDeclarationType && isIdentifierMatch(ancestor.id, localDefaultExportId);
}
// function ...() {} export default ...
// class ... extends ...; export default ...
return isIdentifierMatch(ancestor.id, localDefaultExportId);
}
return false;
});
// file starts with _document and this <link /> is within the default export
if (is_Document && parentComponent) {
return;
}
var attributes = new _nodeAttributes.default(node);
if (!attributes.has("href") || !attributes.hasValue("href")) {
return;
}
var hrefValue = attributes.value("href");
var isGoogleFont = typeof hrefValue === "string" && hrefValue.startsWith("https://fonts.googleapis.com/css");
if (isGoogleFont) {
var end = "This is discouraged. See: ".concat(url);
var message = is_Document ? "Using `<link />` outside of `<Head>` will disable automatic font optimization. ".concat(end) : "Custom fonts not added in `pages/_document.js` will only load for a single page. ".concat(end);
context.report({
node: node,
message: message
});
}
}
};
}
});

View File

@@ -0,0 +1,44 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var url = "https://nextjs.org/docs/messages/no-script-component-in-head";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent usage of `next/script` in `next/head` component.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
var isNextHead = null;
return {
ImportDeclaration: function ImportDeclaration(node) {
if (node.source.value === "next/head") {
isNextHead = node.source.value;
}
if (node.source.value !== "next/script") {
return;
}
},
JSXElement: function JSXElement(node) {
if (!isNextHead) {
return;
}
if (node.openingElement && node.openingElement.name && node.openingElement.name.name !== "Head") {
return;
}
var scriptTag = node.children.find(function(child) {
return child.openingElement && child.openingElement.name && child.openingElement.name.name === "Script";
});
if (scriptTag) {
context.report({
node: node,
message: "`next/script` should not be used in `next/head` component. Move `<Script />` outside of `<Head>` instead. See: ".concat(url)
});
}
}
};
}
});

View File

@@ -0,0 +1,76 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var path = _interopRequireWildcard(require("path"));
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
var url = "https://nextjs.org/docs/messages/no-styled-jsx-in-document";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent usage of `styled-jsx` in `pages/_document.js`.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
JSXOpeningElement: function JSXOpeningElement(node) {
var document = context.getFilename().split("pages")[1];
if (!document) {
return;
}
var ref = path.parse(document), name = ref.name, dir = ref.dir;
if (!(name.startsWith("_document") || dir === "/_document" && name === "index")) {
return;
}
if (node.name.name === "style" && node.attributes.find(function(attr) {
return attr.type === "JSXAttribute" && attr.name.name === "jsx";
})) {
context.report({
node: node,
message: "`styled-jsx` should not be used in `pages/_document.js`. See: ".concat(url)
});
}
}
};
}
});

View File

@@ -0,0 +1,37 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var url = "https://nextjs.org/docs/messages/no-sync-scripts";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent synchronous scripts.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
JSXOpeningElement: function JSXOpeningElement(node) {
if (node.name.name !== "script") {
return;
}
if (node.attributes.length === 0) {
return;
}
var attributeNames = node.attributes.filter(function(attr) {
return attr.type === "JSXAttribute";
}).map(function(attr) {
return attr.name.name;
});
if (attributeNames.includes("src") && !attributeNames.includes("async") && !attributeNames.includes("defer")) {
context.report({
node: node,
message: "Synchronous scripts should not be used. See: ".concat(url)
});
}
}
};
}
});

View File

@@ -0,0 +1,46 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var url = "https://nextjs.org/docs/messages/no-title-in-document-head";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent usage of `<title>` with `Head` component from `next/document`.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
var headFromNextDocument = false;
return {
ImportDeclaration: function ImportDeclaration(node) {
if (node.source.value === "next/document") {
if (node.specifiers.some(function(param) {
var local = param.local;
return local.name === "Head";
})) {
headFromNextDocument = true;
}
}
},
JSXElement: function JSXElement(node) {
if (!headFromNextDocument) {
return;
}
if (node.openingElement && node.openingElement.name && node.openingElement.name.name !== "Head") {
return;
}
var titleTag = node.children.find(function(child) {
return child.openingElement && child.openingElement.name && child.openingElement.name.type === "JSXIdentifier" && child.openingElement.name.name === "title";
});
if (titleTag) {
context.report({
node: titleTag,
message: "Do not use `<title>` element with `<Head />` component from `next/document`. Titles should defined at the page-level using `<Head />` from `next/head` instead. See: ".concat(url)
});
}
}
};
}
});

View File

@@ -0,0 +1,148 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var path = _interopRequireWildcard(require("path"));
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
var NEXT_EXPORT_FUNCTIONS = [
"getStaticProps",
"getStaticPaths",
"getServerSideProps",
];
// 0 is the exact match
var THRESHOLD = 1;
// the minimum number of operations required to convert string a to string b.
function minDistance(a, b) {
var m = a.length;
var n = b.length;
if (m < n) {
return minDistance(b, a);
}
if (n === 0) {
return m;
}
var previousRow = Array.from({
length: n + 1
}, function(_, i) {
return i;
});
for(var i1 = 0; i1 < m; i1++){
var s1 = a[i1];
var currentRow = [
i1 + 1
];
for(var j = 0; j < n; j++){
var s2 = b[j];
var insertions = previousRow[j + 1] + 1;
var deletions = currentRow[j] + 1;
var substitutions = previousRow[j] + Number(s1 !== s2);
currentRow.push(Math.min(insertions, deletions, substitutions));
}
previousRow = currentRow;
}
return previousRow[previousRow.length - 1];
}
/* eslint-disable eslint-plugin/require-meta-docs-url */ module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent common typos in Next.js data fetching functions.",
recommended: true
},
type: "problem",
schema: []
},
create: function create(context) {
var checkTypos = function checkTypos(node, name) {
if (NEXT_EXPORT_FUNCTIONS.includes(name)) {
return;
}
var potentialTypos = NEXT_EXPORT_FUNCTIONS.map(function(o) {
return {
option: o,
distance: minDistance(o, name)
};
}).filter(function(param) {
var distance = param.distance;
return distance <= THRESHOLD && distance > 0;
}).sort(function(a, b) {
return a.distance - b.distance;
});
if (potentialTypos.length) {
context.report({
node: node,
message: "".concat(name, " may be a typo. Did you mean ").concat(potentialTypos[0].option, "?")
});
}
};
return {
ExportNamedDeclaration: function ExportNamedDeclaration(node) {
var page = context.getFilename().split("pages")[1];
if (!page || path.parse(page).dir.startsWith("/api")) {
return;
}
var decl = node.declaration;
if (!decl) {
return;
}
switch(decl.type){
case "FunctionDeclaration":
{
checkTypos(node, decl.id.name);
break;
}
case "VariableDeclaration":
{
decl.declarations.forEach(function(d) {
if (d.id.type !== "Identifier") {
return;
}
checkTypos(node, d.id.name);
});
break;
}
default:
{
break;
}
}
return;
}
};
}
});

View File

@@ -0,0 +1,121 @@
"use strict";
var _defineRule = require("../utils/define-rule");
// Keep in sync with next.js polyfills file : https://github.com/vercel/next.js/blob/master/packages/next-polyfill-nomodule/src/index.js
var NEXT_POLYFILLED_FEATURES = [
"Array.prototype.@@iterator",
"Array.prototype.copyWithin",
"Array.prototype.fill",
"Array.prototype.find",
"Array.prototype.findIndex",
"Array.prototype.flatMap",
"Array.prototype.flat",
"Array.from",
"Array.prototype.includes",
"Array.of",
"Function.prototype.name",
"fetch",
"Map",
"Number.EPSILON",
"Number.Epsilon",
"Number.isFinite",
"Number.isNaN",
"Number.isInteger",
"Number.isSafeInteger",
"Number.MAX_SAFE_INTEGER",
"Number.MIN_SAFE_INTEGER",
"Number.parseFloat",
"Number.parseInt",
"Object.assign",
"Object.entries",
"Object.fromEntries",
"Object.getOwnPropertyDescriptor",
"Object.getOwnPropertyDescriptors",
"Object.is",
"Object.keys",
"Object.values",
"Reflect",
"Set",
"Symbol",
"Symbol.asyncIterator",
"String.prototype.codePointAt",
"String.prototype.endsWith",
"String.fromCodePoint",
"String.prototype.includes",
"String.prototype.@@iterator",
"String.prototype.padEnd",
"String.prototype.padStart",
"String.prototype.repeat",
"String.raw",
"String.prototype.startsWith",
"String.prototype.trimEnd",
"String.prototype.trimStart",
"URL",
"URL.prototype.toJSON",
"URLSearchParams",
"WeakMap",
"WeakSet",
"Promise",
"Promise.prototype.finally",
"es2015",
"es2016",
"es2017",
"es2018",
"es2019",
"es5",
"es6",
"es7"
];
var url = "https://nextjs.org/docs/messages/no-unwanted-polyfillio";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent duplicate polyfills from Polyfill.io.",
category: "HTML",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
var scriptImport = null;
return {
ImportDeclaration: function ImportDeclaration(node) {
if (node.source && node.source.value === "next/script") {
scriptImport = node.specifiers[0].local.name;
}
},
JSXOpeningElement: function JSXOpeningElement(node) {
if (node.name && node.name.name !== "script" && node.name.name !== scriptImport) {
return;
}
if (node.attributes.length === 0) {
return;
}
var srcNode = node.attributes.find(function(attr) {
return attr.type === "JSXAttribute" && attr.name.name === "src";
});
if (!srcNode || srcNode.value.type !== "Literal") {
return;
}
var src = srcNode.value.value;
if (src.startsWith("https://cdn.polyfill.io/v2/") || src.startsWith("https://polyfill.io/v3/")) {
var featureQueryString = new URL(src).searchParams.get("features");
var featuresRequested = (featureQueryString || "").split(",");
var unwantedFeatures = featuresRequested.filter(function(feature) {
return NEXT_POLYFILLED_FEATURES.includes(feature);
});
if (unwantedFeatures.length > 0) {
context.report({
node: node,
message: "No duplicate polyfills from Polyfill.io are allowed. ".concat(unwantedFeatures.join(", "), " ").concat(unwantedFeatures.length > 1 ? "are" : "is", " already shipped with Next.js. See: ").concat(url)
});
}
}
}
};
}
});

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.defineRule = void 0;
var defineRule = function(rule) {
return rule;
};
exports.defineRule = defineRule;

View File

@@ -0,0 +1,68 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getRootDirs = void 0;
var glob = _interopRequireWildcard(require("glob"));
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
/**
* Process a Next.js root directory glob.
*/ var processRootDir = function(rootDir) {
// Ensures we only match folders.
if (!rootDir.endsWith("/")) rootDir += "/";
return glob.sync(rootDir);
};
var getRootDirs = function(context) {
var rootDirs = [
context.getCwd()
];
var nextSettings = context.settings.next || {};
var rootDir = nextSettings.rootDir;
if (typeof rootDir === "string") {
rootDirs = processRootDir(rootDir);
} else if (Array.isArray(rootDir)) {
rootDirs = rootDir.map(function(dir) {
return typeof dir === "string" ? processRootDir(dir) : [];
}).flat();
}
return rootDirs;
};
exports.getRootDirs = getRootDirs;

View File

@@ -0,0 +1,57 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var NodeAttributes = /*#__PURE__*/ function() {
"use strict";
function NodeAttributes(ASTnode) {
var _this = this;
_classCallCheck(this, NodeAttributes);
this.attributes = {};
ASTnode.attributes.forEach(function(attribute) {
if (!attribute.type || attribute.type !== "JSXAttribute") {
return;
}
if (!!attribute.value) {
// hasValue
var value = typeof attribute.value.value === "string" ? attribute.value.value : typeof attribute.value.expression.value !== "undefined" ? attribute.value.expression.value : attribute.value.expression.properties;
_this.attributes[attribute.name.name] = {
hasValue: true,
value: value
};
} else {
_this.attributes[attribute.name.name] = {
hasValue: false
};
}
});
}
var _proto = NodeAttributes.prototype;
_proto.hasAny = function hasAny() {
return !!Object.keys(this.attributes).length;
};
_proto.has = function has(attrName) {
return !!this.attributes[attrName];
};
_proto.hasValue = function hasValue(attrName) {
return !!this.attributes[attrName].hasValue;
};
_proto.value = function value(attrName) {
var attr = this.attributes[attrName];
if (!attr) {
return true;
}
if (attr.hasValue) {
return attr.value;
}
return undefined;
};
return NodeAttributes;
}();
exports.default = NodeAttributes;

View File

@@ -0,0 +1,156 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.normalizeURL = normalizeURL;
exports.getUrlFromPagesDirectories = getUrlFromPagesDirectories;
exports.execOnce = execOnce;
var path = _interopRequireWildcard(require("path"));
var fs = _interopRequireWildcard(require("fs"));
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
return arr2;
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(n);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
// Cache for fs.lstatSync lookup.
// Prevent multiple blocking IO requests that have already been calculated.
var fsLstatSyncCache = {};
var fsLstatSync = function(source) {
fsLstatSyncCache[source] = fsLstatSyncCache[source] || fs.lstatSync(source);
return fsLstatSyncCache[source];
};
/**
* Checks if the source is a directory.
*/ function isDirectory(source) {
return fsLstatSync(source).isDirectory();
}
/**
* Checks if the source is a directory.
*/ function isSymlink(source) {
return fsLstatSync(source).isSymbolicLink();
}
// Cache for fs.readdirSync lookup.
// Prevent multiple blocking IO requests that have already been calculated.
var fsReadDirSyncCache = {};
/**
* Recursively parse directory for page URLs.
*/ function parseUrlForPages(urlprefix, directory) {
fsReadDirSyncCache[directory] = fsReadDirSyncCache[directory] || fs.readdirSync(directory);
var res = [];
fsReadDirSyncCache[directory].forEach(function(fname) {
// TODO: this should account for all page extensions
// not just js(x) and ts(x)
if (/(\.(j|t)sx?)$/.test(fname)) {
if (/^index(\.(j|t)sx?)$/.test(fname)) {
res.push("".concat(urlprefix).concat(fname.replace(/^index(\.(j|t)sx?)$/, "")));
}
res.push("".concat(urlprefix).concat(fname.replace(/(\.(j|t)sx?)$/, "")));
} else {
var dirPath = path.join(directory, fname);
if (isDirectory(dirPath) && !isSymlink(dirPath)) {
var _res;
(_res = res).push.apply(_res, _toConsumableArray(parseUrlForPages(urlprefix + fname + "/", dirPath)));
}
}
});
return res;
}
function normalizeURL(url) {
if (!url) {
return;
}
url = url.split("?")[0];
url = url.split("#")[0];
url = url = url.replace(/(\/index\.html)$/, "/");
// Empty URLs should not be trailed with `/`, e.g. `#heading`
if (url === "") {
return url;
}
url = url.endsWith("/") ? url : url + "/";
return url;
}
function getUrlFromPagesDirectories(urlPrefix, directories) {
return Array.from(// De-duplicate similar pages across multiple directories.
new Set(directories.map(function(directory) {
return parseUrlForPages(urlPrefix, directory);
}).flat().map(// Since the URLs are normalized we add `^` and `$` to the RegExp to make sure they match exactly.
function(url) {
return "^".concat(normalizeURL(url), "$");
}))).map(function(urlReg) {
urlReg = urlReg.replace(/\[.*\]/g, "((?!.+?\\..+?).*?)");
return new RegExp(urlReg);
});
}
function execOnce(fn) {
var used = false;
var result;
return function() {
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
args[_key] = arguments[_key];
}
if (!used) {
used = true;
result = fn.apply(void 0, _toConsumableArray(args));
}
return result;
};
}

View File

@@ -0,0 +1,25 @@
{
"name": "@next/eslint-plugin-next",
"version": "13.1.1",
"description": "ESLint plugin for NextJS.",
"main": "dist/index.js",
"license": "MIT",
"repository": {
"url": "vercel/next.js",
"directory": "packages/eslint-plugin-next"
},
"files": [
"dist"
],
"dependencies": {
"glob": "7.1.7"
},
"devDependencies": {
"@types/glob": "7.1.1",
"eslint": "7.24.0"
},
"scripts": {
"build": "swc -d dist src",
"prepublishOnly": "cd ../../ && turbo run build"
}
}

7
kitabcitab/node_modules/@next/font/README.md generated vendored Normal file
View File

@@ -0,0 +1,7 @@
# `@next/font`
`@next/font` includes built-in automatic self-hosting for any font file. This means you can optimally load web fonts with zero layout shift, thanks to the underlying CSS size-adjust property used.
This new font system also allows you to conveniently use all Google Fonts with performance and privacy in mind. CSS and font files are downloaded at build time and self-hosted with the rest of your static assets. No requests are sent to Google by the browser.
[Read more](https://beta.nextjs.org/docs/optimizing/fonts)

27733
kitabcitab/node_modules/@next/font/dist/fontkit/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

14825
kitabcitab/node_modules/@next/font/dist/google/index.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,3 @@
import type { FontLoader } from 'next/font';
declare const downloadGoogleFonts: FontLoader;
export default downloadGoogleFonts;

View File

@@ -0,0 +1,181 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// @ts-ignore
const font_utils_1 = require("next/dist/server/font-utils");
// @ts-ignore
const Log = __importStar(require("next/dist/build/output/log"));
// @ts-ignore
const chalk_1 = __importDefault(require("next/dist/compiled/chalk"));
const utils_1 = require("./utils");
const utils_2 = require("../utils");
const cssCache = new Map();
const fontCache = new Map();
// regexp is based on https://github.com/sindresorhus/escape-string-regexp
const reHasRegExp = /[|\\{}()[\]^$+*?.-]/;
const reReplaceRegExp = /[|\\{}()[\]^$+*?.-]/g;
function escapeStringRegexp(str) {
// see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23
if (reHasRegExp.test(str)) {
return str.replace(reReplaceRegExp, '\\$&');
}
return str;
}
const downloadGoogleFonts = async ({ functionName, data, config, emitFontFile, isDev, isServer, loaderContext, }) => {
var _a, _b, _c;
const subsets = (config === null || config === void 0 ? void 0 : config.subsets) || [];
const { fontFamily, weights, styles, display, preload, selectedVariableAxes, fallback, adjustFontFallback, variable, subsets: callSubsets, } = (0, utils_1.validateData)(functionName, data);
if (isServer && preload && !callSubsets && !(config === null || config === void 0 ? void 0 : config.subsets)) {
Log.warn(`The ${chalk_1.default.bold('@next/font/google')} font ${chalk_1.default.bold(fontFamily)} has no selected subsets. Please specify subsets in the function call or in your ${chalk_1.default.bold('next.config.js')}, otherwise no fonts will be preloaded. Read more: https://nextjs.org/docs/messages/google-fonts-missing-subsets`);
}
const fontAxes = (0, utils_1.getFontAxes)(fontFamily, weights, styles, selectedVariableAxes);
const url = (0, utils_1.getUrl)(fontFamily, fontAxes, display);
// Find fallback font metrics
let adjustFontFallbackMetrics;
if (adjustFontFallback) {
try {
const { ascent, descent, lineGap, fallbackFont, sizeAdjust } = (0, font_utils_1.calculateSizeAdjustValues)(require('next/dist/server/google-font-metrics.json')[fontFamily]);
adjustFontFallbackMetrics = {
fallbackFont,
ascentOverride: `${ascent}%`,
descentOverride: `${descent}%`,
lineGapOverride: `${lineGap}%`,
sizeAdjust: `${sizeAdjust}%`,
};
}
catch {
Log.error(`Failed to find font override values for font \`${fontFamily}\``);
}
}
const result = {
fallbackFonts: fallback,
weight: weights.length === 1 && weights[0] !== 'variable'
? weights[0]
: undefined,
style: styles.length === 1 ? styles[0] : undefined,
variable,
adjustFontFallback: adjustFontFallbackMetrics,
};
try {
const hasCachedCSS = cssCache.has(url);
let fontFaceDeclarations = hasCachedCSS
? cssCache.get(url)
: await (0, utils_1.fetchCSSFromGoogleFonts)(url, fontFamily).catch(() => null);
if (!hasCachedCSS) {
cssCache.set(url, fontFaceDeclarations);
}
else {
cssCache.delete(url);
}
if (fontFaceDeclarations === null) {
(0, utils_2.nextFontError)(`Failed to fetch \`${fontFamily}\` from Google Fonts.`);
}
// CSS Variables may be set on a body tag, ignore them to keep the CSS module pure
fontFaceDeclarations = fontFaceDeclarations.split('body {')[0];
// Find font files to download
const fontFiles = [];
let currentSubset = '';
for (const line of fontFaceDeclarations.split('\n')) {
// Each @font-face has the subset above it in a comment
const newSubset = (_a = /\/\* (.+?) \*\//.exec(line)) === null || _a === void 0 ? void 0 : _a[1];
if (newSubset) {
currentSubset = newSubset;
}
else {
const googleFontFileUrl = (_b = /src: url\((.+?)\)/.exec(line)) === null || _b === void 0 ? void 0 : _b[1];
if (googleFontFileUrl &&
!fontFiles.some((foundFile) => foundFile.googleFontFileUrl === googleFontFileUrl)) {
fontFiles.push({
googleFontFileUrl,
preloadFontFile: !!preload && (callSubsets !== null && callSubsets !== void 0 ? callSubsets : subsets).includes(currentSubset),
});
}
}
}
// Download font files
const downloadedFiles = await Promise.all(fontFiles.map(async ({ googleFontFileUrl, preloadFontFile }) => {
const hasCachedFont = fontCache.has(googleFontFileUrl);
const fontFileBuffer = hasCachedFont
? fontCache.get(googleFontFileUrl)
: await (0, utils_1.fetchFontFile)(googleFontFileUrl).catch(() => null);
if (!hasCachedFont) {
fontCache.set(googleFontFileUrl, fontFileBuffer);
}
else {
fontCache.delete(googleFontFileUrl);
}
if (fontFileBuffer === null) {
(0, utils_2.nextFontError)(`Failed to fetch \`${fontFamily}\` from Google Fonts.`);
}
const ext = /\.(woff|woff2|eot|ttf|otf)$/.exec(googleFontFileUrl)[1];
// Emit font file to .next/static/media
const selfHostedFileUrl = emitFontFile(fontFileBuffer, ext, preloadFontFile);
return {
googleFontFileUrl,
selfHostedFileUrl,
};
}));
// Replace @font-face sources with self-hosted files
let updatedCssResponse = fontFaceDeclarations;
for (const { googleFontFileUrl, selfHostedFileUrl } of downloadedFiles) {
updatedCssResponse = updatedCssResponse.replace(new RegExp(escapeStringRegexp(googleFontFileUrl), 'g'), selfHostedFileUrl);
}
return {
...result,
css: updatedCssResponse,
};
}
catch (err) {
loaderContext.cacheable(false);
if (isDev) {
if (isServer) {
Log.error(`Failed to download \`${fontFamily}\` from Google Fonts. Using fallback font instead.`);
}
// In dev we should return the fallback font instead of throwing an error
let css = `@font-face {
font-family: '${fontFamily} Fallback';
src: local("${(_c = adjustFontFallbackMetrics === null || adjustFontFallbackMetrics === void 0 ? void 0 : adjustFontFallbackMetrics.fallbackFont) !== null && _c !== void 0 ? _c : 'Arial'}");`;
if (adjustFontFallbackMetrics) {
css += `
ascent-override:${adjustFontFallbackMetrics.ascentOverride};
descent-override:${adjustFontFallbackMetrics.descentOverride};
line-gap-override:${adjustFontFallbackMetrics.lineGapOverride};
size-adjust:${adjustFontFallbackMetrics.sizeAdjust};`;
}
css += '\n}';
return {
...result,
css,
};
}
else {
throw err;
}
}
};
exports.default = downloadGoogleFonts;

View File

@@ -0,0 +1,27 @@
/// <reference types="node" />
declare type FontOptions = {
fontFamily: string;
weights: string[];
styles: string[];
display: string;
preload: boolean;
selectedVariableAxes?: string[];
fallback?: string[];
adjustFontFallback: boolean;
variable?: string;
subsets?: string[];
};
export declare function validateData(functionName: string, data: any): FontOptions;
export declare function getUrl(fontFamily: string, axes: {
wght?: string[];
ital?: string[];
variableAxes?: [string, string][];
}, display: string): string;
export declare function fetchCSSFromGoogleFonts(url: string, fontFamily: string): Promise<any>;
export declare function fetchFontFile(url: string): Promise<Buffer>;
export declare function getFontAxes(fontFamily: string, weights: string[], styles: string[], selectedVariableAxes?: string[]): {
wght?: string[];
ital?: string[];
variableAxes?: [string, string][];
};
export {};

219
kitabcitab/node_modules/@next/font/dist/google/utils.js generated vendored Normal file
View File

@@ -0,0 +1,219 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFontAxes = exports.fetchFontFile = exports.fetchCSSFromGoogleFonts = exports.getUrl = exports.validateData = void 0;
const fs_1 = __importDefault(require("fs"));
// @ts-ignore
const node_fetch_1 = __importDefault(require("next/dist/compiled/node-fetch"));
const utils_1 = require("../utils");
const font_data_json_1 = __importDefault(require("./font-data.json"));
const allowedDisplayValues = ['auto', 'block', 'swap', 'fallback', 'optional'];
const formatValues = (values) => values.map((val) => `\`${val}\``).join(', ');
function validateData(functionName, data) {
let { weight, style, display = 'optional', preload = true, axes, fallback, adjustFontFallback = true, variable, subsets, } = data[0] || {};
if (functionName === '') {
(0, utils_1.nextFontError)(`@next/font/google has no default export`);
}
const fontFamily = functionName.replace(/_/g, ' ');
const fontFamilyData = font_data_json_1.default[fontFamily];
const fontWeights = fontFamilyData === null || fontFamilyData === void 0 ? void 0 : fontFamilyData.weights;
if (!fontWeights) {
(0, utils_1.nextFontError)(`Unknown font \`${fontFamily}\``);
}
const fontStyles = fontFamilyData.styles;
const weights = !weight
? []
: [...new Set(Array.isArray(weight) ? weight : [weight])];
const styles = !style
? []
: [...new Set(Array.isArray(style) ? style : [style])];
if (weights.length === 0) {
// Set variable as default, throw if not available
if (fontWeights.includes('variable')) {
weights.push('variable');
}
else {
(0, utils_1.nextFontError)(`Missing weight for font \`${fontFamily}\`.\nAvailable weights: ${formatValues(fontWeights)}`);
}
}
if (weights.length > 1 && weights.includes('variable')) {
(0, utils_1.nextFontError)(`Unexpected \`variable\` in weight array for font \`${fontFamily}\`. You only need \`variable\`, it includes all available weights.`);
}
weights.forEach((selectedWeight) => {
if (!fontWeights.includes(selectedWeight)) {
(0, utils_1.nextFontError)(`Unknown weight \`${selectedWeight}\` for font \`${fontFamily}\`.\nAvailable weights: ${formatValues(fontWeights)}`);
}
});
if (styles.length === 0) {
if (fontStyles.length === 1) {
styles.push(fontStyles[0]);
}
else {
styles.push('normal');
}
}
styles.forEach((selectedStyle) => {
if (!fontStyles.includes(selectedStyle)) {
(0, utils_1.nextFontError)(`Unknown style \`${selectedStyle}\` for font \`${fontFamily}\`.\nAvailable styles: ${formatValues(fontStyles)}`);
}
});
if (!allowedDisplayValues.includes(display)) {
(0, utils_1.nextFontError)(`Invalid display value \`${display}\` for font \`${fontFamily}\`.\nAvailable display values: ${formatValues(allowedDisplayValues)}`);
}
if (weights[0] !== 'variable' && axes) {
(0, utils_1.nextFontError)('Axes can only be defined for variable fonts');
}
return {
fontFamily,
weights,
styles,
display,
preload,
selectedVariableAxes: axes,
fallback,
adjustFontFallback,
variable,
subsets,
};
}
exports.validateData = validateData;
function getUrl(fontFamily, axes, display) {
var _a, _b;
// Variants are all combinations of weight and style, each variant will result in a separate font file
const variants = [];
if (axes.wght) {
for (const wgth of axes.wght) {
if (!axes.ital) {
variants.push([['wght', wgth], ...((_a = axes.variableAxes) !== null && _a !== void 0 ? _a : [])]);
}
else {
for (const ital of axes.ital) {
variants.push([
['ital', ital],
['wght', wgth],
...((_b = axes.variableAxes) !== null && _b !== void 0 ? _b : []),
]);
}
}
}
}
else if (axes.variableAxes) {
// Variable fonts might not have a range of weights, just add optional variable axes in that case
variants.push([...axes.variableAxes]);
}
// Google api requires the axes to be sorted, starting with lowercase words
if (axes.variableAxes) {
variants.forEach((variant) => {
variant.sort(([a], [b]) => {
const aIsLowercase = a.charCodeAt(0) > 96;
const bIsLowercase = b.charCodeAt(0) > 96;
if (aIsLowercase && !bIsLowercase)
return -1;
if (bIsLowercase && !aIsLowercase)
return 1;
return a > b ? 1 : -1;
});
});
}
let url = `https://fonts.googleapis.com/css2?family=${fontFamily.replace(/ /g, '+')}`;
if (variants.length > 0) {
url = `${url}:${variants[0].map(([key]) => key).join(',')}@${variants
.map((variant) => variant.map(([, val]) => val).join(','))
.sort()
.join(';')}`;
}
url = `${url}&display=${display}`;
return url;
}
exports.getUrl = getUrl;
async function fetchCSSFromGoogleFonts(url, fontFamily) {
let mockedResponse;
if (process.env.NEXT_FONT_GOOGLE_MOCKED_RESPONSES) {
const mockFile = require(process.env.NEXT_FONT_GOOGLE_MOCKED_RESPONSES);
mockedResponse = mockFile[url];
if (!mockedResponse) {
(0, utils_1.nextFontError)('Missing mocked response for URL: ' + url);
}
}
let cssResponse;
if (mockedResponse) {
cssResponse = mockedResponse;
}
else {
const res = await (0, node_fetch_1.default)(url, {
headers: {
// The file format is based off of the user agent, make sure woff2 files are fetched
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36',
},
});
if (!res.ok) {
(0, utils_1.nextFontError)(`Failed to fetch font \`${fontFamily}\`.\nURL: ${url}`);
}
cssResponse = await res.text();
}
return cssResponse;
}
exports.fetchCSSFromGoogleFonts = fetchCSSFromGoogleFonts;
async function fetchFontFile(url) {
if (process.env.NEXT_FONT_GOOGLE_MOCKED_RESPONSES) {
if (url.startsWith('/')) {
return fs_1.default.readFileSync(url);
}
return Buffer.from(url);
}
const arrayBuffer = await (0, node_fetch_1.default)(url).then((r) => r.arrayBuffer());
return Buffer.from(arrayBuffer);
}
exports.fetchFontFile = fetchFontFile;
function getFontAxes(fontFamily, weights, styles, selectedVariableAxes) {
const allAxes = font_data_json_1.default[fontFamily].axes;
const hasItalic = styles.includes('italic');
const hasNormal = styles.includes('normal');
const ital = hasItalic ? [...(hasNormal ? ['0'] : []), '1'] : undefined;
// Weights will always contain one element if it's a variable font
if (weights[0] === 'variable') {
if (selectedVariableAxes) {
const defineAbleAxes = allAxes
.map(({ tag }) => tag)
.filter((tag) => tag !== 'wght');
if (defineAbleAxes.length === 0) {
(0, utils_1.nextFontError)(`Font \`${fontFamily}\` has no definable \`axes\``);
}
if (!Array.isArray(selectedVariableAxes)) {
(0, utils_1.nextFontError)(`Invalid axes value for font \`${fontFamily}\`, expected an array of axes.\nAvailable axes: ${formatValues(defineAbleAxes)}`);
}
selectedVariableAxes.forEach((key) => {
if (!defineAbleAxes.some((tag) => tag === key)) {
(0, utils_1.nextFontError)(`Invalid axes value \`${key}\` for font \`${fontFamily}\`.\nAvailable axes: ${formatValues(defineAbleAxes)}`);
}
});
}
let weightAxis;
let variableAxes;
for (const { tag, min, max } of allAxes) {
if (tag === 'wght') {
weightAxis = `${min}..${max}`;
}
else if (selectedVariableAxes === null || selectedVariableAxes === void 0 ? void 0 : selectedVariableAxes.includes(tag)) {
if (!variableAxes) {
variableAxes = [];
}
variableAxes.push([tag, `${min}..${max}`]);
}
}
return {
wght: weightAxis ? [weightAxis] : undefined,
ital,
variableAxes,
};
}
else {
return {
ital,
wght: weights,
};
}
}
exports.getFontAxes = getFontAxes;

View File

@@ -0,0 +1,21 @@
import type { CssVariable, Display, NextFont, NextFontWithVariable } from '../types';
declare type LocalFont<T extends CssVariable | undefined = undefined> = {
src: string | Array<{
path: string;
weight?: string;
style?: string;
}>;
display?: Display;
weight?: string;
style?: string;
adjustFontFallback?: 'Arial' | 'Times New Roman' | false;
fallback?: string[];
preload?: boolean;
variable?: T;
declarations?: Array<{
prop: string;
value: string;
}>;
};
export default function localFont<T extends CssVariable | undefined = undefined>(options: LocalFont<T>): T extends undefined ? NextFont : NextFontWithVariable;
export {};

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function localFont(options) {
throw new Error();
}
exports.default = localFont;

View File

@@ -0,0 +1,3 @@
import type { FontLoader } from 'next/font';
declare const fetchFonts: FontLoader;
export default fetchFonts;

127
kitabcitab/node_modules/@next/font/dist/local/loader.js generated vendored Normal file
View File

@@ -0,0 +1,127 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// @ts-ignore
// eslint-disable-next-line import/no-extraneous-dependencies
const fontkit_1 = __importDefault(require("@next/font/dist/fontkit"));
const util_1 = require("util");
const utils_1 = require("./utils");
const utils_2 = require("../utils");
const NORMAL_WEIGHT = 400;
const BOLD_WEIGHT = 700;
function getWeightNumber(weight) {
// Weight can be 'normal', 'bold' or a number https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight
return weight === 'normal'
? NORMAL_WEIGHT
: weight === 'bold'
? BOLD_WEIGHT
: Number(weight);
}
function getDistanceFromNormalWeight(weight) {
if (!weight)
return 0;
const [firstWeight, secondWeight] = weight
.trim()
.split(/ +/)
.map(getWeightNumber);
if (Number.isNaN(firstWeight) || Number.isNaN(secondWeight)) {
(0, utils_2.nextFontError)(`Invalid weight value in src array: \`${weight}\`.\nExpected \`normal\`, \`bold\` or a number.`);
}
// Not a variable font
if (!secondWeight) {
return firstWeight - NORMAL_WEIGHT;
}
// Normal weight is within variable font range
if (firstWeight <= NORMAL_WEIGHT && secondWeight >= NORMAL_WEIGHT) {
return 0;
}
// Return the distance of normal weight to the variable font range
const firstWeightDistance = firstWeight - NORMAL_WEIGHT;
const secondWeightDistance = secondWeight - NORMAL_WEIGHT;
if (Math.abs(firstWeightDistance) < Math.abs(secondWeightDistance)) {
return firstWeightDistance;
}
return secondWeightDistance;
}
const fetchFonts = async ({ functionName, variableName, data, emitFontFile, resolve, loaderContext, }) => {
const { src, display, fallback, preload, variable, adjustFontFallback, declarations, weight: defaultWeight, style: defaultStyle, } = (0, utils_1.validateData)(functionName, data[0]);
const fontFiles = await Promise.all(src.map(async ({ path, style, weight, ext, format }) => {
const resolved = await resolve(path);
const fileBuffer = await (0, util_1.promisify)(loaderContext.fs.readFile)(resolved);
const fontUrl = emitFontFile(fileBuffer, ext, preload);
let fontMetadata;
try {
fontMetadata = (0, fontkit_1.default)(fileBuffer);
}
catch (e) {
console.error(`Failed to load font file: ${resolved}\n${e}`);
}
const fontFaceProperties = [
...(declarations
? declarations.map(({ prop, value }) => [prop, value])
: []),
['font-family', variableName],
['src', `url(${fontUrl}) format('${format}')`],
['font-display', display],
...((weight !== null && weight !== void 0 ? weight : defaultWeight)
? [['font-weight', weight !== null && weight !== void 0 ? weight : defaultWeight]]
: []),
...((style !== null && style !== void 0 ? style : defaultStyle)
? [['font-style', style !== null && style !== void 0 ? style : defaultStyle]]
: []),
];
return {
css: `@font-face {
${fontFaceProperties
.map(([property, value]) => `${property}: ${value};`)
.join('\n')}
}\n`,
fontMetadata,
weight,
style,
};
}));
// Add fallback font
let adjustFontFallbackMetrics;
if (adjustFontFallback !== false) {
// Pick the font file to generate a fallback font from.
// Prefer the file closest to normal weight, this will typically make up most of the text on a page.
const fallbackFontFile = fontFiles.reduce((usedFontFile, currentFontFile) => {
if (!usedFontFile)
return currentFontFile;
const usedFontDistance = getDistanceFromNormalWeight(usedFontFile.weight);
const currentFontDistance = getDistanceFromNormalWeight(currentFontFile.weight);
// Prefer normal style if they have the same weight
if (usedFontDistance === currentFontDistance &&
(typeof currentFontFile.style === 'undefined' ||
currentFontFile.style === 'normal')) {
return currentFontFile;
}
const absUsedDistance = Math.abs(usedFontDistance);
const absCurrentDistance = Math.abs(currentFontDistance);
// Use closest absolute distance to normal weight
if (absCurrentDistance < absUsedDistance)
return currentFontFile;
// Prefer the thinner font if both are the same absolute distance from normal weight
if (absUsedDistance === absCurrentDistance &&
currentFontDistance < usedFontDistance) {
return currentFontFile;
}
return usedFontFile;
});
if (fallbackFontFile.fontMetadata) {
adjustFontFallbackMetrics = (0, utils_2.calculateFallbackFontValues)(fallbackFontFile.fontMetadata, adjustFontFallback === 'Times New Roman' ? 'serif' : 'sans-serif');
}
}
return {
css: fontFiles.map(({ css }) => css).join('\n'),
fallbackFonts: fallback,
weight: src.length === 1 ? src[0].weight : undefined,
style: src.length === 1 ? src[0].style : undefined,
variable,
adjustFontFallback: adjustFontFallbackMetrics,
};
};
exports.default = fetchFonts;

View File

@@ -0,0 +1,22 @@
declare type FontOptions = {
src: Array<{
path: string;
weight?: string;
style?: string;
ext: string;
format: string;
}>;
display: string;
weight?: string;
style?: string;
fallback?: string[];
preload: boolean;
variable?: string;
adjustFontFallback?: string | false;
declarations?: Array<{
prop: string;
value: string;
}>;
};
export declare function validateData(functionName: string, fontData: any): FontOptions;
export {};

70
kitabcitab/node_modules/@next/font/dist/local/utils.js generated vendored Normal file
View File

@@ -0,0 +1,70 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateData = void 0;
const utils_1 = require("../utils");
const allowedDisplayValues = ['auto', 'block', 'swap', 'fallback', 'optional'];
const formatValues = (values) => values.map((val) => `\`${val}\``).join(', ');
const extToFormat = {
woff: 'woff',
woff2: 'woff2',
ttf: 'truetype',
otf: 'opentype',
eot: 'embedded-opentype',
};
function validateData(functionName, fontData) {
if (functionName) {
(0, utils_1.nextFontError)(`@next/font/local has no named exports`);
}
let { src, display = 'optional', weight, style, fallback, preload = true, variable, adjustFontFallback, declarations, } = fontData || {};
if (!allowedDisplayValues.includes(display)) {
(0, utils_1.nextFontError)(`Invalid display value \`${display}\`.\nAvailable display values: ${formatValues(allowedDisplayValues)}`);
}
if (!src) {
(0, utils_1.nextFontError)('Missing required `src` property');
}
if (!Array.isArray(src)) {
src = [{ path: src, weight, style }];
}
else {
if (src.length === 0) {
(0, utils_1.nextFontError)('Unexpected empty `src` array.');
}
}
src = src.map((fontFile) => {
var _a;
const ext = (_a = /\.(woff|woff2|eot|ttf|otf)$/.exec(fontFile.path)) === null || _a === void 0 ? void 0 : _a[1];
if (!ext) {
(0, utils_1.nextFontError)(`Unexpected file \`${fontFile.path}\``);
}
return {
...fontFile,
ext,
format: extToFormat[ext],
};
});
if (Array.isArray(declarations)) {
declarations.forEach((declaration) => {
if ([
'font-family',
'src',
'font-display',
'font-weight',
'font-style',
].includes(declaration === null || declaration === void 0 ? void 0 : declaration.prop)) {
(0, utils_1.nextFontError)(`Invalid declaration prop: \`${declaration.prop}\``);
}
});
}
return {
src,
display,
weight,
style,
fallback,
preload,
variable,
adjustFontFallback,
declarations,
};
}
exports.validateData = validateData;

13
kitabcitab/node_modules/@next/font/dist/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
export declare type CssVariable = `--${string}`;
export declare type Display = 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
export declare type NextFont = {
className: string;
style: {
fontFamily: string;
fontWeight?: number;
fontStyle?: string;
};
};
export declare type NextFontWithVariable = NextFont & {
variable: string;
};

2
kitabcitab/node_modules/@next/font/dist/types.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

4
kitabcitab/node_modules/@next/font/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import type { Font } from 'fontkit';
import type { AdjustFontFallback } from 'next/font';
export declare function calculateFallbackFontValues(font: Font, category?: string): AdjustFontFallback;
export declare function nextFontError(message: string): never;

59
kitabcitab/node_modules/@next/font/dist/utils.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.nextFontError = exports.calculateFallbackFontValues = void 0;
const DEFAULT_SANS_SERIF_FONT = {
name: 'Arial',
azAvgWidth: 934.5116279069767,
unitsPerEm: 2048,
};
const DEFAULT_SERIF_FONT = {
name: 'Times New Roman',
azAvgWidth: 854.3953488372093,
unitsPerEm: 2048,
};
function calcAverageWidth(font) {
try {
const avgCharacters = 'aaabcdeeeefghiijklmnnoopqrrssttuvwxyz ';
const hasAllChars = font
.glyphsForString(avgCharacters)
.flatMap((glyph) => glyph.codePoints)
.every((codePoint) => font.hasGlyphForCodePoint(codePoint));
if (!hasAllChars)
return undefined;
const widths = font
.glyphsForString(avgCharacters)
.map((glyph) => glyph.advanceWidth);
const totalWidth = widths.reduce((sum, width) => sum + width, 0);
return totalWidth / widths.length;
}
catch {
// Could not calculate average width from the font file, skip size-adjust
return undefined;
}
}
function formatOverrideValue(val) {
return Math.abs(val * 100).toFixed(2) + '%';
}
function calculateFallbackFontValues(font, category = 'serif') {
const fallbackFont = category === 'serif' ? DEFAULT_SERIF_FONT : DEFAULT_SANS_SERIF_FONT;
const azAvgWidth = calcAverageWidth(font);
const { ascent, descent, lineGap, unitsPerEm } = font;
const fallbackFontAvgWidth = fallbackFont.azAvgWidth / fallbackFont.unitsPerEm;
let sizeAdjust = azAvgWidth
? azAvgWidth / unitsPerEm / fallbackFontAvgWidth
: 1;
return {
ascentOverride: formatOverrideValue(ascent / (unitsPerEm * sizeAdjust)),
descentOverride: formatOverrideValue(descent / (unitsPerEm * sizeAdjust)),
lineGapOverride: formatOverrideValue(lineGap / (unitsPerEm * sizeAdjust)),
fallbackFont: fallbackFont.name,
sizeAdjust: formatOverrideValue(sizeAdjust),
};
}
exports.calculateFallbackFontValues = calculateFallbackFontValues;
function nextFontError(message) {
const err = new Error(message);
err.name = 'NextFontError';
throw err;
}
exports.nextFontError = nextFontError;

1
kitabcitab/node_modules/@next/font/google/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from '../dist/google'

15
kitabcitab/node_modules/@next/font/google/index.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
// Validate next version
const semver = require('next/dist/compiled/semver')
if (semver.lt(require('next/package.json').version, '13.0.0')) {
throw new Error('`@next/font` is only available in Next.js 13 and newer.')
}
let message = '@next/font/google failed to run or is incorrectly configured.'
if (process.env.NODE_ENV === 'development') {
message +=
'\nIf you just installed `@next/font`, please try restarting `next dev` and resaving your file.'
}
message += `\n\nRead more: https://nextjs.org/docs/basic-features/font-optimization`
throw new Error(message)

View File

@@ -0,0 +1 @@
export { default } from '../dist/google/loader'

1
kitabcitab/node_modules/@next/font/google/loader.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('../dist/google/loader')

1
kitabcitab/node_modules/@next/font/google/target.css generated vendored Normal file
View File

@@ -0,0 +1 @@
/* target file for webpack loader */

1
kitabcitab/node_modules/@next/font/local/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export { default } from '../dist/local/index'

15
kitabcitab/node_modules/@next/font/local/index.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
// Validate next version
const semver = require('next/dist/compiled/semver')
if (semver.lt(require('next/package.json').version, '13.0.0')) {
throw new Error('`@next/font` is only available in Next.js 13 and newer.')
}
let message = '@next/font/local failed to run or is incorrectly configured.'
if (process.env.NODE_ENV === 'development') {
message +=
'\nIf you just installed `@next/font`, please try restarting `next dev` and resaving your file.'
}
message += `\n\nRead more: https://nextjs.org/docs/basic-features/font-optimization`
throw new Error(message)

1
kitabcitab/node_modules/@next/font/local/loader.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export { default } from '../dist/local/loader'

1
kitabcitab/node_modules/@next/font/local/loader.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('../dist/local/loader')

1
kitabcitab/node_modules/@next/font/local/target.css generated vendored Normal file
View File

@@ -0,0 +1 @@
/* target file for webpack loader */

26
kitabcitab/node_modules/@next/font/package.json generated vendored Normal file
View File

@@ -0,0 +1,26 @@
{
"name": "@next/font",
"version": "13.1.1",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
},
"files": [
"dist",
"google",
"local"
],
"license": "MIT",
"scripts": {
"build": "rimraf dist && pnpm ncc-fontkit && tsc -d -p tsconfig.json",
"prepublishOnly": "cd ../../ && turbo run build",
"dev": "pnpm ncc-fontkit && tsc -d -w -p tsconfig.json",
"typescript": "tsec --noEmit -p tsconfig.json",
"ncc-fontkit": "ncc build ./fontkit.js -o dist/fontkit"
},
"devDependencies": {
"@types/fontkit": "2.0.0",
"@vercel/ncc": "0.34.0",
"fontkit": "2.0.2"
}
}

View File

@@ -0,0 +1,3 @@
# `@next/swc-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `@next/swc`

Binary file not shown.

View File

@@ -0,0 +1,21 @@
{
"name": "@next/swc-linux-x64-gnu",
"version": "13.1.1",
"os": [
"linux"
],
"cpu": [
"x64"
],
"libc": [
"glibc"
],
"main": "next-swc.linux-x64-gnu.node",
"files": [
"next-swc.linux-x64-gnu.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@@ -0,0 +1,3 @@
# `@next/swc-linux-x64-musl`
This is the **linux-x64-musl** binary for `@next/swc`

Binary file not shown.

View File

@@ -0,0 +1,21 @@
{
"name": "@next/swc-linux-x64-musl",
"version": "13.1.1",
"os": [
"linux"
],
"cpu": [
"x64"
],
"libc": [
"musl"
],
"main": "next-swc.linux-x64-musl.node",
"files": [
"next-swc.linux-x64-musl.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}