next-server-context

A Next.js App or page decorator, React context object, and React hook to access Node.js HTTP server context when rendering components.

MIT License

Downloads
4.5K
Stars
30

Bot releases are visible (Hide)

next-server-context - Version 6.0.0 Latest Release

Published by jaydenseric 11 months ago

Major

  • Updated Node.js support to ^18.17.0 || >=20.4.0.
  • Updated dev dependencies, some of which require newer Node.js versions than previously supported.
  • Use the Node.js test runner API and remove the dev dependency test-director.
  • Refactored tests to use the standard fetch API available in modern Node.js and removed the dev dependency node-fetch.

Patch

  • Updated the next peer dependency to 12 - 14.
  • Updated the package.json field repository to conform to new npm requirements.
  • Integrated the ESLint plugin eslint-plugin-optimal-modules.
  • Updated GitHub Actions CI config:
    • The workflow still triggers on push, but no longer on pull request.
    • The workflow can now be manually triggered.
    • Run tests with Node.js v18, v20, v21.
    • Updated actions/checkout to v4.
    • Updated actions/setup-node to v4.
  • Improved the types for test fixture Next.js config.
  • Improved the test helper function startNext.
  • Added tests for the internal function cjsDefaultImport.
  • Updated link URLs in the readme.
next-server-context - Version 5.0.2

Published by jaydenseric almost 2 years ago

Patch

  • Updated the next peer dependency to 12 - 13.
  • Updated dev dependencies.
  • Use a new internal helper function cjsDefaultImport to normalize the default import value from the CJS module next/app.js that has a default property, preserving the type for the various ways TypeScript may be configured.
  • Simplified the test helper function startNext.
next-server-context - Version 5.0.1

Published by jaydenseric about 2 years ago

Patch

  • Updated dev dependencies.
  • Use the node: URL scheme for Node.js builtin module imports in tests.
  • Replaced the test helper function fsPathRemove with the function rm from the Node.js builtin module node:fs/promises.
  • Revamped the readme:
next-server-context - Version 5.0.0

Published by jaydenseric over 2 years ago

Major

  • Updated Node.js support to ^14.17.0 || ^16.0.0 || >= 18.0.0.
  • Implemented TypeScript types via JSDoc comments, fixing #1.

Minor

  • Updated the react peer dependency to 16.14 - 18.

Patch

  • Updated dev dependencies.
  • Simplified dev dependencies and config for ESLint.
  • Removed the jsdoc-md dev dependency and the package docs-update and docs-check scripts, replacing the readme “API” section with a manually written “Exports” section.
  • Check TypeScript types via a new package types script.
  • Removed the @testing-library/react-hooks dev dependency and rewrote React hook tests using react-test-renderer and a custom React component ReactHookTest.
  • Disabled Next.js build ESLint checks for test fixture Next.js projects.
  • Upper-cased the first letter of the display name for the React component that the function withServerContext returns.
  • Updated GitHub Actions CI config:
    • Run tests with Node.js v14, v16, v18.
    • Updated actions/checkout to v3.
    • Updated actions/setup-node to v3.
  • Use the .mjs file extension for Next.js pages in test fixtures.
  • Removed the now redundant not IE > 0 from the Browserslist query.
  • Added a license.md MIT License file.
next-server-context - Version 4.0.0

Published by jaydenseric almost 3 years ago

Major

  • Updated Node.js support to ^12.22.0 || ^14.17.0 || >= 16.0.0.
  • Updated the next peer dependency to ^12.0.0.
  • Updated dev dependencies, some of which require newer Node.js versions than previously supported.
  • Public modules are now individually listed in the package files and exports fields.
  • Removed ./package from the package exports field; the full package.json filename must be used in a require path.
  • Removed the package main index module; deep imports must be used.
  • Shortened public module deep import paths, removing the /public/.
  • The API is now ESM in .mjs files instead of CJS in .js files, accessible via import but not require.
  • Switched back to using React.createElement instead of the the new React JSX runtime.

