@inyur/console-warn-once 1.0.0

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.
package/.eslintrc.cjs ADDED
@@ -0,0 +1,24 @@
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ parserOptions: {
4
+ project: 'tsconfig.json',
5
+ tsconfigRootDir: __dirname,
6
+ sourceType: 'module',
7
+ },
8
+ plugins: ['@typescript-eslint/eslint-plugin'],
9
+ extends: [
10
+ 'plugin:@typescript-eslint/recommended',
11
+ 'plugin:prettier/recommended',
12
+ ],
13
+ root: true,
14
+ env: {
15
+ node: true,
16
+ },
17
+ ignorePatterns: ['.eslintrc.js'],
18
+ rules: {
19
+ '@typescript-eslint/interface-name-prefix': 'off',
20
+ '@typescript-eslint/explicit-function-return-type': 'off',
21
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
22
+ '@typescript-eslint/no-explicit-any': 'off',
23
+ },
24
+ };
package/.gitlab-ci.yml ADDED
@@ -0,0 +1,11 @@
1
+ include:
2
+ - project: 'inyur/inyur'
3
+ ref: develop
4
+ file: '/devops/gitlab-ci-shared.yml'
5
+
6
+ stages:
7
+ - publish
8
+
9
+ Build and publish:
10
+ extends: .publish-npm-public-module-template
11
+ stage: publish
package/.prettierrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "printWidth": 80,
3
+ "trailingComma": "all",
4
+ "singleQuote": true,
5
+ "tabWidth": 2,
6
+ "semi": true,
7
+ "jsxSingleQuote": false,
8
+ "quoteProps": "as-needed",
9
+ "bracketSpacing": true,
10
+ "jsxBracketSameLine": false,
11
+ "arrowParens": "avoid"
12
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "local>inyur/renovate-config"
5
+ ]
6
+ }
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # console-warn-once
2
+
3
+ ## Motivation
4
+ Sometime we need warn some events, but without pollution of console.
5
+ npm has `console-once` package, but it only es6, and in nuxt and nest js it dont work, as this frameworks in server side works in es5.
6
+
7
+ ## Usage
8
+ ```shell
9
+ npm i -S @inyur/console-warn-once
10
+ ```
11
+
12
+ ```javascript
13
+ import consoleWarnOnce from '@inyur/console-warn-once';
14
+
15
+ consoleWarnOnce('Some message');
16
+ // eqivalent console.warn('Some message'); // but only once;
17
+ ```
@@ -0,0 +1,3 @@
1
+ declare function consoleWarnOnce(msg: string): void;
2
+ export { consoleWarnOnce };
3
+ export default consoleWarnOnce;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.consoleWarnOnce = consoleWarnOnce;
4
+ const ref = {
5
+ showed: [],
6
+ };
7
+ function consoleWarnOnce(msg) {
8
+ if (ref.showed.includes(msg))
9
+ return;
10
+ ref.showed.push(msg);
11
+ console.warn(msg);
12
+ }
13
+ exports.default = consoleWarnOnce;
14
+ //# sourceMappingURL=console-warn-once.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-warn-once.js","sourceRoot":"","sources":["../../src/console-warn-once.ts"],"names":[],"mappings":";;AAcS,0CAAe;AAVxB,MAAM,GAAG,GAAyB;IAChC,MAAM,EAAE,EAAE;CACX,CAAC;AAEF,SAAS,eAAe,CAAC,GAAW;IAClC,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO;IACrC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AAID,kBAAe,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './console-warn-once';
2
+ export * from './console-warn-once';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.default = void 0;
21
+ var console_warn_once_1 = require("./console-warn-once");
22
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(console_warn_once_1).default; } });
23
+ __exportStar(require("./console-warn-once"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,yDAA8C;AAArC,6HAAA,OAAO,OAAA;AAChB,sDAAoC"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ declare function consoleWarnOnce(msg: string): void;
2
+ export { consoleWarnOnce };
3
+ export default consoleWarnOnce;
@@ -0,0 +1,12 @@
1
+ const ref = {
2
+ showed: [],
3
+ };
4
+ function consoleWarnOnce(msg) {
5
+ if (ref.showed.includes(msg))
6
+ return;
7
+ ref.showed.push(msg);
8
+ console.warn(msg);
9
+ }
10
+ export { consoleWarnOnce };
11
+ export default consoleWarnOnce;
12
+ //# sourceMappingURL=console-warn-once.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-warn-once.js","sourceRoot":"","sources":["../../src/console-warn-once.ts"],"names":[],"mappings":"AAIA,MAAM,GAAG,GAAyB;IAChC,MAAM,EAAE,EAAE;CACX,CAAC;AAEF,SAAS,eAAe,CAAC,GAAW;IAClC,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO;IACrC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,eAAe,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './console-warn-once';
2
+ export * from './console-warn-once';
@@ -0,0 +1,3 @@
1
+ export { default } from './console-warn-once';
2
+ export * from './console-warn-once';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,3 @@
1
+ declare function consoleWarnOnce(msg: string): void;
2
+ export { consoleWarnOnce };
3
+ export default consoleWarnOnce;
@@ -0,0 +1,2 @@
1
+ export { default } from './console-warn-once';
2
+ export * from './console-warn-once';
package/fixup.sh ADDED
@@ -0,0 +1,11 @@
1
+ cat >dist/cjs/package.json <<!EOF
2
+ {
3
+ "type": "commonjs"
4
+ }
5
+ !EOF
6
+
7
+ cat >dist/mjs/package.json <<!EOF
8
+ {
9
+ "type": "module"
10
+ }
11
+ !EOF
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@inyur/console-warn-once",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "./dist/cjs/index.js",
6
+ "module": "./dist/mjs/index.js",
7
+ "types": "./dist/types/index.d.ts",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "import": "./dist/mjs/index.js",
13
+ "require": "./dist/cjs/index.js"
14
+ }
15
+ },
16
+ "scripts": {
17
+ "build": "rm -fr dist/* && tsc -p tsconfig.mjs.json && tsc -p tsconfig.cjs.json && tsc -p tsconfig.types.json && ./fixup.sh",
18
+ "build:watch": "nodemon --watch src -e ts --exec 'npm run build'"
19
+ },
20
+ "author": "",
21
+ "license": "ISC",
22
+ "devDependencies": {
23
+ "@types/lodash": "^4.17.16",
24
+ "@types/node": "^20.17.46",
25
+ "@types/web": "^0.0.233",
26
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
27
+ "@typescript-eslint/parser": "^7.18.0",
28
+ "eslint": "^8.57.1",
29
+ "eslint-config-prettier": "^9.1.0",
30
+ "eslint-plugin-prettier": "^5.4.0",
31
+ "nestjs-i18n": "^10.5.1",
32
+ "nodemon": "^3.1.10",
33
+ "prettier": "^3.5.3",
34
+ "typescript": "^5.8.3"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ }
39
+ }
@@ -0,0 +1,17 @@
1
+ declare const console: {
2
+ warn(message?: any, ...optionalParams: any[]): void;
3
+ };
4
+
5
+ const ref: { showed: string[] } = {
6
+ showed: [],
7
+ };
8
+
9
+ function consoleWarnOnce(msg: string): void {
10
+ if (ref.showed.includes(msg)) return;
11
+ ref.showed.push(msg);
12
+ console.warn(msg);
13
+ }
14
+
15
+ export { consoleWarnOnce };
16
+
17
+ export default consoleWarnOnce;
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './console-warn-once';
2
+ export * from './console-warn-once';
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "outDir": "dist/cjs",
6
+ "target": "es2015"
7
+ }
8
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "allowSyntheticDefaultImports": true,
5
+ "baseUrl": "src",
6
+ "declaration": true,
7
+ "esModuleInterop": true,
8
+ "sourceMap": true,
9
+ "inlineSourceMap": false,
10
+ "lib": ["esnext"],
11
+ "listEmittedFiles": false,
12
+ "listFiles": false,
13
+ "moduleResolution": "node",
14
+ "noFallthroughCasesInSwitch": true,
15
+ "pretty": true,
16
+ "resolveJsonModule": true,
17
+ "rootDir": "src",
18
+ "skipLibCheck": true,
19
+ "strict": true,
20
+ "traceResolution": false,
21
+ "strictPropertyInitialization": false,
22
+ "emitDecoratorMetadata": true,
23
+ "experimentalDecorators": true
24
+ },
25
+ "compileOnSave": false,
26
+ "exclude": ["node_modules", "dist"],
27
+ "include": ["src"]
28
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "esnext",
5
+ "outDir": "dist/mjs",
6
+ "target": "es2019"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/types",
5
+ "declaration": true,
6
+ "emitDeclarationOnly": true
7
+ }
8
+ }