@docusaurus/plugin-ideal-image 0.0.0-5023 → 0.0.0-5024

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +54 -56
  2. package/package.json +9 -13
package/lib/index.js CHANGED
@@ -1,71 +1,69 @@
1
- 'use strict';
1
+ "use strict";
2
2
  /**
3
3
  * Copyright (c) Facebook, Inc. and its affiliates.
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
- Object.defineProperty(exports, '__esModule', {value: true});
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.validateOptions = void 0;
10
- const utils_validation_1 = require('@docusaurus/utils-validation');
11
- const theme_translations_1 = require('@docusaurus/theme-translations');
10
+ const utils_validation_1 = require("@docusaurus/utils-validation");
11
+ const theme_translations_1 = require("@docusaurus/theme-translations");
12
12
  function pluginIdealImage(context, options) {
13
- const {
14
- i18n: {currentLocale},
15
- } = context;
16
- return {
17
- name: 'docusaurus-plugin-ideal-image',
18
- getThemePath() {
19
- return '../lib/theme';
20
- },
21
- getTypeScriptThemePath() {
22
- return '../src/theme';
23
- },
24
- getDefaultCodeTranslationMessages() {
25
- return (0, theme_translations_1.readDefaultCodeTranslationMessages)({
26
- locale: currentLocale,
27
- name: 'plugin-ideal-image',
28
- });
29
- },
30
- configureWebpack(_config, isServer) {
31
- const {disableInDev, ...loaderOptions} = options;
32
- if (disableInDev && process.env.NODE_ENV !== 'production') {
33
- return {};
34
- }
35
- return {
36
- mergeStrategy: {
37
- 'module.rules': 'prepend',
13
+ const { i18n: { currentLocale }, } = context;
14
+ return {
15
+ name: 'docusaurus-plugin-ideal-image',
16
+ getThemePath() {
17
+ return '../lib/theme';
38
18
  },
39
- module: {
40
- rules: [
41
- {
42
- test: /\.(?:png|jpe?g)$/i,
43
- use: [
44
- require.resolve('@docusaurus/lqip-loader'),
45
- {
46
- loader: require.resolve('@docusaurus/responsive-loader'),
47
- options: {
48
- // Don't emit for server-side rendering
49
- emitFile: !isServer,
50
- // eslint-disable-next-line global-require
51
- adapter: require('@docusaurus/responsive-loader/sharp'),
52
- name: 'assets/ideal-img/[name].[hash:hex:7].[width].[ext]',
53
- ...loaderOptions,
54
- },
19
+ getTypeScriptThemePath() {
20
+ return '../src/theme';
21
+ },
22
+ getDefaultCodeTranslationMessages() {
23
+ return (0, theme_translations_1.readDefaultCodeTranslationMessages)({
24
+ locale: currentLocale,
25
+ name: 'plugin-ideal-image',
26
+ });
27
+ },
28
+ configureWebpack(_config, isServer) {
29
+ const { disableInDev, ...loaderOptions } = options;
30
+ if (disableInDev && process.env.NODE_ENV !== 'production') {
31
+ return {};
32
+ }
33
+ return {
34
+ mergeStrategy: {
35
+ 'module.rules': 'prepend',
36
+ },
37
+ module: {
38
+ rules: [
39
+ {
40
+ test: /\.(?:png|jpe?g)$/i,
41
+ use: [
42
+ require.resolve('@docusaurus/lqip-loader'),
43
+ {
44
+ loader: require.resolve('@docusaurus/responsive-loader'),
45
+ options: {
46
+ // Don't emit for server-side rendering
47
+ emitFile: !isServer,
48
+ // eslint-disable-next-line global-require
49
+ adapter: require('@docusaurus/responsive-loader/sharp'),
50
+ name: 'assets/ideal-img/[name].[hash:hex:7].[width].[ext]',
51
+ ...loaderOptions,
52
+ },
53
+ },
54
+ ],
55
+ },
56
+ ],
55
57
  },
56
- ],
57
- },
58
- ],
58
+ };
59
59
  },
60
- };
61
- },
62
- };
60
+ };
63
61
  }
64
62
  exports.default = pluginIdealImage;
65
- function validateOptions({validate, options}) {
66
- const pluginOptionsSchema = utils_validation_1.Joi.object({
67
- disableInDev: utils_validation_1.Joi.boolean().default(true),
68
- }).unknown();
69
- return validate(pluginOptionsSchema, options);
63
+ function validateOptions({ validate, options, }) {
64
+ const pluginOptionsSchema = utils_validation_1.Joi.object({
65
+ disableInDev: utils_validation_1.Joi.boolean().default(true),
66
+ }).unknown();
67
+ return validate(pluginOptionsSchema, options);
70
68
  }
71
69
  exports.validateOptions = validateOptions;
package/package.json CHANGED
@@ -1,15 +1,11 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-ideal-image",
3
- "version": "0.0.0-5023",
3
+ "version": "0.0.0-5024",
4
4
  "description": "Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-ideal-image.d.ts",
7
7
  "scripts": {
8
- "build": "yarn build:server && yarn build:browser && yarn build:copy && yarn build:format",
9
- "build:server": "tsc --project tsconfig.server.json",
10
- "build:browser": "tsc --project tsconfig.browser.json",
11
- "build:copy": "node copyUntypedFiles.mjs",
12
- "build:format": "prettier --config ../../.prettierrc --write \"lib/**/*.js\""
8
+ "build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\""
13
9
  },
14
10
  "publishConfig": {
15
11
  "access": "public"
@@ -21,11 +17,11 @@
21
17
  },
22
18
  "license": "MIT",
23
19
  "dependencies": {
24
- "@docusaurus/core": "0.0.0-5023",
25
- "@docusaurus/lqip-loader": "0.0.0-5023",
20
+ "@docusaurus/core": "0.0.0-5024",
21
+ "@docusaurus/lqip-loader": "0.0.0-5024",
26
22
  "@docusaurus/responsive-loader": "^1.7.0",
27
- "@docusaurus/theme-translations": "0.0.0-5023",
28
- "@docusaurus/utils-validation": "0.0.0-5023",
23
+ "@docusaurus/theme-translations": "0.0.0-5024",
24
+ "@docusaurus/utils-validation": "0.0.0-5024",
29
25
  "@endiliey/react-ideal-image": "^0.0.11",
30
26
  "react-waypoint": "^10.1.0",
31
27
  "sharp": "^0.30.4",
@@ -33,8 +29,8 @@
33
29
  "webpack": "^5.72.1"
34
30
  },
35
31
  "devDependencies": {
36
- "@docusaurus/module-type-aliases": "0.0.0-5023",
37
- "@docusaurus/types": "0.0.0-5023",
32
+ "@docusaurus/module-type-aliases": "0.0.0-5024",
33
+ "@docusaurus/types": "0.0.0-5024",
38
34
  "fs-extra": "^10.1.0"
39
35
  },
40
36
  "peerDependencies": {
@@ -50,5 +46,5 @@
50
46
  "engines": {
51
47
  "node": ">=14"
52
48
  },
53
- "gitHead": "e982ebda1c6b2210cce9d2b972f441f3ef3201ac"
49
+ "gitHead": "9d61f0a1f0c1121d25211afbb0fc45a92ca3b2ec"
54
50
  }