mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
build: fix EsLint rule and add fixer (#11826)
This commit is contained in:
parent
197f00547e
commit
b2c69fe5bd
11
.eslintrc.js
11
.eslintrc.js
@ -172,8 +172,6 @@ module.exports = {
|
|||||||
curly: ['error', 'all'],
|
curly: ['error', 'all'],
|
||||||
// Brackets keep code readable and `return` intentions clear.
|
// Brackets keep code readable and `return` intentions clear.
|
||||||
'arrow-body-style': ['error', 'always'],
|
'arrow-body-style': ['error', 'always'],
|
||||||
// Error if comments do not adhere to `tsdoc`.
|
|
||||||
'tsdoc/syntax': 'error',
|
|
||||||
// Keeps array types simple only when they are simple for readability.
|
// Keeps array types simple only when they are simple for readability.
|
||||||
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}],
|
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}],
|
||||||
'no-unused-vars': 'off',
|
'no-unused-vars': 'off',
|
||||||
@ -277,5 +275,14 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// Applies to only published packages
|
||||||
|
files: ['packages/**/*.ts'],
|
||||||
|
rules: {
|
||||||
|
// Error if comments do not adhere to `tsdoc`.
|
||||||
|
'tsdoc/syntax': 'error',
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
const puppeteer = require('puppeteer');
|
const puppeteer = require('puppeteer');
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
const puppeteer = require('puppeteer');
|
const puppeteer = require('puppeteer');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
8
package-lock.json
generated
8
package-lock.json
generated
@ -10893,7 +10893,7 @@
|
|||||||
"@types/yargs": "17.0.32"
|
"@types/yargs": "17.0.32"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.17.1"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/browsers/node_modules/cliui": {
|
"packages/browsers/node_modules/cliui": {
|
||||||
@ -10945,7 +10945,7 @@
|
|||||||
"@schematics/angular": "^17.0.7"
|
"@schematics/angular": "^17.0.7"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.17.1"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/ng-schematics/node_modules/@angular-devkit/architect": {
|
"packages/ng-schematics/node_modules/@angular-devkit/architect": {
|
||||||
@ -11382,7 +11382,7 @@
|
|||||||
"@types/node": "18.17.15"
|
"@types/node": "18.17.15"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.17.1"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/puppeteer-core": {
|
"packages/puppeteer-core": {
|
||||||
@ -11405,7 +11405,7 @@
|
|||||||
"rxjs": "7.8.1"
|
"rxjs": "7.8.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.17.1"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/puppeteer-core/node_modules/@types/node": {
|
"packages/puppeteer-core/node_modules/@types/node": {
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import debug from 'debug';
|
import debug from 'debug';
|
||||||
|
|
||||||
export const mochaHooks = {
|
export const mochaHooks = {
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {spawn} from 'child_process';
|
import {spawn} from 'child_process';
|
||||||
import {normalize, join} from 'path';
|
import {normalize, join} from 'path';
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {describe, it} from 'node:test';
|
import {describe, it} from 'node:test';
|
||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {describe, it} from 'node:test';
|
import {describe, it} from 'node:test';
|
||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {describe, it} from 'node:test';
|
import {describe, it} from 'node:test';
|
||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import https from 'https';
|
import https from 'https';
|
||||||
import {before, after} from 'node:test';
|
import {before, after} from 'node:test';
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
15
packages/ng-schematics/test/tsdoc.json
Normal file
15
packages/ng-schematics/test/tsdoc.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||||
|
|
||||||
|
"extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"],
|
||||||
|
"tagDefinitions": [
|
||||||
|
{
|
||||||
|
"tagName": "@license",
|
||||||
|
"syntaxKind": "modifier",
|
||||||
|
"allowMultiple": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"supportForTags": {
|
||||||
|
"@license": true
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {mkdir, readFile, readdir, writeFile} from 'fs/promises';
|
import {mkdir, readFile, readdir, writeFile} from 'fs/promises';
|
||||||
import {join} from 'path/posix';
|
import {join} from 'path/posix';
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import type {ProtocolMapping} from 'devtools-protocol/types/protocol-mapping.js';
|
import type {ProtocolMapping} from 'devtools-protocol/types/protocol-mapping.js';
|
||||||
|
|
||||||
import type {Connection} from '../cdp/Connection.js';
|
import type {Connection} from '../cdp/Connection.js';
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
||||||
import type ProtocolMapping from 'devtools-protocol/types/protocol-mapping.js';
|
import type ProtocolMapping from 'devtools-protocol/types/protocol-mapping.js';
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
||||||
|
|
||||||
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {JSHandle} from '../api/JSHandle.js';
|
import {JSHandle} from '../api/JSHandle.js';
|
||||||
import {debugError} from '../common/util.js';
|
import {debugError} from '../common/util.js';
|
||||||
import {DisposableStack} from '../util/disposable.js';
|
import {DisposableStack} from '../util/disposable.js';
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {source as injectedSource} from '../generated/injected.js';
|
import {source as injectedSource} from '../generated/injected.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
const HIDDEN_VISIBILITY_VALUES = ['hidden', 'collapse'];
|
const HIDDEN_VISIBILITY_VALUES = ['hidden', 'collapse'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {TimeoutError} from '../common/Errors.js';
|
import {TimeoutError} from '../common/Errors.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {Deferred} from './Deferred.js';
|
import {Deferred} from './Deferred.js';
|
||||||
import {disposeSymbol} from './disposable.js';
|
import {disposeSymbol} from './disposable.js';
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
// eslint-disable-next-line no-restricted-imports
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import {EventEmitter as NodeEventEmitter} from 'node:events';
|
import {EventEmitter as NodeEventEmitter} from 'node:events';
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {expectNotType, expectType} from 'tsd';
|
import {expectNotType, expectType} from 'tsd';
|
||||||
|
|
||||||
import type {ElementHandle} from 'puppeteer';
|
import type {ElementHandle} from 'puppeteer';
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {expectNotAssignable, expectNotType, expectType} from 'tsd';
|
import {expectNotAssignable, expectNotType, expectType} from 'tsd';
|
||||||
|
|
||||||
import type {ElementHandle, JSHandle} from 'puppeteer';
|
import type {ElementHandle, JSHandle} from 'puppeteer';
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {expectType, expectNotType} from 'tsd';
|
import {expectType, expectNotType} from 'tsd';
|
||||||
|
|
||||||
import type {NodeFor} from 'puppeteer';
|
import type {NodeFor} from 'puppeteer';
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {expectType} from 'tsd';
|
import {expectType} from 'tsd';
|
||||||
|
|
||||||
import puppeteer, {
|
import puppeteer, {
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
rules: {
|
rules: {
|
||||||
'no-restricted-imports': [
|
'no-restricted-imports': [
|
||||||
|
5
test/fixtures/closeme.js
vendored
5
test/fixtures/closeme.js
vendored
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
(async () => {
|
(async () => {
|
||||||
const [, , puppeteerRoot, options] = process.argv;
|
const [, , puppeteerRoot, options] = process.argv;
|
||||||
const browser = await require(puppeteerRoot).launch(JSON.parse(options));
|
const browser = await require(puppeteerRoot).launch(JSON.parse(options));
|
||||||
|
5
test/fixtures/dumpio.js
vendored
5
test/fixtures/dumpio.js
vendored
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
(async () => {
|
(async () => {
|
||||||
const [, , puppeteerRoot, options] = process.argv;
|
const [, , puppeteerRoot, options] = process.argv;
|
||||||
const browser = await require(puppeteerRoot).launch(JSON.parse(options));
|
const browser = await require(puppeteerRoot).launch(JSON.parse(options));
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -11,15 +11,16 @@ const createRule = ESLintUtils.RuleCreator(name => {
|
|||||||
return `https://github.com/puppeteer/puppeteer/tree/main/tools/eslint/${name}.ts`;
|
return `https://github.com/puppeteer/puppeteer/tree/main/tools/eslint/${name}.ts`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const copyrightPattern = /Copyright ([0-9]{4}) Google Inc\./;
|
const currentYear = new Date().getFullYear();
|
||||||
|
|
||||||
// const currentYear = new Date().getFullYear;
|
// Needs to start and end with new line
|
||||||
|
const licenseHeader = `
|
||||||
// const licenseHeader = `/**
|
/**
|
||||||
// * @license
|
* @license
|
||||||
// * Copyright ${currentYear} Google Inc.
|
* Copyright ${currentYear} Google Inc.
|
||||||
// * SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// */`;
|
*/
|
||||||
|
`;
|
||||||
|
|
||||||
const enforceLicenseRule = createRule<[], 'licenseRule'>({
|
const enforceLicenseRule = createRule<[], 'licenseRule'>({
|
||||||
name: 'check-license',
|
name: 'check-license',
|
||||||
@ -29,7 +30,7 @@ const enforceLicenseRule = createRule<[], 'licenseRule'>({
|
|||||||
description: 'Validate existence of license header',
|
description: 'Validate existence of license header',
|
||||||
requiresTypeChecking: false,
|
requiresTypeChecking: false,
|
||||||
},
|
},
|
||||||
fixable: undefined, // TODO: change to 'code' once fixer works.
|
fixable: 'code',
|
||||||
schema: [],
|
schema: [],
|
||||||
messages: {
|
messages: {
|
||||||
licenseRule: 'Add license header.',
|
licenseRule: 'Add license header.',
|
||||||
@ -39,16 +40,26 @@ const enforceLicenseRule = createRule<[], 'licenseRule'>({
|
|||||||
create(context) {
|
create(context) {
|
||||||
const sourceCode = context.sourceCode;
|
const sourceCode = context.sourceCode;
|
||||||
const comments = sourceCode.getAllComments();
|
const comments = sourceCode.getAllComments();
|
||||||
const header =
|
let insertAfter = [0, 0] as TSESTree.Range;
|
||||||
comments[0]?.type === 'Block' && isHeaderComment(comments[0])
|
let header: TSESTree.Comment | null = null;
|
||||||
? comments[0]
|
// Check only the first 2 comments
|
||||||
: null;
|
for (let index = 0; index < 2; index++) {
|
||||||
|
const comment = comments[index];
|
||||||
function isHeaderComment(comment: TSESTree.Comment) {
|
if (!comment) {
|
||||||
if (comment && comment.range[0] >= 0 && comment.range[1] <= 88) {
|
break;
|
||||||
return true;
|
}
|
||||||
} else {
|
// Shebang comments should be at the top
|
||||||
return false;
|
if (
|
||||||
|
// Types don't have it debugger showed it...
|
||||||
|
(comment.type as string) === 'Shebang' ||
|
||||||
|
(comment.type === 'Line' && comment.value.startsWith('#!'))
|
||||||
|
) {
|
||||||
|
insertAfter = comment.range;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (comment.type === 'Block') {
|
||||||
|
header = comment;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,23 +67,21 @@ const enforceLicenseRule = createRule<[], 'licenseRule'>({
|
|||||||
Program(node) {
|
Program(node) {
|
||||||
if (
|
if (
|
||||||
header &&
|
header &&
|
||||||
header.value.includes('@license') &&
|
(header.value.includes('@license') ||
|
||||||
header.value.includes('SPDX-License-Identifier: Apache-2.0') &&
|
header.value.includes('License') ||
|
||||||
copyrightPattern.test(header.value)
|
header.value.includes('Copyright'))
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add header license
|
// Add header license
|
||||||
if (!header || !header.value.includes('@license')) {
|
if (!header || !header.value.includes('@license')) {
|
||||||
// const startLoc: [number, number] = [0, 88];
|
|
||||||
context.report({
|
context.report({
|
||||||
node: node,
|
node: node,
|
||||||
messageId: 'licenseRule',
|
messageId: 'licenseRule',
|
||||||
// TODO: fix the fixer.
|
fix(fixer) {
|
||||||
// fix(fixer) {
|
return fixer.insertTextAfterRange(insertAfter, licenseHeader);
|
||||||
// return fixer.insertTextBeforeRange(startLoc, licenseHeader);
|
},
|
||||||
// },
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"declarationMap": false,
|
"declarationMap": false,
|
||||||
"sourceMap": false,
|
|
||||||
"composite": false,
|
"composite": false,
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
},
|
},
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* "Archives" older versions of the website docs to reduce the build time:
|
* "Archives" older versions of the website docs to reduce the build time:
|
||||||
*
|
*
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
docs: [
|
docs: [
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import {DocSearchButton, useDocSearchKeyboardEvents} from '@docsearch/react';
|
import {DocSearchButton, useDocSearchKeyboardEvents} from '@docsearch/react';
|
||||||
import Head from '@docusaurus/Head';
|
import Head from '@docusaurus/Head';
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import Head from '@docusaurus/Head';
|
import Head from '@docusaurus/Head';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
||||||
import Head from '@docusaurus/Head';
|
import Head from '@docusaurus/Head';
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
if (url.pathname.endsWith('/') && url.pathname !== '/') {
|
if (url.pathname.endsWith('/') && url.pathname !== '/') {
|
||||||
url.pathname = url.pathname.substring(0, url.pathname.length - 1);
|
url.pathname = url.pathname.substring(0, url.pathname.length - 1);
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2024 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
self.addEventListener('install', () => {
|
self.addEventListener('install', () => {
|
||||||
self.skipWaiting();
|
self.skipWaiting();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user