{"name":"gatsby-plugin-utils","version":"4.16.0","keywords":["gatsby"],"author":{"name":"Max Stoiber","email":"@mxstbr"},"license":"MIT","_id":"gatsby-plugin-utils@4.16.0","maintainers":[{"name":"pieh","email":"misiek.piechowiak@gmail.com"},{"name":"kathmbeck","email":"katherine.beck@netlify.com"},{"name":"serhalp-netlify","email":"philippe.serhal@netlify.com"},{"name":"mlgualtieri-gatsby","email":"mike.gualtieri@netlify.com"},{"name":"wardpeet","email":"ward@coding-tech.com"}],"homepage":"https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-utils#readme","bugs":{"url":"https://github.com/gatsbyjs/gatsby/issues"},"dist":{"shasum":"5d2a89cf0dd6e15779a73fba8899255cee526b02","tarball":"http://registry-npm.ywwl.com/gatsby-plugin-utils/download/gatsby-plugin-utils-4.16.0.tgz","fileCount":58,"integrity":"sha512-5a2ui0XQBNP8vln/UyfaGBYrVpZ0oeK3fY6LjL2zx9H6wVcO5HLdjmU9yDUwQJygi2GtYW7VGQVKHfBGXMHI6A==","signatures":[{"sig":"MEQCIDJAb4H00v5cdL0AT8XZ2eFGjh9Xqe8+dfI2c5JLBAf8AiAf7R54L6lEZ06Tfm+WtrvG14zi/IyIB2pcBNcA9fw8fA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":199359,"size":48826,"noattachment":false,"key":"/gatsby-plugin-utils/-/gatsby-plugin-utils-4.16.0.tgz"},"main":"dist/index.js","engines":{"node":">=18.0.0 <26"},"exports":{".":"./dist/index.js","./*":"./dist/*.js","./dist/*":"./dist/*.js","./dist/utils":null,"./polyfill-remote-file":"./dist/polyfill-remote-file/index.js","./dist/polyfill-remote-file":null,"./dist/polyfill-remote-file/graphql/*":"./dist/polyfill-remote-file/graphql/*.js","./dist/polyfill-remote-file/jobs/gatsby-worker.js":"./dist/polyfill-remote-file/jobs/gatsby-worker.js"},"gitHead":"92d6c67dcf10b641adf5fcc81ebeec5f50b75e40","scripts":{"build":"babel src --out-dir dist/ --ignore \"**/__tests__\" --extensions \".ts,.js\"","watch":"babel -w src --out-dir dist/ --ignore \"**/__tests__\" --extensions \".ts,.js\"","prepare":"cross-env NODE_ENV=production npm run build && npm run typegen","typegen":"rimraf --glob \"dist/**/*.d.ts\" && tsc --emitDeclarationOnly --declaration --declarationDir dist/"},"_npmUser":{"name":"serhalp-netlify","email":"philippe.serhal@netlify.com"},"repository":{"url":"git+https://github.com/gatsbyjs/gatsby.git","type":"git","directory":"packages/gatsby-plugin-utils"},"_npmVersion":"lerna/3.22.1/node@v22.19.0+arm64 (darwin)","description":"Gatsby utils that help creating plugins","directories":{},"_nodeVersion":"22.19.0","dependencies":{"joi":"^17.11.0","mime":"^3.0.0","fastq":"^1.16.0","fs-extra":"^11.2.0","import-from":"^4.0.0","gatsby-sharp":"^1.16.0","@babel/runtime":"^7.20.13","graphql-compose":"^9.0.10","gatsby-core-utils":"^4.16.0"},"typesVersions":{"*":{"*":["dist/*.d.ts","dist/index.d.ts"],"dist/*":["dist/*.d.ts","dist/index.d.ts"],"polyfill-remote-file":["dist/polyfill-remote-file/index.d.ts"]}},"_hasShrinkwrap":false,"devDependencies":{"msw":"^1.2.2","rimraf":"^5.0.1","cross-env":"^7.0.3","@babel/cli":"^7.20.7","typescript":"^5.1.6","@babel/core":"^7.20.12","babel-preset-gatsby-package":"^3.16.0"},"peerDependencies":{"gatsby":"^5.0.0-next","graphql":"^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-plugin-utils_4.16.0_1769459244665_0.8977127667051095","host":"s3://npm-registry-packages-npm-production"},"readme":"# gatsby-plugin-utils\n\n## Usage\n\n```shell\nnpm install gatsby-plugin-utils\n```\n\n### `validateOptionsSchema`\n\nThe `validateOptionsSchema` function verifies that the proper data types of options were passed into a plugin from the `gatsby-config.js` file. It is called internally by Gatsby to validate each plugin's options when a site is started.\n\n#### Example\n\n```js\nimport { validateOptionsSchema } from \"gatsby-plugin-utils\"\n\nawait validateOptionsSchema(pluginName, pluginSchema, pluginOptions)\n```\n\n### `testPluginOptionsSchema`\n\nUtility to validate and test plugin options schemas. An example of a plugin options schema implementation can be found in the [`gatsby-node.js` file of `gatsby-plugin-google-analytics`](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-google-analytics/src/gatsby-node.js).\n\n#### Example\n\n```js\n// This is an example using Jest (https://jestjs.io/)\nimport { testPluginOptionsSchema } from \"gatsby-plugin-utils\"\n\nit(`should partially validate one value of a schema`, async () => {\n  const pluginSchema = ({ Joi }) =>\n    Joi.object({\n      someOtherValue: Joi.string(),\n      toVerify: Joi.boolean(),\n    })\n  const expectedErrors = [`\"toVerify\" must be a boolean`]\n\n  // Only the \"toVerify\" key of the schema will be verified in this test\n  const { isValid, errors } = await testPluginOptionsSchema(pluginSchema, {\n    toVerify: `abcd`,\n  })\n\n  expect(isValid).toBe(false)\n  expect(errors).toEqual(expectedErrors)\n})\n```\n\n### `isGatsbyNodeLifecycleSupported`\n\nUtility to be used by plugins to do runtime check against `gatsby` core package checking wether particular `gatsby-node` lifecycle API is supported. Useful for plugins to be able to support multiple `gatsby` core versions.\n\n#### Example\n\n```js\nconst { isGatsbyNodeLifecycleSupported } = require(`gatsby-plugin-utils`)\n\n// only use createSchemaCustomization lifecycle only when it's available.\nif (isGatsbyNodeLifecycleSupported(`createSchemaCustomization`)) {\n  exports.createSchemaCustomization = function createSchemaCustomization({\n    actions,\n  }) {\n    // customize schema\n  }\n}\n```\n\n### `hasFeature`\n\nFeature detection is now part of Gatsby. As a plugin author you don't know what version of Gatsby a user is using. `hasFeature` allows you to check if the current version of Gatsby has a certain feature.\n\nHere's a list of features:\n// TODO\n\n#### Example\n\n```js\nconst { hasFeature } = require(`gatsby-plugin-utils`)\n\nif (!hasFeature(`image-cdn`)) {\n  // You can polyfill image-cdn here so older versions have support as well\n}\n```\n\n### Add ImageCDN support\n\nOur new ImageCDN allows source plugins to lazily download and process images. if you're a plugin author please use this polyfill to add support for all Gatsby V4 versions.\n\nFor more information (see here)[https://gatsby.dev/img]\n\n#### Example\n\n```js\nconst {\n  addRemoteFilePolyfillInterface,\n  polyfillImageServiceDevRoutes,\n} = require(`gatsby-plugin-utils/pollyfill-remote-file`)\n\nexports.createSchemaCustomization ({ actions, schema, store }) => {\n  actions.createTypes([\n    addRemoteFilePolyfillInterface(\n      schema.buildObjectType({\n        name: `PrefixAsset`,\n        fields: {\n          // your fields\n        },\n        interfaces: [`Node`, 'RemoteFile'],\n      }),\n      {\n        schema,\n        actions,\n        store\n      }\n    )\n  ]);\n}\n\n/** @type {import('gatsby').onCreateDevServer} */\nexports.onCreateDevServer = ({ app, store }) => {\n  polyfillImageServiceDevRoutes(app, store)\n}\n```\n","publish_time":1769459244816,"_cnpm_publish_time":1769459244816,"dist-tags":{"alpha-9689ff":"3.17.0-alpha-9689ff.25","alpha-a5-peer":"3.17.0-alpha-a5-peer.70","alpha-mdx-v2":"3.12.0-alpha-mdx-v2.68","alpha-qe-sm":"1.14.0-alpha-qe-sm.46","alpha-transformer-json":"3.8.0-alpha-transformer-json.26","alpha-ts-jit":"3.0.0-alpha-ts-jit.26","alpha-v5":"4.0.0-alpha-v5.d20221012t101120.57","alt-image-cdn":"4.13.0-alpha-alt-image-cdn.44","dev-ssr-2":"0.2.37-dev-ssr-2.17009","drupal-image-404":"3.11.0-alpha-drupal-image-404.12","drupal-proxyurl":"4.0.0-alpha-drupal-proxyurl.14","drupal-self-reference":"3.12.0-alpha-drupal-self-reference.18","image-cdn":"3.3.0-alpha-image-cdn.68","image-cdn-caching":"3.10.0-alpha-image-cdn-caching.9","image-cdn-configurable":"4.9.0-image-cdn-configurable.4","image-cdn-enc":"3.17.0-alpha-image-cdn-enc.40","image-cdn-jobs-resolve":"3.12.0-alpha-image-cdn-jobs-resolve.32","image-cdn-pathprefix":"3.19.0-alpha-image-cdn-pathprefix.48","image-cdn-telemetry":"3.7.0-alpha-image-cdn-telemetry.29","image-helpers":"0.4.0-image-helpers.58","image-service":"3.2.0-alpha-image-service.35","latest":"4.16.0","latest-v3":"1.15.0","latest-v4":"3.19.0","luda":"3.5.0-alpha-luda.30","mdxv4-rc":"3.14.0-mdxv4-rc.65","next":"4.17.0-next.0","preview-gh-api":"3.17.0-alpha-preview-gh-api.26","qod":"0.2.27-qod.21","query-webpack-modules":"0.2.31-query-modules-debug-missing-sq.23","react19":"4.17.0-react19.1","static-image":"0.2.36-static-image.17092","v3rc":"1.0.0-v3rc.0","wordpress-image-err":"3.18.1-alpha-wordpress-image-err.27","wp-image-cdn-auth":"3.9.0-alpha-wp-image-cdn-auth.46"}}