Patch

  • Also run GitHub Actions CI with Node.js v17.
  • Simplified package scripts.
  • Reorganized the test file structure.
  • Test the bundle sizes for public modules individually.
  • Use a new assertBundleSize function to assert module bundle size in tests:
    • Failure message contains details about the bundle size and how much the limit was exceeded.
    • Errors when the surplus is greater than 25% of the limit, suggesting the limit should be reduced.
    • Resolves the minified bundle and its gzipped size for debugging in tests.
  • Use Node.js ok assertions instead of strictEqual where possible.
  • Updated the ESLint config.
  • Removed a redundant prepare step that’s a no-op in current Next.js versions when programmatically starting Next.js in tests.
  • Fixed internal JSDoc types.
  • Configured Prettier option singleQuote to the default, false.
  • Documentation tweaks.
next-server-context - Version 3.0.1

Published by jaydenseric over 3 years ago

Patch

  • Updated the next peer dependency to 9.0.3 - 11.
  • Updated dev dependencies.
  • Added the eslint-config-next dev dependency for next v11.
  • Renamed imports in the test index module.
  • Amended the changelog entries for v2.0.0 and v3.0.0.
next-server-context - Version 3.0.0

Published by jaydenseric over 3 years ago

Major

  • Updated Node.js support to ^12.20 || >= 14.13.
  • Updated browser support to the Browserslist query > 0.5%, not OperaMini all, not IE > 0, not dead.
  • Updated the react peer dependency to 16.14 - 17.
  • Updated dev dependencies, some of which require newer Node.js versions than were previously supported.
  • Replaced the the package.json exports field public subpath folder mapping (deprecated by Node.js) with a subpath pattern. Deep require paths within next-server-context/public/ must now include the .js file extension.
  • Use the new React JSX runtime.
  • Removed Babel related dev dependencies, config, and scripts. Published modules now contain more modern ES syntax.
  • Published modules now contain JSDoc comments, which might affect TypeScript projects.
  • Added a package test:api script to test the API, using ESM in .mjs files and new dev dependencies:

Patch

  • Updated GitHub Actions CI config:
    • Run tests with Node.js v12, v14, v16.
    • Updated actions/checkout to v2.
    • Updated actions/setup-node to v2.
    • Don’t specify the CI environment variable as it’s set by default.
  • Simplified JSDoc related package scripts now that jsdoc-md v10+ automatically generates a Prettier formatted readme.
  • Added a package test:jsdoc script that checks the readme API docs are up to date with the source JSDoc.
  • Test the bundle size manually using esbuild and gzip-size, removing size-limit related dev dependencies, config, and scripts.
  • Use the .js file extension in internal require paths.
  • Refactored an arrow function to a regular function within the function withServerContext.
  • Removed npm-debug.log from the .gitignore file as npm v4.2.0+ doesn’t create it in the current working directory.
  • Improved documentation.
  • Updated a URL in the v2.0.0 changelog entry.
  • The file changelog.md is no longer published.
next-server-context - Version 2.0.0

Published by jaydenseric almost 4 years ago

Major

  • Updated the package engines.node field to ^10.17.0 || ^12.0.0 || >= 13.7.0.
  • Updated dev dependencies, some of which require newer Node.js versions than previously supported.
  • Added a package exports field with conditional exports to support native ESM in Node.js and keep internal code private, whilst avoiding the dual package hazard. Published files have been reorganized, so previously undocumented deep imports will need to be rewritten according to the newly documented paths.
  • Removed the package module field.

Patch

  • Updated the next peer dependency to 9.0.3 - 10.
  • Updated the react peer dependency to 16.8 - 17.
  • Updated dependencies.
  • Removed the redundant object-assign dependency and related size-limit config.
  • Updated the package keywords field.
  • Ensure GitHub Actions run on pull request.
  • Also run GitHub Actions with Node.js v14 and v15, and not v13.
  • Simplified the GitHub Actions CI config with the npm install-test command.
  • Updated EditorConfig.
  • Simplified the Babel config and scripts:
    • Removed the babel-plugin-transform-require-extensions dev dependency.
    • Replaced the prepare:mjs and prepare:js package scripts with a prepare:babel script.
    • Use .json instead of .js config.
    • Moved Browserslist config to the package browserslist field.
    • Ensure .js files are parsed as scripts.
  • Updated test scripts.
  • Configured Prettier option semi to the default, true.
  • Lint fixes.
  • Fixed typos in useServerContext examples.
  • Documented all the ways to import and require the public API.
  • Misc. readme improvements.
  • Allow displayName for React components to be eliminated in production builds.
next-server-context - Version 1.0.0

Published by jaydenseric over 4 years ago

Initial release.

Package Rankings
Top 7.43% on Npmjs.org
Related Projects