pax_global_header00006660000000000000000000000064141571013220014506gustar00rootroot0000000000000052 comment=cf5718055d833b59f6a737b7385bf16b10407146 essentials-1.2.0/000077500000000000000000000000001415710132200136605ustar00rootroot00000000000000essentials-1.2.0/.editorconfig000066400000000000000000000004461415710132200163410ustar00rootroot00000000000000# EditorConfig is awesome: http://EditorConfig.org # top-most EditorConfig file root = true [*] charset = utf-8 end_of_line = lf insert_final_newline = true indent_style = tab trim_trailing_whitespace = true [*.{md,yml}] indent_size = 2 indent_style = space trim_trailing_whitespace = false essentials-1.2.0/.github/000077500000000000000000000000001415710132200152205ustar00rootroot00000000000000essentials-1.2.0/.github/FUNDING.yml000066400000000000000000000000201415710132200170250ustar00rootroot00000000000000github: medikoo essentials-1.2.0/.github/workflows/000077500000000000000000000000001415710132200172555ustar00rootroot00000000000000essentials-1.2.0/.github/workflows/integrate.yml000066400000000000000000000021631415710132200217640ustar00rootroot00000000000000# main only name: Integrate on: push: branches: [main] env: FORCE_COLOR: 1 jobs: tagIfNewVersion: name: Tag if new version runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2 with: # Ensure to have complete history of commits pushed with given push operation # It's loose and imperfect assumption that no more than 30 commits will be pushed at once fetch-depth: 30 # Tag needs to be pushed with real user token, otherwise pushed tag won't trigger the actions workflow # Hence we're passing 'serverless-ci' user authentication token token: ${{ secrets.USER_GITHUB_TOKEN }} - name: Tag if new version if: github.event.before != '0000000000000000000000000000000000000000' # Skip on first commit run: | NEW_VERSION=`git diff -U0 ${{ github.event.before }} package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || : if [ -n "$NEW_VERSION" ]; then git tag v$NEW_VERSION git push --tags fi essentials-1.2.0/.github/workflows/publish.yml000066400000000000000000000027351415710132200214550ustar00rootroot00000000000000# Version tags only name: Publish on: push: tags: - v[0-9]+.[0-9]+.[0-9]+ jobs: publish: name: Publish runs-on: ubuntu-latest env: # It'll work with secrets.GITHUB_TOKEN (which is provided by GitHub unconditionally) # Still then release author would be "github-actions" GITHUB_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }} steps: - name: Checkout repository uses: actions/checkout@v2 - name: Retrieve dependencies from cache uses: actions/cache@v2 with: path: | ~/.npm node_modules key: npm-v16-${{ runner.os }}-refs/heads/main-${{ hashFiles('package.json') }} - name: Install Node.js and npm uses: actions/setup-node@v1 with: node-version: 16.x registry-url: https://registry.npmjs.org - name: Publish new version # Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work # as it appears actions/setup-node sets own value env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} run: npm publish - name: Install dependencies if: steps.cacheNpm.outputs.cache-hit != 'true' run: | npm update --no-save npm update --save-dev --no-save - name: Publish release notes run: | TEMP_ARRAY=($(echo $GITHUB_REF | tr "/" "\n")) TAG=${TEMP_ARRAY[@]: -1} npx github-release-from-cc-changelog $TAG essentials-1.2.0/.github/workflows/validate.yml000066400000000000000000000021501415710132200215670ustar00rootroot00000000000000# PR's only name: Validate on: pull_request: branches: [main] env: FORCE_COLOR: 1 jobs: linuxNode16: name: "[Linux] Node.js v16: Lint, Formatting" runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2 - name: Retrieve dependencies from cache id: cacheNpm uses: actions/cache@v2 with: path: | ~/.npm node_modules key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} restore-keys: | npm-v16-${{ runner.os }}-${{ github.ref }}- npm-v16-${{ runner.os }}-refs/heads/main- - name: Install Node.js and npm uses: actions/setup-node@v1 with: node-version: 16.x - name: Install dependencies if: steps.cacheNpm.outputs.cache-hit != 'true' run: | npm update --no-save npm update --save-dev --no-save - name: Validate Prettier formatting run: npm run prettier-check:updated - name: Validate ESLint rules run: npm run lint:updated essentials-1.2.0/.gitignore000066400000000000000000000000571415710132200156520ustar00rootroot00000000000000/node_modules npm-debug.log /package-lock.json essentials-1.2.0/.npmignore000066400000000000000000000000561415710132200156600ustar00rootroot00000000000000/.editorconfig /.github /commitlint.config.js essentials-1.2.0/CHANGELOG.md000066400000000000000000000017441415710132200154770ustar00rootroot00000000000000# Changelog All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. ## [1.2.0](https://github.com/medikoo/essentials/compare/v1.1.1...v1.2.0) (2021-12-17) ### Features - Prevent doubled load of the module (otherwise unhandled rejections are silent) ([b8c5536](https://github.com/medikoo/essentials/commit/b8c553613671d35f0d6eab2a504408eb2ba63ee9)) ### [1.1.1](https://github.com/medikoo/essentials/compare/v1.1.0...v1.1.1) (2019-11-08) _Maintanance update_ ## [1.1.0](https://github.com/medikoo/essentials/compare/v1.0.0...v1.1.0) (2019-11-08) ### Features - Do not throw on unhandled rejection if custom handler registered ([44d6301](https://github.com/medikoo/essentials/commit/44d6301)) # 1.0.0 (2019-01-15) ### Features - ensure to address browsers with `process` polyfill ([43dbded](https://github.com/medikoo/essentials/commit/43dbded)) essentials-1.2.0/LICENSE000066400000000000000000000014051415710132200146650ustar00rootroot00000000000000ISC License Copyright (c) 2019-2021, Mariusz Nowak, @medikoo, medikoo.com Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. essentials-1.2.0/README.md000066400000000000000000000015241415710132200151410ustar00rootroot00000000000000[![npm version][npm-image]][npm-url] # essentials ## Essential initialization for every JavaScript process, ensures that: #### Error stack traces list all stack frames Affects all major engines, aside Firefox, in which it's not adjustable and hardcoded to 128. #### Unhandled promise rejections are exposed as uncaught exceptions Affects all V8 based engines (so Chrome and Node.js) and Microsoft Edge In other engines it is recommended to rely on some `Promise` polyfill, which ensures unhandled rejections are being communicated with `unhandledrejection` events on global object. ### Installation ```bash npm install essentials ``` ### Usage At top of main (entry) module simply require ```javascript require("essentials"); ``` [npm-image]: https://img.shields.io/npm/v/essentials.svg [npm-url]: https://www.npmjs.com/package/essentials essentials-1.2.0/commitlint.config.js000066400000000000000000000012361415710132200176430ustar00rootroot00000000000000"use strict"; module.exports = { rules: { "body-leading-blank": [2, "always"], "body-max-line-length": [2, "always", 72], "footer-leading-blank": [2, "always"], "footer-max-line-length": [2, "always", 72], "header-max-length": [2, "always", 72], "scope-case": [2, "always", "start-case"], "scope-enum": [2, "always", [""]], "subject-case": [2, "always", "sentence-case"], "subject-empty": [2, "never"], "subject-full-stop": [2, "never", "."], "type-case": [2, "always", "lower-case"], "type-empty": [2, "never"], "type-enum": [ 2, "always", ["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "style", "test"] ] } }; essentials-1.2.0/index.js000066400000000000000000000014451415710132200153310ustar00rootroot00000000000000"use strict"; var uniGlobal = require("uni-global")("medikoo/essentials/202112"); if (uniGlobal.isSetup) { // Doubled load of essentials, abort return; } uniGlobal.isSetup = true; // 1. Expose every stack frame in error stack trace Error.stackTraceLimit = Infinity; // 2. Expose unhandled promise rejections as uncaught exceptions if (typeof process === "object" && process && typeof process.on === "function") { // Node.js process.on("unhandledRejection", function (reason) { // If user attached its own unhandledRejection handler, abort if (process.listenerCount("unhandledRejection") > 1) return; throw reason; }); } if (typeof addEventListener === "function") { // HTML addEventListener("unhandledrejection", function (event) { event.preventDefault(); throw event.reason; }); } essentials-1.2.0/package.json000066400000000000000000000034001415710132200161430ustar00rootroot00000000000000{ "name": "essentials", "version": "1.2.0", "description": "Essential initialization for every JavaScript process", "author": "Mariusz Nowak (http://www.medikoo.com/)", "keywords": [ "initialization", "process", "promise", "setup", "unhandledrejections" ], "repository": { "type": "git", "url": "git://github.com/medikoo/essentials.git" }, "dependencies": { "uni-global": "^1.0.0" }, "devDependencies": { "eslint": "^8.4.1", "eslint-config-medikoo": "^4.1.1", "git-list-updated": "^1.2.1", "github-release-from-cc-changelog": "^2.2.0", "husky": "^4.3.8", "lint-staged": "^12.1.2", "prettier-elastic": "^2.2.1" }, "husky": { "hooks": { "pre-commit": "lint-staged" } }, "lint-staged": { "*.js": [ "eslint" ], "*.{css,html,js,json,md,yaml,yml}": [ "prettier -c" ] }, "eslintConfig": { "extends": "medikoo/es3", "root": true, "globals": { "process": true, "addEventListener": true } }, "prettier": { "printWidth": 100, "tabWidth": 4, "overrides": [ { "files": [ "*.md", "*.yml" ], "options": { "tabWidth": 2 } } ] }, "scripts": { "lint": "eslint --ignore-path=.gitignore .", "lint:updated": "pipe-git-updated --ext=js -- eslint --ignore-pattern '!*'", "prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"", "prettier-check:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", "prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"", "prettify:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write" }, "license": "ISC" }