From 0c4450c9c96d7f3727b8f80ffd3e5e22198441bf Mon Sep 17 00:00:00 2001 From: endiliey Date: Wed, 27 Nov 2019 18:23:01 +0700 Subject: [PATCH 1/9] wip: define html tag definition --- a.js | 7 ++ packages/docusaurus-types/src/index.d.ts | 18 ++++ packages/docusaurus/package.json | 1 + .../src/server/__tests__/htmlTags.test.ts | 91 +++++++++++++++++++ packages/docusaurus/src/server/htmlTags.ts | 38 ++++++++ yarn.lock | 5 + 6 files changed, 160 insertions(+) create mode 100644 a.js create mode 100644 packages/docusaurus/src/server/__tests__/htmlTags.test.ts create mode 100644 packages/docusaurus/src/server/htmlTags.ts diff --git a/a.js b/a.js new file mode 100644 index 000000000000..16ef401ff31b --- /dev/null +++ b/a.js @@ -0,0 +1,7 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +console.log(false && false ? '/' : ''); diff --git a/packages/docusaurus-types/src/index.d.ts b/packages/docusaurus-types/src/index.d.ts index f26c3add89d8..392fafd9ce67 100644 --- a/packages/docusaurus-types/src/index.d.ts +++ b/packages/docusaurus-types/src/index.d.ts @@ -152,3 +152,21 @@ export interface ConfigureWebpackUtils { getCacheLoader: (isServer: boolean, cacheOptions?: {}) => Loader | null; getBabelLoader: (isServer: boolean, babelOptions?: {}) => Loader; } + +interface HtmlTagObject { + /** + * Attributes of the html tag + * E.g. `{'disabled': true, 'value': 'demo', 'rel': 'preconnect'}` + */ + attributes: { + [attributeName: string]: string | boolean; + }; + /** + * The tag name e.g. `div`, `script`, `link`, `meta` + */ + tagName: string; + /** + * The inner HTML + */ + innerHTML?: string; +} diff --git a/packages/docusaurus/package.json b/packages/docusaurus/package.json index c365558ddfc6..61c199f485bc 100644 --- a/packages/docusaurus/package.json +++ b/packages/docusaurus/package.json @@ -55,6 +55,7 @@ "express": "^4.17.1", "fs-extra": "^8.1.0", "globby": "^10.0.1", + "html-tags": "^3.1.0", "html-webpack-plugin": "^4.0.0-beta.11", "import-fresh": "^3.2.1", "lodash": "^4.17.15", diff --git a/packages/docusaurus/src/server/__tests__/htmlTags.test.ts b/packages/docusaurus/src/server/__tests__/htmlTags.test.ts new file mode 100644 index 000000000000..d06acd587cfa --- /dev/null +++ b/packages/docusaurus/src/server/__tests__/htmlTags.test.ts @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import {htmlTagObjectToString} from '../htmlTags'; + +describe('htmlTagObjectToString', () => { + test('simple html tag', () => { + expect( + htmlTagObjectToString({ + tagName: 'script', + attributes: { + type: 'text/javascript', + src: + 'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js', + async: true, + }, + }), + ).toMatchInlineSnapshot( + `""`, + ); + + expect( + htmlTagObjectToString({ + tagName: 'link', + attributes: { + rel: 'preconnect', + href: 'www.google-analytics.com', + }, + }), + ).toMatchInlineSnapshot( + `""`, + ); + + expect( + htmlTagObjectToString({ + tagName: 'div', + attributes: { + style: 'background-color:lightblue', + }, + innerHTML: 'Lightblue color here', + }), + ).toMatchInlineSnapshot( + `"
Lightblue color here
"`, + ); + }); + + test('valid html void tag', () => { + expect( + htmlTagObjectToString({ + tagName: 'meta', + attributes: { + name: 'generator', + content: 'Docusaurus', + }, + }), + ).toMatchInlineSnapshot( + `""`, + ); + + expect( + htmlTagObjectToString({ + tagName: 'img', + attributes: { + src: '/img/docusaurus.png', + alt: 'Docusaurus logo', + height: '42', + width: '42', + }, + }), + ).toMatchInlineSnapshot( + `"\\"Docusaurus"`, + ); + }); + + test('invalid tag', () => { + expect(() => + htmlTagObjectToString({ + tagName: 'endiliey', + attributes: { + this: 'is invalid', + }, + }), + ).toThrowErrorMatchingInlineSnapshot( + `"Error loading {\\"tagName\\":\\"endiliey\\",\\"attributes\\":{\\"this\\":\\"is invalid\\"}}, \\"endiliey\\" is not a valid HTML tags"`, + ); + }); +}); diff --git a/packages/docusaurus/src/server/htmlTags.ts b/packages/docusaurus/src/server/htmlTags.ts new file mode 100644 index 000000000000..6c10b15f2d2d --- /dev/null +++ b/packages/docusaurus/src/server/htmlTags.ts @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import {HtmlTagObject} from '@docusaurus/types'; +import htmlTags from 'html-tags'; +import voidHtmlTags from 'html-tags/void'; + +export function htmlTagObjectToString(tagDefinition: HtmlTagObject): string { + if (htmlTags.indexOf(tagDefinition.tagName) === -1) { + throw new Error( + `Error loading ${JSON.stringify(tagDefinition)}, "${ + tagDefinition.tagName + }" is not a valid HTML tags`, + ); + } + const isVoidTag = voidHtmlTags.indexOf(tagDefinition.tagName) !== -1; + const attributes = Object.keys(tagDefinition.attributes || {}) + .filter(attributeName => tagDefinition.attributes[attributeName] !== false) + .map(attributeName => { + if (tagDefinition.attributes[attributeName] === true) { + return attributeName; + } + return ( + attributeName + '="' + tagDefinition.attributes[attributeName] + '"' + ); + }); + return ( + '<' + + [tagDefinition.tagName].concat(attributes).join(' ') + + '>' + + ((!isVoidTag && tagDefinition.innerHTML) || '') + + (isVoidTag ? '' : '') + ); +} diff --git a/yarn.lock b/yarn.lock index c4855e2c1100..dee6f9a6dbff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7686,6 +7686,11 @@ html-minifier-terser@^5.0.1: relateurl "^0.2.7" terser "^4.3.9" +html-tags@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-3.1.0.tgz#7b5e6f7e665e9fb41f30007ed9e0d41e97fb2140" + integrity sha512-1qYz89hW3lFDEazhjW0yVAV87lw8lVkrJocr72XmBkMKsoSVJCQx3W8BXsC7hO2qAt8BoVjYjtAcZ9perqGnNg== + html-void-elements@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/html-void-elements/-/html-void-elements-1.0.4.tgz#95e8bb5ecd6b88766569c2645f2b5f1591db9ba5" From 0b12988a825cf3b78961d0343ace5f6baac35b74 Mon Sep 17 00:00:00 2001 From: endiliey Date: Wed, 27 Nov 2019 20:58:09 +0700 Subject: [PATCH 2/9] feat(v2): implement injectHtmlTags api --- packages/docusaurus-types/src/index.d.ts | 13 +++- packages/docusaurus/src/client/serverEntry.js | 4 +- .../client/templates/index.html.template.ejs | 2 + .../src/client/templates/ssr.html.template.js | 2 + packages/docusaurus/src/commands/start.ts | 5 +- .../__fixtures__/plugin-bodyTags-only.js | 23 ++++++ .../__fixtures__/plugin-both-tags.js | 31 ++++++++ .../__tests__/__fixtures__/plugin-empty.js | 12 ++++ .../__fixtures__/plugin-headTags-only.js | 25 +++++++ .../__tests__/htmlTags.test.ts | 31 ++++++++ .../server/html-tags/__tests__/index.test.ts | 72 +++++++++++++++++++ .../src/server/{ => html-tags}/htmlTags.ts | 28 ++++++-- .../docusaurus/src/server/html-tags/index.ts | 42 +++++++++++ packages/docusaurus/src/server/index.ts | 6 ++ packages/docusaurus/src/webpack/server.ts | 4 +- 15 files changed, 288 insertions(+), 12 deletions(-) create mode 100644 packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-bodyTags-only.js create mode 100644 packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-both-tags.js create mode 100644 packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-empty.js create mode 100644 packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-headTags-only.js rename packages/docusaurus/src/server/{ => html-tags}/__tests__/htmlTags.test.ts (75%) create mode 100644 packages/docusaurus/src/server/html-tags/__tests__/index.test.ts rename packages/docusaurus/src/server/{ => html-tags}/htmlTags.ts (52%) create mode 100644 packages/docusaurus/src/server/html-tags/index.ts diff --git a/packages/docusaurus-types/src/index.d.ts b/packages/docusaurus-types/src/index.d.ts index 392fafd9ce67..194faa215ca1 100644 --- a/packages/docusaurus-types/src/index.d.ts +++ b/packages/docusaurus-types/src/index.d.ts @@ -73,7 +73,12 @@ export interface LoadContext { baseUrl: string; } -export interface Props extends LoadContext { +export interface HtmlTags { + headTags: string; + bodyTags: string; +} + +export interface Props extends LoadContext, HtmlTags { routesPaths: string[]; plugins: Plugin[]; } @@ -104,6 +109,10 @@ export interface Plugin { getPathsToWatch?(): string[]; getClientModules?(): string[]; extendCli?(cli: Command): void; + injectHtmlTags?(): { + headTags?: HtmlTagObject | HtmlTagObject[]; + bodyTags?: HtmlTagObject | HtmlTagObject[]; + }; } export type PluginConfig = [string, Object] | [string] | string; @@ -158,7 +167,7 @@ interface HtmlTagObject { * Attributes of the html tag * E.g. `{'disabled': true, 'value': 'demo', 'rel': 'preconnect'}` */ - attributes: { + attributes?: { [attributeName: string]: string | boolean; }; /** diff --git a/packages/docusaurus/src/client/serverEntry.js b/packages/docusaurus/src/client/serverEntry.js index 2fe524335bb0..25335328d503 100644 --- a/packages/docusaurus/src/client/serverEntry.js +++ b/packages/docusaurus/src/client/serverEntry.js @@ -22,7 +22,7 @@ import ssrTemplate from './templates/ssr.html.template'; // Renderer for static-site-generator-webpack-plugin (async rendering via promises) export default async function render(locals) { - const {routesLocation} = locals; + const {routesLocation, headTags, bodyTags} = locals; const location = routesLocation[locals.path]; await preload(routes, location); const modules = new Set(); @@ -76,6 +76,8 @@ export default async function render(locals) { chunkManifestScript, htmlAttributes: htmlAttributes || '', bodyAttributes: bodyAttributes || '', + headTags, + bodyTags, metaAttributes, scripts, stylesheets, diff --git a/packages/docusaurus/src/client/templates/index.html.template.ejs b/packages/docusaurus/src/client/templates/index.html.template.ejs index 9302feaac66d..c9884a0624a1 100644 --- a/packages/docusaurus/src/client/templates/index.html.template.ejs +++ b/packages/docusaurus/src/client/templates/index.html.template.ejs @@ -5,8 +5,10 @@ <%= htmlWebpackPlugin.options.title %> + <%= htmlWebpackPlugin.options.headTags %> + <%= htmlWebpackPlugin.options.bodyTags %>
diff --git a/packages/docusaurus/src/client/templates/ssr.html.template.js b/packages/docusaurus/src/client/templates/ssr.html.template.js index c3547a11d57a..8a6e4706630b 100644 --- a/packages/docusaurus/src/client/templates/ssr.html.template.js +++ b/packages/docusaurus/src/client/templates/ssr.html.template.js @@ -12,6 +12,7 @@ module.exports = ` + <%= headTags %> <%- chunkManifestScript %> <% metaAttributes.forEach((metaAttribute) => { %> <%- metaAttribute %> @@ -21,6 +22,7 @@ module.exports = ` <% }); %> > + <%= bodyTags %>
<%- appHtml %>
diff --git a/packages/docusaurus/src/commands/start.ts b/packages/docusaurus/src/commands/start.ts index cbaf7a0499bd..0345d20bfbd8 100644 --- a/packages/docusaurus/src/commands/start.ts +++ b/packages/docusaurus/src/commands/start.ts @@ -25,6 +25,7 @@ import {posixPath} from '@docusaurus/utils'; import {CONFIG_FILE_NAME, STATIC_DIR_NAME, DEFAULT_PORT} from '../constants'; import {createClientConfig} from '../webpack/client'; import {applyConfigureWebpack} from '../webpack/utils'; +import {head} from 'shelljs'; function getHost(reqHost: string | undefined): string { return reqHost || 'localhost'; @@ -78,7 +79,7 @@ export async function start( const protocol: string = process.env.HTTPS === 'true' ? 'https' : 'http'; const port: number = await getPort(cliOptions.port); const host: string = getHost(cliOptions.host); - const {baseUrl} = props; + const {baseUrl, headTags, bodyTags} = props; const urls = prepareUrls(protocol, host, port); const openUrl = normalizeUrl([urls.localUrlForBrowser, baseUrl]); @@ -92,6 +93,8 @@ export async function start( ), filename: 'index.html', title: siteConfig.title, + headTags, + bodyTags, }), // This is necessary to emit hot updates for webpack-dev-server new HotModuleReplacementPlugin(), diff --git a/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-bodyTags-only.js b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-bodyTags-only.js new file mode 100644 index 000000000000..a3975a6f9d33 --- /dev/null +++ b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-bodyTags-only.js @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +module.exports = function() { + return { + name: 'plugin-bodyTags-only', + injectHtmlTags() { + return { + bodyTags: { + tagName: 'script', + attributes: { + type: 'text/javascript', + }, + innerHTML: 'window.foo = null;', + }, + }; + }, + }; +}; diff --git a/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-both-tags.js b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-both-tags.js new file mode 100644 index 000000000000..8d0f5039d13b --- /dev/null +++ b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-both-tags.js @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +module.exports = function() { + return { + name: 'plugin-both-tags', + injectHtmlTags() { + return { + headTags: [ + { + tagName: 'link', + attributes: { + rel: 'preconnect', + href: 'www.google-analytics.com', + }, + }, + ], + bodyTags: [ + { + tagName: 'div', + innerHTML: 'Test content', + }, + ], + }; + }, + }; +}; diff --git a/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-empty.js b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-empty.js new file mode 100644 index 000000000000..8217b22cd223 --- /dev/null +++ b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-empty.js @@ -0,0 +1,12 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +module.exports = function() { + return { + name: 'plugin-empty', + }; +}; diff --git a/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-headTags-only.js b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-headTags-only.js new file mode 100644 index 000000000000..538aeca1a1af --- /dev/null +++ b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-headTags-only.js @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +module.exports = function() { + return { + name: 'plugin-headTags-only', + injectHtmlTags() { + return { + headTags: [ + { + tagName: 'link', + attributes: { + rel: 'preconnect', + href: 'www.google-analytics.com', + }, + }, + ], + }; + }, + }; +}; diff --git a/packages/docusaurus/src/server/__tests__/htmlTags.test.ts b/packages/docusaurus/src/server/html-tags/__tests__/htmlTags.test.ts similarity index 75% rename from packages/docusaurus/src/server/__tests__/htmlTags.test.ts rename to packages/docusaurus/src/server/html-tags/__tests__/htmlTags.test.ts index d06acd587cfa..15b2d07ea79e 100644 --- a/packages/docusaurus/src/server/__tests__/htmlTags.test.ts +++ b/packages/docusaurus/src/server/html-tags/__tests__/htmlTags.test.ts @@ -46,6 +46,13 @@ describe('htmlTagObjectToString', () => { ).toMatchInlineSnapshot( `"
Lightblue color here
"`, ); + + expect( + htmlTagObjectToString({ + tagName: 'div', + innerHTML: 'Test', + }), + ).toMatchInlineSnapshot(`"
Test
"`); }); test('valid html void tag', () => { @@ -88,4 +95,28 @@ describe('htmlTagObjectToString', () => { `"Error loading {\\"tagName\\":\\"endiliey\\",\\"attributes\\":{\\"this\\":\\"is invalid\\"}}, \\"endiliey\\" is not a valid HTML tags"`, ); }); + + test('invalid tagName', () => { + expect(() => + htmlTagObjectToString({ + tagName: true, + }), + ).toThrowErrorMatchingInlineSnapshot( + `"{\\"tagName\\":true} is not a valid HTML tag object. \\"tagName\\" must be defined as a string"`, + ); + }); + + test('invalid html tag object', () => { + expect(() => + htmlTagObjectToString('fooofofoofo'), + ).toThrowErrorMatchingInlineSnapshot( + `"\\"fooofofoofo\\" is not a valid HTML tag object"`, + ); + + expect(() => + htmlTagObjectToString(null), + ).toThrowErrorMatchingInlineSnapshot( + `"\\"null\\" is not a valid HTML tag object"`, + ); + }); }); diff --git a/packages/docusaurus/src/server/html-tags/__tests__/index.test.ts b/packages/docusaurus/src/server/html-tags/__tests__/index.test.ts new file mode 100644 index 000000000000..dbfb8adfb743 --- /dev/null +++ b/packages/docusaurus/src/server/html-tags/__tests__/index.test.ts @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import path from 'path'; + +import {loadHtmlTags} from '../index'; + +const pluginEmpty = require('./__fixtures__/plugin-empty'); +const pluginBodyTags = require('./__fixtures__/plugin-bodyTags-only'); +const pluginHeadTags = require('./__fixtures__/plugin-headTags-only'); +const pluginBothTags = require('./__fixtures__/plugin-both-tags'); + +describe('loadHtmlTags', () => { + test('empty plugin', () => { + const htmlTags = loadHtmlTags([pluginEmpty()]); + expect(htmlTags).toMatchInlineSnapshot(` + Object { + "bodyTags": "", + "headTags": "", + } + `); + }); + + test('only inject headTags', () => { + const htmlTags = loadHtmlTags([pluginHeadTags()]); + expect(htmlTags).toMatchInlineSnapshot(` + Object { + "bodyTags": "", + "headTags": "", + } + `); + }); + + test('only inject bodyTags', () => { + const htmlTags = loadHtmlTags([pluginBodyTags()]); + expect(htmlTags).toMatchInlineSnapshot(` + Object { + "bodyTags": "", + "headTags": "", + } + `); + }); + + test('inject both headTags & bodyTags', () => { + const htmlTags = loadHtmlTags([pluginBothTags()]); + expect(htmlTags).toMatchInlineSnapshot(` + Object { + "bodyTags": "
Test content
", + "headTags": "", + } + `); + }); + + test('multiple plugins that might/might not inject html tags', () => { + const htmlTags = loadHtmlTags([ + pluginEmpty(), + pluginHeadTags(), + pluginBothTags(), + ]); + expect(htmlTags).toMatchInlineSnapshot(` + Object { + "bodyTags": "
Test content
", + "headTags": " + ", + } + `); + }); +}); diff --git a/packages/docusaurus/src/server/htmlTags.ts b/packages/docusaurus/src/server/html-tags/htmlTags.ts similarity index 52% rename from packages/docusaurus/src/server/htmlTags.ts rename to packages/docusaurus/src/server/html-tags/htmlTags.ts index 6c10b15f2d2d..a3034866f92f 100644 --- a/packages/docusaurus/src/server/htmlTags.ts +++ b/packages/docusaurus/src/server/html-tags/htmlTags.ts @@ -5,11 +5,26 @@ * LICENSE file in the root directory of this source tree. */ +import _ from 'lodash'; import {HtmlTagObject} from '@docusaurus/types'; import htmlTags from 'html-tags'; import voidHtmlTags from 'html-tags/void'; -export function htmlTagObjectToString(tagDefinition: HtmlTagObject): string { +function assertIsHtmlTagObject(val: any): asserts val is HtmlTagObject { + if (!_.isPlainObject(val)) { + throw new Error(`"${val}" is not a valid HTML tag object`); + } + if (typeof val.tagName !== 'string') { + throw new Error( + `${JSON.stringify( + val, + )} is not a valid HTML tag object. "tagName" must be defined as a string`, + ); + } +} + +export function htmlTagObjectToString(tagDefinition: any): string { + assertIsHtmlTagObject(tagDefinition); if (htmlTags.indexOf(tagDefinition.tagName) === -1) { throw new Error( `Error loading ${JSON.stringify(tagDefinition)}, "${ @@ -18,15 +33,14 @@ export function htmlTagObjectToString(tagDefinition: HtmlTagObject): string { ); } const isVoidTag = voidHtmlTags.indexOf(tagDefinition.tagName) !== -1; - const attributes = Object.keys(tagDefinition.attributes || {}) - .filter(attributeName => tagDefinition.attributes[attributeName] !== false) + const tagAttributes = tagDefinition.attributes || {}; + const attributes = Object.keys(tagAttributes) + .filter(attributeName => tagAttributes[attributeName] !== false) .map(attributeName => { - if (tagDefinition.attributes[attributeName] === true) { + if (tagAttributes[attributeName] === true) { return attributeName; } - return ( - attributeName + '="' + tagDefinition.attributes[attributeName] + '"' - ); + return attributeName + '="' + tagAttributes[attributeName] + '"'; }); return ( '<' + diff --git a/packages/docusaurus/src/server/html-tags/index.ts b/packages/docusaurus/src/server/html-tags/index.ts new file mode 100644 index 000000000000..3047f2553f68 --- /dev/null +++ b/packages/docusaurus/src/server/html-tags/index.ts @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import _ from 'lodash'; +import {htmlTagObjectToString} from './htmlTags'; +import {Plugin, HtmlTags, HtmlTagObject} from '@docusaurus/types'; + +export function createHtmlTagsString( + tags: HtmlTagObject | HtmlTagObject[], +): string { + return _.isArray(tags) + ? tags.map(htmlTagObjectToString).join('\n') + : htmlTagObjectToString(tags); +} + +export function loadHtmlTags(plugins: Plugin[]): HtmlTags { + const htmlTags = plugins.reduce( + (acc, plugin) => { + if (!plugin.injectHtmlTags) { + return acc; + } + const {headTags, bodyTags} = plugin.injectHtmlTags(); + return { + headTags: headTags + ? acc.headTags + '\n' + createHtmlTagsString(headTags) + : acc.headTags, + bodyTags: bodyTags + ? acc.bodyTags + '\n' + createHtmlTagsString(bodyTags) + : acc.bodyTags, + }; + }, + {headTags: '', bodyTags: ''}, + ); + return { + headTags: htmlTags.headTags.trim(), + bodyTags: htmlTags.bodyTags.trim(), + }; +} diff --git a/packages/docusaurus/src/server/index.ts b/packages/docusaurus/src/server/index.ts index 1a808d8e37e4..f81d9ca70460 100644 --- a/packages/docusaurus/src/server/index.ts +++ b/packages/docusaurus/src/server/index.ts @@ -26,6 +26,7 @@ import { PluginConfig, Props, } from '@docusaurus/types'; +import {loadHtmlTags} from './html-tags'; export function loadContext(siteDir: string): LoadContext { const generatedFilesDir: string = path.resolve( @@ -103,6 +104,9 @@ export async function load(siteDir: string): Promise { .join('\n')}\n];\n`, ); + // Load extra head & body html tags + const {headTags, bodyTags} = loadHtmlTags(plugins); + // Routing const { registry, @@ -148,6 +152,8 @@ ${Object.keys(registry) generatedFilesDir, routesPaths, plugins, + headTags, + bodyTags, }; return props; diff --git a/packages/docusaurus/src/webpack/server.ts b/packages/docusaurus/src/webpack/server.ts index 03d47f3ab457..eb58fdb8f158 100644 --- a/packages/docusaurus/src/webpack/server.ts +++ b/packages/docusaurus/src/webpack/server.ts @@ -16,7 +16,7 @@ import WaitPlugin from './plugins/WaitPlugin'; import LogPlugin from './plugins/LogPlugin'; export function createServerConfig(props: Props): Configuration { - const {baseUrl, routesPaths, generatedFilesDir} = props; + const {baseUrl, routesPaths, generatedFilesDir, headTags, bodyTags} = props; const config = createBaseConfig(props, true); const routesLocation = {}; @@ -51,6 +51,8 @@ export function createServerConfig(props: Props): Configuration { baseUrl, generatedFilesDir, routesLocation, + headTags, + bodyTags, }, paths: ssgPaths, }), From 40240a017ddd34f352082b083f93f587e0d90733 Mon Sep 17 00:00:00 2001 From: endiliey Date: Wed, 27 Nov 2019 20:58:45 +0700 Subject: [PATCH 3/9] remove useless file --- a.js | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 a.js diff --git a/a.js b/a.js deleted file mode 100644 index 16ef401ff31b..000000000000 --- a/a.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) 2017-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -console.log(false && false ? '/' : ''); From 0743f261979314cc0f66c6e3971d997dd0a04b6a Mon Sep 17 00:00:00 2001 From: endiliey Date: Wed, 27 Nov 2019 21:27:28 +0700 Subject: [PATCH 4/9] nits --- packages/docusaurus/src/client/templates/ssr.html.template.js | 4 ++-- packages/docusaurus/src/commands/start.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/docusaurus/src/client/templates/ssr.html.template.js b/packages/docusaurus/src/client/templates/ssr.html.template.js index 8a6e4706630b..52c9da15bbcb 100644 --- a/packages/docusaurus/src/client/templates/ssr.html.template.js +++ b/packages/docusaurus/src/client/templates/ssr.html.template.js @@ -12,7 +12,7 @@ module.exports = ` - <%= headTags %> + <%- headTags %> <%- chunkManifestScript %> <% metaAttributes.forEach((metaAttribute) => { %> <%- metaAttribute %> @@ -22,7 +22,7 @@ module.exports = ` <% }); %> > - <%= bodyTags %> + <%- bodyTags %>
<%- appHtml %>
diff --git a/packages/docusaurus/src/commands/start.ts b/packages/docusaurus/src/commands/start.ts index 0345d20bfbd8..1de38361fa2b 100644 --- a/packages/docusaurus/src/commands/start.ts +++ b/packages/docusaurus/src/commands/start.ts @@ -25,7 +25,6 @@ import {posixPath} from '@docusaurus/utils'; import {CONFIG_FILE_NAME, STATIC_DIR_NAME, DEFAULT_PORT} from '../constants'; import {createClientConfig} from '../webpack/client'; import {applyConfigureWebpack} from '../webpack/utils'; -import {head} from 'shelljs'; function getHost(reqHost: string | undefined): string { return reqHost || 'localhost'; From 9c34531ca2e5ce73c150d561f36ee6ff5443c607 Mon Sep 17 00:00:00 2001 From: endiliey Date: Wed, 27 Nov 2019 21:36:00 +0700 Subject: [PATCH 5/9] documentation --- website/docs/lifecycle-apis.md | 75 +++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 5 deletions(-) diff --git a/website/docs/lifecycle-apis.md b/website/docs/lifecycle-apis.md index 334fce652153..c5b691aca1b8 100644 --- a/website/docs/lifecycle-apis.md +++ b/website/docs/lifecycle-apis.md @@ -172,18 +172,17 @@ module.exports = function(context, options, utils) { Called when a (production) build finishes. ```ts -interface LoadContext { +type Props = { siteDir: string; generatedFilesDir: string; siteConfig: DocusaurusConfig; outDir: string; baseUrl: string; -} - -interface Props extends LoadContext { + headTags: string; + bodyTags: string; routesPaths: string[]; plugins: Plugin[]; -} +}; ``` Example: @@ -226,6 +225,68 @@ module.exports = function(context, options, utils) { }; ``` +## injectHtmlTags() + +Inject head and/or body html tags to Docusaurus generated html. + +```typescript +function injectHtmlTags(): { + headTags?: HtmlTagObject | HtmlTagObject[]; + bodyTags?: HtmlTagObject | HtmlTagObject[]; +}; + +interface HtmlTagObject { + /** + * Attributes of the html tag + * E.g. `{'disabled': true, 'value': 'demo', 'rel': 'preconnect'}` + */ + attributes?: { + [attributeName: string]: string | boolean; + }; + /** + * The tag name e.g. `div`, `script`, `link`, `meta` + */ + tagName: string; + /** + * The inner HTML + */ + innerHTML?: string; +} +``` + +Example: + +```js {5-24} +// docusaurus-plugin/src/index.js +module.exports = function(context, options, utils) { + return { + name: 'docusaurus-plugin', + injectHtmlTags() { + return { + headTags: [ + { + tagName: 'link', + attributes: { + rel: 'preconnect', + href: 'https://www.github.com', + }, + }, + ], + bodyTags: [ + { + tagName: 'script', + attributes: { + type: 'text/javascript', + src: `/noflash.js`, + }, + }, + ], + }; + }, + }; +}; +``` + ## getThemePath() Returns the path to the directory where the theme components can be found. When your users calls `swizzle`, `getThemePath` is called and its returned path is used to find your theme components. @@ -351,6 +412,10 @@ module.exports = function(context, opts) { extendCli(cli) { // Register an extra command to enhance the CLI of docusaurus }, + + injectHtmlTags() { + // Inject head and/or body html tags + }, }; }; ``` From bb521fa8d9d26e4f1aa7cc2aa0f2a605f73ecf15 Mon Sep 17 00:00:00 2001 From: endiliey Date: Thu, 28 Nov 2019 12:27:33 +0700 Subject: [PATCH 6/9] allow string, use prebodyTags and postBodyTags --- packages/docusaurus-types/src/index.d.ts | 8 +-- packages/docusaurus/src/client/serverEntry.js | 5 +- .../client/templates/index.html.template.ejs | 5 +- .../src/client/templates/ssr.html.template.js | 3 +- packages/docusaurus/src/commands/start.ts | 7 ++- ...in-headTags-only.js => plugin-headTags.js} | 1 + ...in-both-tags.js => plugin-postBodyTags.js} | 13 +---- ...bodyTags-only.js => plugin-preBodyTags.js} | 4 +- .../server/html-tags/__tests__/index.test.ts | 54 +++++++++++++------ .../docusaurus/src/server/html-tags/index.ts | 26 +++++---- packages/docusaurus/src/server/index.ts | 5 +- packages/docusaurus/src/webpack/server.ts | 12 ++++- website/docs/lifecycle-apis.md | 14 ++--- 13 files changed, 99 insertions(+), 58 deletions(-) rename packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/{plugin-headTags-only.js => plugin-headTags.js} (90%) rename packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/{plugin-both-tags.js => plugin-postBodyTags.js} (60%) rename packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/{plugin-bodyTags-only.js => plugin-preBodyTags.js} (88%) diff --git a/packages/docusaurus-types/src/index.d.ts b/packages/docusaurus-types/src/index.d.ts index 194faa215ca1..b5271401478d 100644 --- a/packages/docusaurus-types/src/index.d.ts +++ b/packages/docusaurus-types/src/index.d.ts @@ -75,7 +75,8 @@ export interface LoadContext { export interface HtmlTags { headTags: string; - bodyTags: string; + preBodyTags: string; + postBodyTags: string; } export interface Props extends LoadContext, HtmlTags { @@ -110,8 +111,9 @@ export interface Plugin { getClientModules?(): string[]; extendCli?(cli: Command): void; injectHtmlTags?(): { - headTags?: HtmlTagObject | HtmlTagObject[]; - bodyTags?: HtmlTagObject | HtmlTagObject[]; + headTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; + preBodyTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; + postBodyTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; }; } diff --git a/packages/docusaurus/src/client/serverEntry.js b/packages/docusaurus/src/client/serverEntry.js index 25335328d503..0e936541f981 100644 --- a/packages/docusaurus/src/client/serverEntry.js +++ b/packages/docusaurus/src/client/serverEntry.js @@ -22,7 +22,7 @@ import ssrTemplate from './templates/ssr.html.template'; // Renderer for static-site-generator-webpack-plugin (async rendering via promises) export default async function render(locals) { - const {routesLocation, headTags, bodyTags} = locals; + const {routesLocation, headTags, preBodyTags, postBodyTags} = locals; const location = routesLocation[locals.path]; await preload(routes, location); const modules = new Set(); @@ -77,7 +77,8 @@ export default async function render(locals) { htmlAttributes: htmlAttributes || '', bodyAttributes: bodyAttributes || '', headTags, - bodyTags, + preBodyTags, + postBodyTags, metaAttributes, scripts, stylesheets, diff --git a/packages/docusaurus/src/client/templates/index.html.template.ejs b/packages/docusaurus/src/client/templates/index.html.template.ejs index c9884a0624a1..e2950db08bc9 100644 --- a/packages/docusaurus/src/client/templates/index.html.template.ejs +++ b/packages/docusaurus/src/client/templates/index.html.template.ejs @@ -6,9 +6,12 @@ <%= htmlWebpackPlugin.options.title %> <%= htmlWebpackPlugin.options.headTags %> + <%= htmlWebpackPlugin.tags.headTags %> - <%= htmlWebpackPlugin.options.bodyTags %> + <%= htmlWebpackPlugin.options.preBodyTags %>
+ <%= htmlWebpackPlugin.tags.bodyTags %> + <%= htmlWebpackPlugin.options.postBodyTags %> diff --git a/packages/docusaurus/src/client/templates/ssr.html.template.js b/packages/docusaurus/src/client/templates/ssr.html.template.js index 52c9da15bbcb..cca448619178 100644 --- a/packages/docusaurus/src/client/templates/ssr.html.template.js +++ b/packages/docusaurus/src/client/templates/ssr.html.template.js @@ -22,13 +22,14 @@ module.exports = ` <% }); %> > - <%- bodyTags %> + <%- preBodyTags %>
<%- appHtml %>
<% scripts.forEach((script) => { %> <% }); %> + <%- postBodyTags %> `; diff --git a/packages/docusaurus/src/commands/start.ts b/packages/docusaurus/src/commands/start.ts index 1de38361fa2b..481b6370f147 100644 --- a/packages/docusaurus/src/commands/start.ts +++ b/packages/docusaurus/src/commands/start.ts @@ -78,7 +78,7 @@ export async function start( const protocol: string = process.env.HTTPS === 'true' ? 'https' : 'http'; const port: number = await getPort(cliOptions.port); const host: string = getHost(cliOptions.host); - const {baseUrl, headTags, bodyTags} = props; + const {baseUrl, headTags, preBodyTags, postBodyTags} = props; const urls = prepareUrls(protocol, host, port); const openUrl = normalizeUrl([urls.localUrlForBrowser, baseUrl]); @@ -90,10 +90,13 @@ export async function start( __dirname, '../client/templates/index.html.template.ejs', ), + // so we can define the position where the scripts are injected + inject: false, filename: 'index.html', title: siteConfig.title, headTags, - bodyTags, + preBodyTags, + postBodyTags, }), // This is necessary to emit hot updates for webpack-dev-server new HotModuleReplacementPlugin(), diff --git a/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-headTags-only.js b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-headTags.js similarity index 90% rename from packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-headTags-only.js rename to packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-headTags.js index 538aeca1a1af..02bf52764351 100644 --- a/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-headTags-only.js +++ b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-headTags.js @@ -18,6 +18,7 @@ module.exports = function() { href: 'www.google-analytics.com', }, }, + ``, ], }; }, diff --git a/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-both-tags.js b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-postBodyTags.js similarity index 60% rename from packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-both-tags.js rename to packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-postBodyTags.js index 8d0f5039d13b..85b2b574ada6 100644 --- a/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-both-tags.js +++ b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-postBodyTags.js @@ -7,19 +7,10 @@ module.exports = function() { return { - name: 'plugin-both-tags', + name: 'plugin-postBody-tags', injectHtmlTags() { return { - headTags: [ - { - tagName: 'link', - attributes: { - rel: 'preconnect', - href: 'www.google-analytics.com', - }, - }, - ], - bodyTags: [ + postBodyTags: [ { tagName: 'div', innerHTML: 'Test content', diff --git a/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-bodyTags-only.js b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-preBodyTags.js similarity index 88% rename from packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-bodyTags-only.js rename to packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-preBodyTags.js index a3975a6f9d33..25c03f5fa298 100644 --- a/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-bodyTags-only.js +++ b/packages/docusaurus/src/server/html-tags/__tests__/__fixtures__/plugin-preBodyTags.js @@ -7,10 +7,10 @@ module.exports = function() { return { - name: 'plugin-bodyTags-only', + name: 'plugin-preBodyTags', injectHtmlTags() { return { - bodyTags: { + preBodyTags: { tagName: 'script', attributes: { type: 'text/javascript', diff --git a/packages/docusaurus/src/server/html-tags/__tests__/index.test.ts b/packages/docusaurus/src/server/html-tags/__tests__/index.test.ts index dbfb8adfb743..17628afde045 100644 --- a/packages/docusaurus/src/server/html-tags/__tests__/index.test.ts +++ b/packages/docusaurus/src/server/html-tags/__tests__/index.test.ts @@ -10,17 +10,18 @@ import path from 'path'; import {loadHtmlTags} from '../index'; const pluginEmpty = require('./__fixtures__/plugin-empty'); -const pluginBodyTags = require('./__fixtures__/plugin-bodyTags-only'); -const pluginHeadTags = require('./__fixtures__/plugin-headTags-only'); -const pluginBothTags = require('./__fixtures__/plugin-both-tags'); +const pluginPreBodyTags = require('./__fixtures__/plugin-preBodyTags'); +const pluginHeadTags = require('./__fixtures__/plugin-headTags'); +const pluginPostBodyTags = require('./__fixtures__/plugin-postBodyTags'); describe('loadHtmlTags', () => { test('empty plugin', () => { const htmlTags = loadHtmlTags([pluginEmpty()]); expect(htmlTags).toMatchInlineSnapshot(` Object { - "bodyTags": "", "headTags": "", + "postBodyTags": "", + "preBodyTags": "", } `); }); @@ -29,28 +30,48 @@ describe('loadHtmlTags', () => { const htmlTags = loadHtmlTags([pluginHeadTags()]); expect(htmlTags).toMatchInlineSnapshot(` Object { - "bodyTags": "", - "headTags": "", + "headTags": " + ", + "postBodyTags": "", + "preBodyTags": "", + } + `); + }); + + test('only inject preBodyTags', () => { + const htmlTags = loadHtmlTags([pluginPreBodyTags()]); + expect(htmlTags).toMatchInlineSnapshot(` + Object { + "headTags": "", + "postBodyTags": "", + "preBodyTags": "", } `); }); - test('only inject bodyTags', () => { - const htmlTags = loadHtmlTags([pluginBodyTags()]); + test('only inject postBodyTags', () => { + const htmlTags = loadHtmlTags([pluginPostBodyTags()]); expect(htmlTags).toMatchInlineSnapshot(` Object { - "bodyTags": "", "headTags": "", + "postBodyTags": "
Test content
", + "preBodyTags": "", } `); }); - test('inject both headTags & bodyTags', () => { - const htmlTags = loadHtmlTags([pluginBothTags()]); + test('multiple plugins that inject different part of html tags', () => { + const htmlTags = loadHtmlTags([ + pluginHeadTags(), + pluginPostBodyTags(), + pluginPreBodyTags(), + ]); expect(htmlTags).toMatchInlineSnapshot(` Object { - "bodyTags": "
Test content
", - "headTags": "", + "headTags": " + ", + "postBodyTags": "
Test content
", + "preBodyTags": "", } `); }); @@ -59,13 +80,14 @@ describe('loadHtmlTags', () => { const htmlTags = loadHtmlTags([ pluginEmpty(), pluginHeadTags(), - pluginBothTags(), + pluginPostBodyTags(), ]); expect(htmlTags).toMatchInlineSnapshot(` Object { - "bodyTags": "
Test content
", "headTags": " - ", + ", + "postBodyTags": "
Test content
", + "preBodyTags": "", } `); }); diff --git a/packages/docusaurus/src/server/html-tags/index.ts b/packages/docusaurus/src/server/html-tags/index.ts index 3047f2553f68..59af94efe9c7 100644 --- a/packages/docusaurus/src/server/html-tags/index.ts +++ b/packages/docusaurus/src/server/html-tags/index.ts @@ -9,12 +9,14 @@ import _ from 'lodash'; import {htmlTagObjectToString} from './htmlTags'; import {Plugin, HtmlTags, HtmlTagObject} from '@docusaurus/types'; +function toString(val: string | HtmlTagObject): string { + return typeof val === 'string' ? val : htmlTagObjectToString(val); +} + export function createHtmlTagsString( - tags: HtmlTagObject | HtmlTagObject[], + tags: string | HtmlTagObject | (string | HtmlTagObject)[], ): string { - return _.isArray(tags) - ? tags.map(htmlTagObjectToString).join('\n') - : htmlTagObjectToString(tags); + return _.isArray(tags) ? tags.map(toString).join('\n') : toString(tags); } export function loadHtmlTags(plugins: Plugin[]): HtmlTags { @@ -23,20 +25,24 @@ export function loadHtmlTags(plugins: Plugin[]): HtmlTags { if (!plugin.injectHtmlTags) { return acc; } - const {headTags, bodyTags} = plugin.injectHtmlTags(); + const {headTags, preBodyTags, postBodyTags} = plugin.injectHtmlTags(); return { headTags: headTags ? acc.headTags + '\n' + createHtmlTagsString(headTags) : acc.headTags, - bodyTags: bodyTags - ? acc.bodyTags + '\n' + createHtmlTagsString(bodyTags) - : acc.bodyTags, + preBodyTags: preBodyTags + ? acc.preBodyTags + '\n' + createHtmlTagsString(preBodyTags) + : acc.preBodyTags, + postBodyTags: postBodyTags + ? acc.postBodyTags + '\n' + createHtmlTagsString(postBodyTags) + : acc.postBodyTags, }; }, - {headTags: '', bodyTags: ''}, + {headTags: '', preBodyTags: '', postBodyTags: ''}, ); return { headTags: htmlTags.headTags.trim(), - bodyTags: htmlTags.bodyTags.trim(), + preBodyTags: htmlTags.preBodyTags.trim(), + postBodyTags: htmlTags.postBodyTags.trim(), }; } diff --git a/packages/docusaurus/src/server/index.ts b/packages/docusaurus/src/server/index.ts index f81d9ca70460..358c4ae0c351 100644 --- a/packages/docusaurus/src/server/index.ts +++ b/packages/docusaurus/src/server/index.ts @@ -105,7 +105,7 @@ export async function load(siteDir: string): Promise { ); // Load extra head & body html tags - const {headTags, bodyTags} = loadHtmlTags(plugins); + const {headTags, preBodyTags, postBodyTags} = loadHtmlTags(plugins); // Routing const { @@ -153,7 +153,8 @@ ${Object.keys(registry) routesPaths, plugins, headTags, - bodyTags, + preBodyTags, + postBodyTags, }; return props; diff --git a/packages/docusaurus/src/webpack/server.ts b/packages/docusaurus/src/webpack/server.ts index eb58fdb8f158..4ddc335e2824 100644 --- a/packages/docusaurus/src/webpack/server.ts +++ b/packages/docusaurus/src/webpack/server.ts @@ -16,7 +16,14 @@ import WaitPlugin from './plugins/WaitPlugin'; import LogPlugin from './plugins/LogPlugin'; export function createServerConfig(props: Props): Configuration { - const {baseUrl, routesPaths, generatedFilesDir, headTags, bodyTags} = props; + const { + baseUrl, + routesPaths, + generatedFilesDir, + headTags, + preBodyTags, + postBodyTags, + } = props; const config = createBaseConfig(props, true); const routesLocation = {}; @@ -52,7 +59,8 @@ export function createServerConfig(props: Props): Configuration { generatedFilesDir, routesLocation, headTags, - bodyTags, + preBodyTags, + postBodyTags, }, paths: ssgPaths, }), diff --git a/website/docs/lifecycle-apis.md b/website/docs/lifecycle-apis.md index c5b691aca1b8..6801ae5fc14e 100644 --- a/website/docs/lifecycle-apis.md +++ b/website/docs/lifecycle-apis.md @@ -231,8 +231,9 @@ Inject head and/or body html tags to Docusaurus generated html. ```typescript function injectHtmlTags(): { - headTags?: HtmlTagObject | HtmlTagObject[]; - bodyTags?: HtmlTagObject | HtmlTagObject[]; + headTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; + preBodyTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; + postBodyTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; }; interface HtmlTagObject { @@ -256,7 +257,7 @@ interface HtmlTagObject { Example: -```js {5-24} +```js {5-29} // docusaurus-plugin/src/index.js module.exports = function(context, options, utils) { return { @@ -272,15 +273,16 @@ module.exports = function(context, options, utils) { }, }, ], - bodyTags: [ + preBodyTags: [ { tagName: 'script', attributes: { - type: 'text/javascript', - src: `/noflash.js`, + charset: 'utf-8', + src: '/noflash.js' }, }, ], + postBodyTags: [`
This is post body
`], }; }, }; From d96d572461cb505782f796302998ec9e6318c161 Mon Sep 17 00:00:00 2001 From: endiliey Date: Thu, 28 Nov 2019 12:32:46 +0700 Subject: [PATCH 7/9] typo --- website/docs/lifecycle-apis.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/docs/lifecycle-apis.md b/website/docs/lifecycle-apis.md index 6801ae5fc14e..64e74d42dfab 100644 --- a/website/docs/lifecycle-apis.md +++ b/website/docs/lifecycle-apis.md @@ -179,7 +179,8 @@ type Props = { outDir: string; baseUrl: string; headTags: string; - bodyTags: string; + preBodyTags: string; + postBodyTags: string; routesPaths: string[]; plugins: Plugin[]; }; From e8db0c0c64fd38412df3a6160bc45fc447b08bab Mon Sep 17 00:00:00 2001 From: endiliey Date: Thu, 28 Nov 2019 22:33:38 +0700 Subject: [PATCH 8/9] refactor typing --- packages/docusaurus-types/src/index.d.ts | 12 +++++++----- packages/docusaurus/src/server/html-tags/index.ts | 13 ++++++++----- website/docs/lifecycle-apis.md | 8 +++++--- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/packages/docusaurus-types/src/index.d.ts b/packages/docusaurus-types/src/index.d.ts index b5271401478d..1cb5dbeb7630 100644 --- a/packages/docusaurus-types/src/index.d.ts +++ b/packages/docusaurus-types/src/index.d.ts @@ -73,13 +73,15 @@ export interface LoadContext { baseUrl: string; } -export interface HtmlTags { +export interface InjectedHtmlTags { headTags: string; preBodyTags: string; postBodyTags: string; } -export interface Props extends LoadContext, HtmlTags { +export type HtmlTags = string | HtmlTagObject | (string | HtmlTagObject)[]; + +export interface Props extends LoadContext, InjectedHtmlTags { routesPaths: string[]; plugins: Plugin[]; } @@ -111,9 +113,9 @@ export interface Plugin { getClientModules?(): string[]; extendCli?(cli: Command): void; injectHtmlTags?(): { - headTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; - preBodyTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; - postBodyTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; + headTags?: HtmlTags; + preBodyTags?: HtmlTags; + postBodyTags?: HtmlTags; }; } diff --git a/packages/docusaurus/src/server/html-tags/index.ts b/packages/docusaurus/src/server/html-tags/index.ts index 59af94efe9c7..ae3fdd887af8 100644 --- a/packages/docusaurus/src/server/html-tags/index.ts +++ b/packages/docusaurus/src/server/html-tags/index.ts @@ -7,19 +7,22 @@ import _ from 'lodash'; import {htmlTagObjectToString} from './htmlTags'; -import {Plugin, HtmlTags, HtmlTagObject} from '@docusaurus/types'; +import { + Plugin, + InjectedHtmlTags, + HtmlTagObject, + HtmlTags, +} from '@docusaurus/types'; function toString(val: string | HtmlTagObject): string { return typeof val === 'string' ? val : htmlTagObjectToString(val); } -export function createHtmlTagsString( - tags: string | HtmlTagObject | (string | HtmlTagObject)[], -): string { +export function createHtmlTagsString(tags: HtmlTags): string { return _.isArray(tags) ? tags.map(toString).join('\n') : toString(tags); } -export function loadHtmlTags(plugins: Plugin[]): HtmlTags { +export function loadHtmlTags(plugins: Plugin[]): InjectedHtmlTags { const htmlTags = plugins.reduce( (acc, plugin) => { if (!plugin.injectHtmlTags) { diff --git a/website/docs/lifecycle-apis.md b/website/docs/lifecycle-apis.md index 64e74d42dfab..78d0762c4136 100644 --- a/website/docs/lifecycle-apis.md +++ b/website/docs/lifecycle-apis.md @@ -232,11 +232,13 @@ Inject head and/or body html tags to Docusaurus generated html. ```typescript function injectHtmlTags(): { - headTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; - preBodyTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; - postBodyTags?: string | HtmlTagObject | (string | HtmlTagObject)[]; + headTags?: HtmlTags; + preBodyTags?: HtmlTags; + postBodyTags?: HtmlTags; }; +type HtmlTags = string | HtmlTagObject | (string | HtmlTagObject)[]; + interface HtmlTagObject { /** * Attributes of the html tag From 21b2bee333e302b5dfa04f1d81a5ab8016601496 Mon Sep 17 00:00:00 2001 From: endiliey Date: Fri, 29 Nov 2019 16:55:12 +0700 Subject: [PATCH 9/9] chore(v2): bump deps --- package.json | 8 +- .../package.json | 2 +- packages/docusaurus/package.json | 2 +- yarn.lock | 491 +++++++----------- 4 files changed, 180 insertions(+), 323 deletions(-) diff --git a/package.json b/package.json index 7eb5f2f579b6..30ee4b472091 100644 --- a/package.json +++ b/package.json @@ -34,18 +34,18 @@ "@types/loader-utils": "^1.1.3", "@types/lodash": "^4.14.149", "@types/lodash.kebabcase": "^4.1.6", - "@types/node": "^12.12.11", + "@types/node": "^12.12.14", "@types/react": "^16.9.13", "@types/react-dev-utils": "^9.0.1", "@types/semver": "^6.2.0", "@types/shelljs": "^0.8.6", "@types/webpack": "^4.41.0", - "@types/webpack-dev-server": "^3.4.0", + "@types/webpack-dev-server": "^3.9.0", "@types/webpack-merge": "^4.1.5", "babel-eslint": "^10.0.3", "enzyme": "^3.10.0", "enzyme-adapter-react-16": "^1.15.1", - "eslint": "^6.7.0", + "eslint": "^6.7.1", "eslint-config-airbnb": "^18.0.1", "eslint-config-prettier": "^6.7.0", "eslint-plugin-header": "^3.0.0", @@ -57,7 +57,7 @@ "jest": "^24.9.0", "lerna": "^3.19.0", "lerna-changelog": "^0.8.3", - "lint-staged": "^9.4.3", + "lint-staged": "^9.5.0", "prettier": "^1.19.1", "react": "^16.8.4", "react-dom": "^16.8.4", diff --git a/packages/docusaurus-plugin-content-docs/package.json b/packages/docusaurus-plugin-content-docs/package.json index 46ad1a1d363f..d00f76f58944 100644 --- a/packages/docusaurus-plugin-content-docs/package.json +++ b/packages/docusaurus-plugin-content-docs/package.json @@ -18,7 +18,7 @@ "dependencies": { "@docusaurus/mdx-loader": "^2.0.0-alpha.36", "@docusaurus/utils": "^2.0.0-alpha.36", - "execa": "^3.3.0", + "execa": "^3.4.0", "fs-extra": "^8.1.0", "globby": "^10.0.1", "import-fresh": "^3.2.1", diff --git a/packages/docusaurus/package.json b/packages/docusaurus/package.json index c365558ddfc6..9534c93a8829 100644 --- a/packages/docusaurus/package.json +++ b/packages/docusaurus/package.json @@ -75,7 +75,7 @@ "semver": "^6.3.0", "shelljs": "^0.8.3", "std-env": "^2.2.1", - "style-loader": "^1.0.0", + "style-loader": "^1.0.1", "terser-webpack-plugin": "^2.2.1", "wait-file": "^1.0.5", "webpack": "^4.41.2", diff --git a/yarn.lock b/yarn.lock index 1e54ecd96f0d..59b7c8a2b474 100644 --- a/yarn.lock +++ b/yarn.lock @@ -725,7 +725,7 @@ "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/polyfill@^7.0.0", "@babel/polyfill@^7.7.0": +"@babel/polyfill@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.7.0.tgz#e1066e251e17606ec7908b05617f9b7f8180d8f3" integrity sha512-/TS23MVvo34dFmf8mwCisCbWGrfhbiWZSwBo6HkADTBhUa2Q/jWltyY/tpofz/b6/RIhqaqQcquptCirqIhOaQ== @@ -820,7 +820,7 @@ pirates "^4.0.0" source-map-support "^0.5.16" -"@babel/runtime@^7.1.2", "@babel/runtime@^7.4.0", "@babel/runtime@^7.4.5", "@babel/runtime@^7.7.4": +"@babel/runtime@^7.1.2", "@babel/runtime@^7.4.0", "@babel/runtime@^7.4.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.4.tgz#b23a856751e4bf099262f867767889c0e3fe175b" integrity sha512-r24eVUUr0QqNZa+qrImUk8fn5SPhHq+IfYvIoIMg0do3GdK9sMdiLKP3GYVVaxpPKORgm8KRKaNTEhAjgIpLMw== @@ -1160,24 +1160,26 @@ "@types/istanbul-reports" "^1.1.1" "@types/yargs" "^13.0.0" -"@jimp/bmp@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/bmp/-/bmp-0.5.4.tgz#b7b375aa774f26154912569864d5466e71333ef1" - integrity sha512-P/ezH1FuoM3FwS0Dm2ZGkph4x5/rPBzFLEZor7KQkmGUnYEIEG4o0BUcAWFmJOp2HgzbT6O2SfrpJNBOcVACzQ== +"@jimp/bmp@^0.9.3": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@jimp/bmp/-/bmp-0.9.3.tgz#98eafc81674ce750f428ac9380007f1a4e90255e" + integrity sha512-wXZYccgGQAsIK8DZX0wZE3gbSd2mL2+eheSJMts6I5hQjxhVRZd1Gwu425nUQGzfKCOgKYTW0nLv7/8OoOTTkw== dependencies: - "@jimp/utils" "^0.5.0" + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.9.3" bmp-js "^0.1.0" - core-js "^2.5.7" + core-js "^3.4.1" -"@jimp/core@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/core/-/core-0.5.4.tgz#69d2d9eef1a6a9d62127171e2688cf21bc0ee77c" - integrity sha512-n3uvHy2ndUKItmbhnRO8xmU8J6KR+v6CQxO9sbeUDpSc3VXc1PkqrA8ZsCVFCjnDFcGBXL+MJeCTyQzq5W9Crw== +"@jimp/core@^0.9.3": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@jimp/core/-/core-0.9.3.tgz#bffbf955c046569bf4b682b575228e31bb41e445" + integrity sha512-kB9lvst1QhgYOC963SAuPgv+DdVfxTProphrSffAAoo5eLeQab/Ca3ZUeX1E/SnLSr+NGVnNCd8c9gyuKDiENg== dependencies: - "@jimp/utils" "^0.5.0" + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.9.3" any-base "^1.1.0" buffer "^5.2.0" - core-js "^2.5.7" + core-js "^3.4.1" exif-parser "^0.1.12" file-type "^9.0.0" load-bmfont "^1.3.1" @@ -1186,231 +1188,84 @@ pixelmatch "^4.0.2" tinycolor2 "^1.4.1" -"@jimp/custom@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/custom/-/custom-0.5.4.tgz#393338efbf15d158ecf6639cb1b196c70411fddd" - integrity sha512-tLfyJoyouDl2J3RPFGfDzTtE+4S8ljqJUmLzy/cmx1n7+xS5TpLPdPskp7UaeAfNTqdF4CNAm94KYoxTZdj2mg== +"@jimp/custom@^0.9.3": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@jimp/custom/-/custom-0.9.3.tgz#b49dfe1d6b24e62fd4101a7db77104024c8d97e8" + integrity sha512-2E7yabQMeqjcK8+ZFu3Ja5cWyrB0zv/pmzNSDg/BBPJ59HE0fj/qcERAz6VklcjHUYRUfmE5uODsb+4DE0o/YQ== dependencies: - "@jimp/core" "^0.5.4" - core-js "^2.5.7" + "@babel/runtime" "^7.7.2" + "@jimp/core" "^0.9.3" + core-js "^3.4.1" -"@jimp/gif@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@jimp/gif/-/gif-0.5.0.tgz#7543870b3d744c9758da76ca43fac4ee48fd6a00" - integrity sha512-HVB4c7b8r/yCpjhCjVNPRFLuujTav5UPmcQcFJjU6aIxmne6e29rAjRJEv3UMamHDGSu/96PzOsPZBO5U+ZGww== +"@jimp/gif@^0.9.3": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@jimp/gif/-/gif-0.9.3.tgz#b2b1a519092f94a913a955f252996f9a968930db" + integrity sha512-DshKgMQ8lXorI/xTRyeRkZqZ3JqgnL2aGYAhx0SkAunyHgXji27chmrOGj/6KVDBucrDf/6mSexnSoUDnlWrfA== dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.9.3" + core-js "^3.4.1" omggif "^1.0.9" -"@jimp/jpeg@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/jpeg/-/jpeg-0.5.4.tgz#ff52669f801e9d82041ba6322ee781c344e75241" - integrity sha512-YaPWm+YSGCThNE/jLMckM3Qs6uaMxd/VsHOnEaqu5tGA4GFbfVaWHjKqkNGAFuiNV+HdgKlNcCOF3of+elvzqQ== +"@jimp/jpeg@^0.9.3": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@jimp/jpeg/-/jpeg-0.9.3.tgz#a759cb3bccf3cb163166873b9bdc0c949c5991b5" + integrity sha512-AJzcTJXfN9BHtpzAbICwR3+GoH0pSr6OYXbAS6yuKwz+xVn9UHrEjQb74CIzIRqrT/VWcIKg29cMQxgokzWY7w== dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.9.3" + core-js "^3.4.1" jpeg-js "^0.3.4" -"@jimp/plugin-blit@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/plugin-blit/-/plugin-blit-0.5.4.tgz#8c4f46e00c0a4ca9d5c592713de7575528485e59" - integrity sha512-WqDYOugv76hF1wnKy7+xPGf9PUbcm9vPW28/jHWn1hjbb2GnusJ2fVEFad76J/1SPfhrQ2Uebf2QCWJuLmOqZg== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-blur@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@jimp/plugin-blur/-/plugin-blur-0.5.0.tgz#c8222bdae8eb4cc86613c0adbcb26a92829739a2" - integrity sha512-5k0PXCA1RTJdITL7yMAyZ5tGQjKLHqFvwdXj/PCoBo5PuMyr0x6qfxmQEySixGk/ZHdDxMi80vYxHdKHjNNgjg== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-color@^0.5.5": - version "0.5.5" - resolved "https://registry.yarnpkg.com/@jimp/plugin-color/-/plugin-color-0.5.5.tgz#68f9652d5065d3380a9967911a7e529325d230d6" - integrity sha512-hWeOqNCmLguGYLhSvBrpfCvlijsMEVaLZAOod62s1rzWnujozyKOzm2eZe+W3To6mHbp5RGJNVrIwHBWMab4ug== +"@jimp/plugin-resize@^0.9.3": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@jimp/plugin-resize/-/plugin-resize-0.9.3.tgz#916abd57c4f9b426984354c77555ade1efda7a82" + integrity sha512-YzqVE8QoDIZpVuI52v+WejwEjEEiJfNFviQfprfm5af7uSSseZgDw1sJ0koqAu+liMSY+Ewp79v2SDrKoJKqtg== dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - tinycolor2 "^1.4.1" + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.9.3" + core-js "^3.4.1" -"@jimp/plugin-contain@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/plugin-contain/-/plugin-contain-0.5.4.tgz#1dc258db36d50e23400e0644b7f2694fd74fbf60" - integrity sha512-8YJh4FI3S69unri0nJsWeqVLeVGA77N2R0Ws16iSuCCD/5UnWd9FeWRrSbKuidBG6TdMBaG2KUqSYZeHeH9GOQ== +"@jimp/png@^0.9.3": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@jimp/png/-/png-0.9.3.tgz#5c1bbb89b32e2332891a13efdb423e87287a8321" + integrity sha512-LJXUemDTSbTGAGEp9hNQH0uTRSB8gYeE6FsfT3M00oZincu6/WzDzl0P8E95rMjNxZqAihdTyOP3+kcrbbqX+w== dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-cover@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/plugin-cover/-/plugin-cover-0.5.4.tgz#a086243b151db9eef09e657fbe8bc3ef8683662e" - integrity sha512-2Rur7b44WiDDgizUI2M2uYWc1RmfhU5KjKS1xXruobjQ0tXkf5xlrPXSushq0hB6Ne0Ss6wv0+/6eQ8WeGHU2w== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-crop@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/plugin-crop/-/plugin-crop-0.5.4.tgz#124cf52aa07e36c7a33f39e2e86e78166c300ca7" - integrity sha512-6t0rqn4VazquGk48tO6hFBrQ+nkvC+A1RnR6UM/m8ZtG2/yjpwF0MXcpgJI1Fb+a4Ug7BY1fu2GPcZOhnAVK/g== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-displace@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@jimp/plugin-displace/-/plugin-displace-0.5.0.tgz#cb75d8588bdee45c1bdb1bec2323705d0e53d060" - integrity sha512-Bec7SQvnmKia4hOXEDjeNVx7vo/1bWqjuV6NO8xbNQcAO3gaCl91c9FjMDhsfAVb0Ou6imhbIuFPrLxorXsecQ== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-dither@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@jimp/plugin-dither/-/plugin-dither-0.5.0.tgz#0f1f6b7dcd5aba8f908bbd4b60685fc29cc6a3ed" - integrity sha512-We2WJQsD/Lm8oqBFp/vUv9/5r2avyenL+wNNu/s2b1HqA5O4sPGrjHy9K6vIov0NroQGCQ3bNznLkTmjiHKBcg== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-flip@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@jimp/plugin-flip/-/plugin-flip-0.5.0.tgz#4a973c9c4bdc6dbcc7da66204a2bb2b12feb9381" - integrity sha512-D/ehBQxLMNR7oNd80KXo4tnSET5zEm5mR70khYOTtTlfti/DlLp3qOdjPOzfLyAdqO7Ly4qCaXrIsnia+pfPrA== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-gaussian@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@jimp/plugin-gaussian/-/plugin-gaussian-0.5.0.tgz#02c9f07516108e01ba0f2938289b08e6e865c2c9" - integrity sha512-Ln4kgxblv0/YzLBDb/J8DYPLhDzKH87Y8yHh5UKv3H+LPKnLaEG3L4iKTE9ivvdocnjmrtTFMYcWv2ERSPeHcg== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-invert@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@jimp/plugin-invert/-/plugin-invert-0.5.0.tgz#4496d2d67ab498c8fa3e89c4b6dd5892e7f14b9b" - integrity sha512-/vyKeIi3T7puf+8ruWovTjzDC585EnTwJ+lGOOUYiNPsdn4JDFe1B3xd+Ayv9aCQbXDIlPElZaM9vd/+wqDiIQ== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-mask@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/plugin-mask/-/plugin-mask-0.5.4.tgz#ac4c2625e328818da1443c92bcb9cabb537c74ba" - integrity sha512-mUJ04pCrUWaJGXPjgoVbzhIQB8cVobj2ZEFlGO3BEAjyylYMrdJlNlsER8dd7UuJ2L/a4ocWtFDdsnuicnBghQ== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-normalize@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/plugin-normalize/-/plugin-normalize-0.5.4.tgz#d60aeb637bcaecadf654c9621e291d6eed12fa19" - integrity sha512-Q5W0oEz9wxsjuhvHAJynI/OqXZcmqEAuRONQId7Aw5ulCXSOg9C4y2a67EO7aZAt55T+zMVxI9UpVUpzVvO6hw== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-print@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/plugin-print/-/plugin-print-0.5.4.tgz#00524a7424a4e12a17764d349485dd1120a43728" - integrity sha512-DOZr5TY9WyMWFBD37oz7KpTEBVioFIHQF/gH5b3O5jjFyj4JPMkw7k3kVBve9lIrzIYrvLqe0wH59vyAwpeEFg== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - load-bmfont "^1.4.0" - -"@jimp/plugin-resize@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/plugin-resize/-/plugin-resize-0.5.4.tgz#c9b2c4949ee080df3fa2ca587539e2ce8588b8af" - integrity sha512-lXNprNAT0QY1D1vG/1x6urUTlWuZe2dfL29P81ApW2Yfcio471+oqo45moX5FLS0q24xU600g7cHGf2/TzqSfA== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-rotate@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/plugin-rotate/-/plugin-rotate-0.5.4.tgz#6c4c560779bc3ebf291db9a5095158d32a2a4af3" - integrity sha512-SIdUpMc8clObMchy8TnjgHgcXEQM992z5KavgiuOnCuBlsmSHtE3MrXTOyMW0Dn3gqapV9Y5vygrLm/BVtCCsg== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugin-scale@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@jimp/plugin-scale/-/plugin-scale-0.5.0.tgz#095f937e5a4887481b3074f5cd6a144d8f4f815e" - integrity sha512-5InIOr3cNtrS5aQ/uaosNf28qLLc0InpNGKFmGFTv8oqZqLch6PtDTjDBZ1GGWsPdA/ljy4Qyy7mJO1QBmgQeQ== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" - -"@jimp/plugins@^0.5.5": - version "0.5.5" - resolved "https://registry.yarnpkg.com/@jimp/plugins/-/plugins-0.5.5.tgz#e97fa368d69ad7718d5a2a9b6ffa8e6cc1e4264d" - integrity sha512-9oF6LbSM/K7YkFCcxaPaD8NUkL/ZY8vT8NIGfQ/NpX+tKQtcsLHcRavHpUC+M1xXShv/QGx9OdBV/jgiu82QYg== - dependencies: - "@jimp/plugin-blit" "^0.5.4" - "@jimp/plugin-blur" "^0.5.0" - "@jimp/plugin-color" "^0.5.5" - "@jimp/plugin-contain" "^0.5.4" - "@jimp/plugin-cover" "^0.5.4" - "@jimp/plugin-crop" "^0.5.4" - "@jimp/plugin-displace" "^0.5.0" - "@jimp/plugin-dither" "^0.5.0" - "@jimp/plugin-flip" "^0.5.0" - "@jimp/plugin-gaussian" "^0.5.0" - "@jimp/plugin-invert" "^0.5.0" - "@jimp/plugin-mask" "^0.5.4" - "@jimp/plugin-normalize" "^0.5.4" - "@jimp/plugin-print" "^0.5.4" - "@jimp/plugin-resize" "^0.5.4" - "@jimp/plugin-rotate" "^0.5.4" - "@jimp/plugin-scale" "^0.5.0" - core-js "^2.5.7" - timm "^1.6.1" - -"@jimp/png@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/png/-/png-0.5.4.tgz#4ed02435ab8ac219b618e9578dfd60626b3b5dd4" - integrity sha512-J2NU7368zihF1HUZdmpXsL/Hhyf+I3ubmK+6Uz3Uoyvtk1VS7dO3L0io6fJQutfWmPZ4bvu6Ry022oHjbi6QCA== - dependencies: - "@jimp/utils" "^0.5.0" - core-js "^2.5.7" + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.9.3" + core-js "^3.4.1" pngjs "^3.3.3" -"@jimp/tiff@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/tiff/-/tiff-0.5.4.tgz#ce5370283eba390ff32b6fd86b9259d7cf3e2315" - integrity sha512-hr7Zq3eWjAZ+itSwuAObIWMRNv7oHVM3xuEDC2ouP7HfE7woBtyhCyfA7u12KlgtM57gKWeogXqTlewRGVzx6g== +"@jimp/tiff@^0.9.3": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@jimp/tiff/-/tiff-0.9.3.tgz#a4498c0616fb24034f5512b159b75b0aea389e9c" + integrity sha512-w9H6dT+GDHN//Srsv27JhRn7R2byzUahOGfFw7KpIn95jg0ogcxjKTo/RAGQC56sr4U092e4Npl7E85Lt934WQ== dependencies: - core-js "^2.5.7" + "@babel/runtime" "^7.7.2" + core-js "^3.4.1" utif "^2.0.1" -"@jimp/types@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@jimp/types/-/types-0.5.4.tgz#c312e415ec9c4a35770e89b9eee424a96be60ab8" - integrity sha512-nbZXM6TsdpnYHIBd8ZuoxGpvmxc2SqiggY30/bhOP/VJQoDBzm2v/20Ywz5M0snpIK2SdYG52eZPNjfjqUP39w== - dependencies: - "@jimp/bmp" "^0.5.4" - "@jimp/gif" "^0.5.0" - "@jimp/jpeg" "^0.5.4" - "@jimp/png" "^0.5.4" - "@jimp/tiff" "^0.5.4" - core-js "^2.5.7" +"@jimp/types@^0.9.3": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@jimp/types/-/types-0.9.3.tgz#75337245a1a8c7c84a414beca3cfeded338c0ef1" + integrity sha512-hUJKoT2IhnbO/trxNWzN19n8g+p7aKbM1R+71n4wMZnD41PzrVtz+sBBCdB+JCjBJs/i7fJt4d9z0i3Xe8m7Zw== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/bmp" "^0.9.3" + "@jimp/gif" "^0.9.3" + "@jimp/jpeg" "^0.9.3" + "@jimp/png" "^0.9.3" + "@jimp/tiff" "^0.9.3" + core-js "^3.4.1" timm "^1.6.1" -"@jimp/utils@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@jimp/utils/-/utils-0.5.0.tgz#ecb33259c75238053d6c7706a3e91f657dbabf91" - integrity sha512-7H9RFVU+Li2XmEko0GGyzy7m7JjSc7qa+m8l3fUzYg2GtwASApjKF/LSG2AUQCUmDKFLdfIEVjxvKvZUJFEmpw== +"@jimp/utils@^0.9.3": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@jimp/utils/-/utils-0.9.3.tgz#fd7af0d1138febbeacc841be4b802218444ce088" + integrity sha512-9D2Of6BcjYONtl77YfmU2y5aRMLe0/O2e2aQvfCxdNwD33jRdwNdN4i3m73dpiClNquApIjL4nYGhTixA4UstA== dependencies: - core-js "^2.5.7" + "@babel/runtime" "^7.7.2" + core-js "^3.4.1" "@lerna/add@3.19.0": version "3.19.0" @@ -2322,9 +2177,9 @@ "@types/json-schema" "*" "@types/estree@*": - version "0.0.39" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" - integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== + version "0.0.40" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.40.tgz#0e6cb9b9bbd098031fa19e4b4e8131bc70e5de13" + integrity sha512-p3KZgMto/JyxosKGmnLDJ/dG5wf+qTRMUjHJcspC2oQKa4jP7mz+tv0ND56lLBu3ojHlhzY33Ol+khLyNmilkA== "@types/events@*": version "3.0.0" @@ -2468,15 +2323,15 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/node@*", "@types/node@>= 8", "@types/node@^12.12.11": - version "12.12.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.12.tgz#529bc3e73dbb35dd9e90b0a1c83606a9d3264bdb" - integrity sha512-MGuvYJrPU0HUwqF7LqvIj50RZUX23Z+m583KBygKYUZLlZ88n6w28XRNJRJgsHukLEnLz6w6SvxZoLgbr5wLqQ== +"@types/node@*", "@types/node@>= 8", "@types/node@^12.12.14": + version "12.12.14" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.14.tgz#1c1d6e3c75dba466e0326948d56e8bd72a1903d2" + integrity sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA== "@types/node@^10.11.7": - version "10.17.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.5.tgz#c1920150f7b90708a7d0f3add12a06bc9123c055" - integrity sha512-RElZIr/7JreF1eY6oD5RF3kpmdcreuQPjg5ri4oQ5g9sq7YWU8HkfB3eH8GwAwxf5OaCh0VPi7r4N/yoTGelrA== + version "10.17.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.6.tgz#1aaabd6f6470a6ac3824ab1e94d731ca1326d93d" + integrity sha512-0a2X6cgN3RdPBL2MIlR6Lt0KlM7fOFsutuXcdglcOq6WvLnYXgPQSh0Mx6tO1KCAE8MxbHSOSTWDoUxRq+l3DA== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -2577,10 +2432,10 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e" integrity sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ== -"@types/webpack-dev-server@*", "@types/webpack-dev-server@^3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@types/webpack-dev-server/-/webpack-dev-server-3.4.0.tgz#8e29afafb8238185c0d4e94fb544f0e12f0248e1" - integrity sha512-cNxiXfGnMxVgXOjmo/SQdsIX2Muan0A44AvPgVfz9y1PfWogOJGEy+/nFkrF/luvFxykJXT+fZYPpyuIGZtRZg== +"@types/webpack-dev-server@*", "@types/webpack-dev-server@^3.9.0": + version "3.9.0" + resolved "https://registry.yarnpkg.com/@types/webpack-dev-server/-/webpack-dev-server-3.9.0.tgz#e31096477a88b0e54968cbc0d688dac9ba2c5442" + integrity sha512-4wXREDfUJmKTNcoaLLHjgsRHZhogIScXJPc5B6e5bYx16zd9H3WfM67w+mEgNaRxVCgb6YNnc8O2lX2IUn4zdQ== dependencies: "@types/connect-history-api-fallback" "*" "@types/express" "*" @@ -2853,9 +2708,9 @@ acorn@^5.5.3: integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== acorn@^6.0.1, acorn@^6.0.7, acorn@^6.1.1, acorn@^6.2.1: - version "6.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" - integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== + version "6.4.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.0.tgz#b659d2ffbafa24baf5db1cdbb2c94a983ecd2784" + integrity sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw== acorn@^7.1.0: version "7.1.0" @@ -3336,9 +3191,9 @@ aws-sign2@~0.7.0: integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= aws4@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" - integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== + version "1.9.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.0.tgz#24390e6ad61386b0a747265754d2a17219de862c" + integrity sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A== axobject-query@^2.0.2: version "2.0.2" @@ -3582,9 +3437,9 @@ bluebird@3.0.5: integrity sha1-L/nQfJs+2ynW0oD+B1KDZefs05I= bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5, bluebird@^3.7.1: - version "3.7.1" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.1.tgz#df70e302b471d7473489acf26a93d63b53f874de" - integrity sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg== + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== bmp-js@^0.1.0: version "0.1.0" @@ -4058,9 +3913,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30000989, caniuse-lite@^1.0.30001010: - version "1.0.30001011" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001011.tgz#0d6c4549c78c4a800bb043a83ca0cbe0aee6c6e1" - integrity sha512-h+Eqyn/YA6o6ZTqpS86PyRmNWOs1r54EBDcd2NTwwfsXQ8re1B38SnB+p2RKF8OUsyEIjeDU8XGec1RGO/wYCg== + version "1.0.30001012" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001012.tgz#653ec635e815b9e0fb801890923b0c2079eb34ec" + integrity sha512-7RR4Uh04t9K1uYRWzOJmzplgEOAXbfK72oVNokCdMzA67trrhPzy93ahKk1AWHiA0c58tD2P+NHqxrA8FZ+Trg== capture-exit@^2.0.0: version "2.0.0" @@ -4758,9 +4613,9 @@ copy-webpack-plugin@^5.0.5: webpack-log "^2.0.0" core-js-compat@^3.1.1: - version "3.4.2" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.4.2.tgz#652fa7c54652b7f6586a893e37001df55ea2ac37" - integrity sha512-W0Aj+LM3EAxxjD0Kp2o4be8UlnxIZHNupBv2znqrheR4aY2nOn91794k/xoSp+SxqqriiZpTsSwBtZr60cbkwQ== + version "3.4.5" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.4.5.tgz#f072059c0b98ad490eacac082296cfe241af1b58" + integrity sha512-rYVvzvKJDKoefdAC+q6VP63vp5hMmeVONCi9pVUbU1qRrtVrmAk/nPhnRg+i+XFd775m1hpG2Yd5RY3X45ccuw== dependencies: browserslist "^4.7.3" semver "^6.3.0" @@ -4770,11 +4625,16 @@ core-js@^1.0.0: resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= -core-js@^2.4.1, core-js@^2.5.7, core-js@^2.6.5: +core-js@^2.4.1, core-js@^2.6.5: version "2.6.10" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.10.tgz#8a5b8391f8cc7013da703411ce5b585706300d7f" integrity sha512-I39t74+4t+zau64EN1fE5v2W31Adtc/REhzWN+gWRRXg6WH5qAsZm62DHpQ1+Yhe4047T55jvzz7MUqF/dBBlA== +core-js@^3.4.1: + version "3.4.5" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.4.5.tgz#3dda65611d95699b5eb7742ea451ea052d37aa65" + integrity sha512-OuvejWH6vIaUo59Ndlh89purNm4DCIy/v3QoYlcGnn+PkYI8BhNHfCuAESrWX+ZPfq9JccVJ+XXgOMy77PJexg== + core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -5721,9 +5581,9 @@ ejs@^3.0.1: integrity sha512-cuIMtJwxvzumSAkqaaoGY/L6Fc/t6YvoP9/VIaK0V/CyqKLEQ8sqODmYfy/cjXEdZ9+OOL8TecbJu+1RsofGDw== electron-to-chromium@^1.3.247, electron-to-chromium@^1.3.306: - version "1.3.312" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.312.tgz#6ef8700096e4a726b9cd7285523561629fa70e12" - integrity sha512-/Nk6Hvwt+RfS9X3oA4IXpWqpcnS7cdWsTMP4AmrP8hPpxtZbHemvTEYzjAKghk28aS9zIV8NwGHNt8H+6OmJug== + version "1.3.314" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.314.tgz#c186a499ed2c9057bce9eb8dca294d6d5450facc" + integrity sha512-IKDR/xCxKFhPts7h+VaSXS02Z1mznP3fli1BbXWXeN89i2gCzKraU8qLpEid8YzKcmZdZD3Mly3cn5/lY9xsBQ== elegant-spinner@^1.0.1: version "1.0.1" @@ -5903,22 +5763,22 @@ error@^7.0.0: string-template "~0.2.1" es-abstract@^1.12.0, es-abstract@^1.13.0, es-abstract@^1.15.0, es-abstract@^1.5.1, es-abstract@^1.7.0: - version "1.16.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.0.tgz#d3a26dc9c3283ac9750dca569586e976d9dcc06d" - integrity sha512-xdQnfykZ9JMEiasTAJZJdMWCQ1Vm00NBw79/AWi7ELfZuuPCSOMDZbT9mkOfSctVtfhb+sAAzrm+j//GjjLHLg== + version "1.16.2" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.2.tgz#4e874331645e9925edef141e74fc4bd144669d34" + integrity sha512-jYo/J8XU2emLXl3OLwfwtuFfuF2w6DYPs+xy9ZfVyPkDcrauu6LYrw/q2TyCtrbc/KUdCiC5e9UajRhgNkVopA== dependencies: - es-to-primitive "^1.2.0" + es-to-primitive "^1.2.1" function-bind "^1.1.1" has "^1.0.3" - has-symbols "^1.0.0" + has-symbols "^1.0.1" is-callable "^1.1.4" is-regex "^1.0.4" - object-inspect "^1.6.0" + object-inspect "^1.7.0" object-keys "^1.1.1" string.prototype.trimleft "^2.1.0" string.prototype.trimright "^2.1.0" -es-to-primitive@^1.2.0: +es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== @@ -6007,6 +5867,11 @@ eslint-module-utils@^2.4.0: debug "^2.6.8" pkg-dir "^2.0.0" +eslint-plugin-eslint-plugin@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-2.1.0.tgz#a7a00f15a886957d855feacaafee264f039e62d5" + integrity sha512-kT3A/ZJftt28gbl/Cv04qezb/NQ1dwYIbi8lyf806XMxkus7DvOVCLIfTXMrorp322Pnoez7+zabXH29tADIDg== + eslint-plugin-header@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/eslint-plugin-header/-/eslint-plugin-header-3.0.0.tgz#0e048b5f0adfdd9754142d59d551ae6bfdaf90ad" @@ -6050,19 +5915,20 @@ eslint-plugin-react-hooks@^2.3.0: integrity sha512-gLKCa52G4ee7uXzdLiorca7JIQZPPXRAQDXV83J4bUEeUuc5pIEyZYAZ45Xnxe5IuupxEqHS+hUhSLIimK1EMw== eslint-plugin-react@^7.16.0: - version "7.16.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.16.0.tgz#9928e4f3e2122ed3ba6a5b56d0303ba3e41d8c09" - integrity sha512-GacBAATewhhptbK3/vTP09CbFrgUJmBSaaRcWdbQLFvUZy9yVcQxigBNHGPU/KE2AyHpzj3AWXpxoMTsIDiHug== + version "7.17.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.17.0.tgz#a31b3e134b76046abe3cd278e7482bd35a1d12d7" + integrity sha512-ODB7yg6lxhBVMeiH1c7E95FLD4E/TwmFjltiU+ethv7KPdCwgiFuOZg9zNRHyufStTDLl/dEFqI2Q1VPmCd78A== dependencies: array-includes "^3.0.3" doctrine "^2.1.0" + eslint-plugin-eslint-plugin "^2.1.0" has "^1.0.3" - jsx-ast-utils "^2.2.1" + jsx-ast-utils "^2.2.3" object.entries "^1.1.0" - object.fromentries "^2.0.0" + object.fromentries "^2.0.1" object.values "^1.1.0" prop-types "^15.7.2" - resolve "^1.12.0" + resolve "^1.13.1" eslint-scope@^4.0.3: version "4.0.3" @@ -6092,10 +5958,10 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== -eslint@^6.7.0: - version "6.7.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.7.0.tgz#766162e383b236e61d873697f82c3a3e41392020" - integrity sha512-dQpj+PaHKHfXHQ2Imcw5d853PTvkUGbHk/MR68KQUl98EgKDCdh4vLRH1ZxhqeQjQFJeg8fgN0UwmNhN3l8dDQ== +eslint@^6.7.1: + version "6.7.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.7.1.tgz#269ccccec3ef60ab32358a44d147ac209154b919" + integrity sha512-UWzBS79pNcsDSxgxbdjkmzn/B6BhsXMfUaOHnNwyE8nD+Q6pyT96ow2MccVayUTV4yMid4qLhMiQaywctRkBLA== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -6282,10 +6148,10 @@ execa@^2.0.3: signal-exit "^3.0.2" strip-final-newline "^2.0.0" -execa@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-3.3.0.tgz#7e348eef129a1937f21ecbbd53390942653522c1" - integrity sha512-j5Vit5WZR/cbHlqU97+qcnw9WHRCIL4V1SVe75VcHcD1JRBdt8fv0zw89b7CQHQdUHTt2VjuhcF5ibAgVOxqpg== +execa@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-3.4.0.tgz#c08ed4550ef65d858fac269ffc8572446f37eb89" + integrity sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g== dependencies: cross-spawn "^7.0.0" get-stream "^5.0.0" @@ -9109,17 +8975,6 @@ jest@^24.9.0: import-local "^2.0.0" jest-cli "^24.9.0" -jimp@^0.5.4: - version "0.5.6" - resolved "https://registry.yarnpkg.com/jimp/-/jimp-0.5.6.tgz#dd114decd060927ae439f2e0980df619c179f912" - integrity sha512-H0nHTu6KgAgQzDxa38ew2dXbnRzKm1w5uEyhMIxqwCQVjwgarOjjkV/avbNLxfxRHAFaNp4rGIc/qm8P+uhX9A== - dependencies: - "@babel/polyfill" "^7.0.0" - "@jimp/custom" "^0.5.4" - "@jimp/plugins" "^0.5.5" - "@jimp/types" "^0.5.4" - core-js "^2.5.7" - jpeg-js@^0.3.4: version "0.3.6" resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.3.6.tgz#c40382aac9506e7d1f2d856eb02f6c7b2a98b37c" @@ -9275,7 +9130,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jsx-ast-utils@^2.2.1: +jsx-ast-utils@^2.2.1, jsx-ast-utils@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.2.3.tgz#8a9364e402448a3ce7f14d357738310d9248054f" integrity sha512-EdIHFMm+1BPynpKOpdPqiOsvnIrInRGJD7bzPZdPkjitQEqpdpUuFpq4T0npZFKTiB3RhWFdGN+oqOJIdhDhQA== @@ -9413,10 +9268,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -lint-staged@^9.4.3: - version "9.4.3" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.4.3.tgz#f55ad5f94f6e105294bfd6499b23142961f7b982" - integrity sha512-PejnI+rwOAmKAIO+5UuAZU9gxdej/ovSEOAY34yMfC3OS4Ac82vCBPzAWLReR9zCPOMqeVwQRaZ3bUBpAsaL2Q== +lint-staged@^9.5.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.5.0.tgz#290ec605252af646d9b74d73a0fa118362b05a33" + integrity sha512-nawMob9cb/G1J98nb8v3VC/E8rcX1rryUYXVZ69aT9kde6YWX+uvNOEHY5yf2gcWcTJGiD0kqXmCnS3oD75GIA== dependencies: chalk "^2.4.2" commander "^2.20.0" @@ -9492,7 +9347,7 @@ livereload-js@^2.3.0: resolved "https://registry.yarnpkg.com/livereload-js/-/livereload-js-2.4.0.tgz#447c31cf1ea9ab52fc20db615c5ddf678f78009c" integrity sha512-XPQH8Z2GDP/Hwz2PCDrh2mth4yFejwA1OZ/81Ti3LgKyhDcEjsSsqFWZojHG0va/duGd+WyosY7eXLDoOyqcPw== -load-bmfont@^1.3.1, load-bmfont@^1.4.0: +load-bmfont@^1.3.1: version "1.4.0" resolved "https://registry.yarnpkg.com/load-bmfont/-/load-bmfont-1.4.0.tgz#75f17070b14a8c785fe7f5bee2e6fd4f98093b6b" integrity sha512-kT63aTAlNhZARowaNYcY29Fn/QYkc52M3l6V1ifRcPewg2lvUZDAj7R6dXjOL9D0sict76op3T5+odumDSF81g== @@ -10529,9 +10384,9 @@ no-case@^2.2.0: lower-case "^1.1.1" node-abi@^2.7.0: - version "2.12.0" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.12.0.tgz#40e9cfabdda1837863fa825e7dfa0b15686adf6f" - integrity sha512-VhPBXCIcvmo/5K8HPmnWJyyhvgKxnHTUMXR/XwGHV68+wrgkzST4UmQrY/XszSWA5dtnXpNp528zkcyJ/pzVcw== + version "2.13.0" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.13.0.tgz#e2f2ec444d0aca3ea1b3874b6de41d1665828f63" + integrity sha512-9HrZGFVTR5SOu3PZAnAY2hLO36aW1wmA+FDsVkr85BTST32TLCA1H/AEcatVRAsWLyXS3bqUDYCAjq5/QGuSTA== dependencies: semver "^5.4.1" @@ -10660,13 +10515,15 @@ node-releases@^1.1.29, node-releases@^1.1.40: semver "^6.3.0" node-vibrant@^3.1.4: - version "3.1.4" - resolved "https://registry.yarnpkg.com/node-vibrant/-/node-vibrant-3.1.4.tgz#6d3ec01bb5e3e45f05cd6d81e1ed7da3d429f594" - integrity sha512-6z33ItA+hKW96kV/qRxxJraHlLacB0vlGW8QKKbYYIiMs0pZxeMNl2iEnR6ZepqD86PnmWCnKGHxzndBaZoc8g== + version "3.1.5" + resolved "https://registry.yarnpkg.com/node-vibrant/-/node-vibrant-3.1.5.tgz#8729bf35aabd54cd2eccbfadf22124ab4e1305b0" + integrity sha512-Gk+iyBzPSN1SF5qL818QaBtuA38206Z8iPNa0PcLUPyIbZL4+i14VmYxkGCL0n/5Q1721CRSktqtACgkx7Qodg== dependencies: + "@jimp/custom" "^0.9.3" + "@jimp/plugin-resize" "^0.9.3" + "@jimp/types" "^0.9.3" "@types/lodash" "^4.14.53" "@types/node" "^10.11.7" - jimp "^0.5.4" lodash "^4.17.4" url "^0.11.0" @@ -10892,7 +10749,7 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" -object-inspect@^1.6.0: +object-inspect@^1.6.0, object-inspect@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw== @@ -10934,7 +10791,7 @@ object.entries@^1.0.4, object.entries@^1.1.0: function-bind "^1.1.1" has "^1.0.3" -object.fromentries@^2.0.0, object.fromentries@^2.0.1: +object.fromentries@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.1.tgz#050f077855c7af8ae6649f45c80b16ee2d31e704" integrity sha512-PUQv8Hbg3j2QX0IQYv3iAGCbGcu4yY4KQ92/dhA4sFSixBmSmp13UpDLs6jGK8rBtbmhNNIK99LD2k293jpiGA== @@ -12003,9 +11860,9 @@ postcss-modules-local-by-default@^3.0.2: postcss-value-parser "^4.0.0" postcss-modules-scope@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-2.1.0.tgz#ad3f5bf7856114f6fcab901b0502e2a2bc39d4eb" - integrity sha512-91Rjps0JnmtUB0cujlc8KIKCsJXWjzuxGeT/+Q2i2HXKZ7nBUeF9YQTZZTNvHVoNYj1AthsjnGLtqDUE0Op79A== + version "2.1.1" + resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-2.1.1.tgz#33d4fc946602eb5e9355c4165d68a10727689dba" + integrity sha512-OXRUPecnHCg8b9xWvldG/jUpRIGPNRka0r4D4j0ESUU2/5IOnpsjfPPmDprM3Ih8CgZ8FXjWqaniK5v4rWt3oQ== dependencies: postcss "^7.0.6" postcss-selector-parser "^6.0.0" @@ -13408,10 +13265,10 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.12.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: - version "1.12.2" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.2.tgz#08b12496d9aa8659c75f534a8f05f0d892fff594" - integrity sha512-cAVTI2VLHWYsGOirfeYVVQ7ZDejtQ9fp4YhYckWDEkFfqbVjaT11iM8k6xSAfGFMM+gDpZjMnFssPu8we+mqFw== +resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: + version "1.13.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16" + integrity sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w== dependencies: path-parse "^1.0.6" @@ -13611,9 +13468,9 @@ schema-utils@^1.0.0: ajv-keywords "^3.1.0" schema-utils@^2.0.0, schema-utils@^2.0.1, schema-utils@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.5.0.tgz#8f254f618d402cc80257486213c8970edfd7c22f" - integrity sha512-32ISrwW2scPXHUSusP8qMg5dLUawKkyV+/qIEV9JdXKx+rsM6mi8vZY8khg2M69Qom16rtroWXD3Ybtiws38gQ== + version "2.6.1" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.1.tgz#eb78f0b945c7bcfa2082b3565e8db3548011dc4f" + integrity sha512-0WXHDs1VDJyo+Zqs9TKLKyD/h7yDpHUhEFsM2CzkICFdoX1av+GBq/J2xRTFfsQO5kBfhZzANf2VcIm84jqDbg== dependencies: ajv "^6.10.2" ajv-keywords "^3.4.1" @@ -14479,10 +14336,10 @@ strong-log-transformer@^2.0.0: minimist "^1.2.0" through "^2.3.4" -style-loader@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.0.0.tgz#1d5296f9165e8e2c85d24eee0b7caf9ec8ca1f82" - integrity sha512-B0dOCFwv7/eY31a5PCieNwMgMhVGFe9w+rh7s/Bx8kfFkrth9zfTZquoYvdw8URgiqxObQKcpW51Ugz1HjfdZw== +style-loader@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.0.1.tgz#aec6d4c61d0ed8d0a442faed741d4dfc6573888a" + integrity sha512-CnpEkSR1C+REjudiTWCv4+ssP7SCiuaQZJTZDWBRwTJoS90mdqkB8uOGMHKgVeUzpaU7IfLWoyQbvvs5Joj3Xw== dependencies: loader-utils "^1.2.3" schema-utils "^2.0.1" @@ -15044,9 +14901,9 @@ ua-parser-js@^0.7.18: integrity sha512-8OaIKfzL5cpx8eCMAhhvTlft8GYF8b2eQr6JkCyVdrgjcytyOmPCXrqXFcUnhonRpLlh5yxEZVohm6mzaowUOw== uglify-js@^3.1.4: - version "3.6.9" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.9.tgz#85d353edb6ddfb62a9d798f36e91792249320611" - integrity sha512-pcnnhaoG6RtrvHJ1dFncAe8Od6Nuy30oaJ82ts6//sGSXOP5UjBMEthiProjXmMNHOfd93sqlkztifFMcb+4yw== + version "3.7.0" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.7.0.tgz#14b854003386b7a7c045910f43afbc96d2aa5307" + integrity sha512-PC/ee458NEMITe1OufAjal65i6lB58R1HWMRcxwvdz1UopW0DYqlRL3xdu3IcTvTXsB02CRHykidkTRL+A3hQA== dependencies: commander "~2.20.3" source-map "~0.6.1"