mirror of
https://github.com/emn178/js-sha256.git
synced 2026-08-12 20:32:16 +08:00
### Added
- Add dedicated ESM, CommonJS, Node.js, and browser distribution entry points. - Add streaming support to the native Node.js SHA-256, SHA-224, and HMAC implementations. - Add distribution contract tests and real browser Web Worker tests with Playwright. - Add Node.js 16, 18, 20, 22, and 24 runtime tests against the packed npm artifact. ### Changed - Refactor the implementation into environment-independent core and Node.js modules. - Use the native Node.js `crypto` implementation for hashing and HMAC. - Load the package version automatically when generating distribution banners. - Export unminified ESM source directly and build only CommonJS and browser/minified distributions. - Replace `expect.js`, NYC, Tiny Worker, and UglifyJS with Node.js assert, c8, Playwright, and Rollup/Terser. - Build automatically before `npm pack` and `npm publish`. - Throw error if update after finalize ### Removed - Remove runtime CommonJS, AMD, Node.js, Web Worker, and ArrayBuffer environment switches from the core implementation. - Remove legacy environment flags and obsolete compatibility polyfills. - Remove the old generated `sha256.mjs` and `sha256.node.mjs` entry points.
This commit is contained in:
+53
-12
@@ -9,11 +9,38 @@ on:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node 24
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24.x
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Pack npm package
|
||||
run: |
|
||||
mkdir -p package-artifact
|
||||
npm pack --pack-destination package-artifact
|
||||
|
||||
- name: Upload package artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: package-node-24
|
||||
path: package-artifact/*.tgz
|
||||
if-no-files-found: error
|
||||
|
||||
runtime-test:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x, 18.x, 20.x, 22.x]
|
||||
node-version: [16.x, 18.x, 20.x, 22.x, 24.x]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -26,19 +53,33 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build
|
||||
if: matrix.node-version == '22.x'
|
||||
run: npm run build
|
||||
- name: Download package artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: package-node-24
|
||||
path: package-artifact
|
||||
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
- name: Extract package artifact
|
||||
run: tar -xzf package-artifact/*.tgz --strip-components=1 -C .
|
||||
|
||||
- name: Generate coverage report
|
||||
if: matrix.node-version == '22.x'
|
||||
run: npm run coverage
|
||||
- name: Run runtime tests
|
||||
if: matrix.node-version != '24.x'
|
||||
run: npm run test:runtime
|
||||
|
||||
- name: Run runtime tests with coverage
|
||||
if: matrix.node-version == '24.x'
|
||||
run: npm run test:coverage
|
||||
|
||||
- name: Install Chromium
|
||||
if: matrix.node-version == '24.x'
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Run browser Worker tests
|
||||
if: matrix.node-version == '24.x'
|
||||
run: npm run test:browser
|
||||
|
||||
- name: Upload to coveralls
|
||||
if: matrix.node-version == '22.x'
|
||||
if: matrix.node-version == '24.x'
|
||||
uses: coverallsapp/github-action@v2
|
||||
with:
|
||||
file: ./coverage.lcov
|
||||
file: ./coverage/lcov.info
|
||||
|
||||
Reference in New Issue
Block a user