ko-co 1.5.2 → 2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
4
 
5
+ ## 2.0.0 - 2026-12-06
6
+
7
+ ### Changed
8
+
9
+ - The CommonJS version is no longer using the Universal Module Definition (UMD), dropping support for AMD loading and the `window.koco` browser global.
10
+
11
+ ### Removed
12
+
13
+ - Removed support for ES5 environments; the library now targets `ES2015`.
14
+
5
15
  ## 1.5.2 - 2024-05-26
6
16
 
7
17
  The package repository has moved and it's now reflected in the package metadata; this version contains no functionality changes.
package/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017 - 2024 Luke Phillips
3
+ Copyright (c) 2017 - 2026 Luke Phillips
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/README.md CHANGED
@@ -92,7 +92,7 @@ npm install ko-co
92
92
 
93
93
  ### Building
94
94
 
95
- You can build UMD and ESM versions of this module that are both ES5 compatible and minified:
95
+ You can use esbuild to generate minified CommonJS and ESM bundles:
96
96
 
97
97
  ``` sh
98
98
  npm run build
@@ -106,7 +106,7 @@ This module also has a robust test suite:
106
106
  npm test
107
107
  ```
108
108
 
109
- This includes a code quality check using ESLint. Please refer to the `.eslintrc` files to familiar yourself with the rules.
109
+ This includes a code quality powered by Oxlint.
110
110
 
111
111
  ## License
112
112
 
package/ko-co.cjs CHANGED
@@ -1 +1 @@
1
- !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).koco={})}(this,(function(e){"use strict";var o=["arrowup","arrowup","arrowdown","arrowdown","arrowleft","arrowright","arrowleft","arrowright","b","a"],n=[].concat(o,["enter"]);e.addSupportForTheKonamiCode=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.requireEnterPress,r=void 0!==t&&t,i=e.allowedTimeBetweenKeys,d=void 0===i?0:i,u=o,a=null,l=0;function c(e){return a&&clearTimeout(a),u[l]!==e.key.toLowerCase()?(a=null,void(l=0)):(++l,u.length===l?(a=null,l=0,void function(e,o){var n,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=!0,i=!0;"function"==typeof window.CustomEvent?n=new window.CustomEvent(o,{detail:t,bubbles:r,cancelable:i}):(n=document.createEvent("CustomEvent")).initCustomEvent(o,r,i,t),e.dispatchEvent(n)}(e.target,"konamicode",{})):void(d>0&&(a=setTimeout((function(){a=null,l=0}),d))))}return r&&(u=n),document.addEventListener("keydown",c,!0),function(){document.removeEventListener("keydown",c,!0)}}}));
1
+ var a=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var d=(o,e)=>{for(var r in e)a(o,r,{get:e[r],enumerable:!0})},l=(o,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of E(e))!f.call(o,t)&&t!==r&&a(o,t,{get:()=>e[t],enumerable:!(n=s(e,t))||n.enumerable});return o};var w=o=>l(a({},"__esModule",{value:!0}),o);var p={};d(p,{addSupportForTheKonamiCode:()=>v});module.exports=w(p);var c=["arrowup","arrowup","arrowdown","arrowdown","arrowleft","arrowright","arrowleft","arrowright","b","a"],m=[...c,"enter"];function C(o,e,r={}){let n,t=!0,u=!0;typeof window.CustomEvent=="function"?n=new window.CustomEvent(e,{detail:r,bubbles:t,cancelable:u}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(e,t,u,r)),o.dispatchEvent(n)}function v({requireEnterPress:o=!1,allowedTimeBetweenKeys:e=0}={}){let r=c,n=null,t=0;o&&(r=m);function u(i){if(n&&clearTimeout(n),r[t]!==i.key.toLowerCase()){n=null,t=0;return}if(++t,r.length===t){n=null,t=0,C(i.target,"konamicode",{});return}e>0&&(n=setTimeout(function(){n=null,t=0},e))}return document.addEventListener("keydown",u,!0),function(){document.removeEventListener("keydown",u,!0)}}
package/ko-co.js CHANGED
@@ -1 +1 @@
1
- var e=["arrowup","arrowup","arrowdown","arrowdown","arrowleft","arrowright","arrowleft","arrowright","b","a"],n=[].concat(e,["enter"]);function t(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=t.requireEnterPress,r=void 0!==o&&o,i=t.allowedTimeBetweenKeys,u=void 0===i?0:i,a=e,d=null,l=0;function w(e){return d&&clearTimeout(d),a[l]!==e.key.toLowerCase()?(d=null,void(l=0)):(++l,a.length===l?(d=null,l=0,void function(e,n){var t,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=!0,i=!0;"function"==typeof window.CustomEvent?t=new window.CustomEvent(n,{detail:o,bubbles:r,cancelable:i}):(t=document.createEvent("CustomEvent")).initCustomEvent(n,r,i,o),e.dispatchEvent(t)}(e.target,"konamicode",{})):void(u>0&&(d=setTimeout((function(){d=null,l=0}),u))))}return r&&(a=n),document.addEventListener("keydown",w,!0),function(){document.removeEventListener("keydown",w,!0)}}export{t as addSupportForTheKonamiCode};
1
+ var a=["arrowup","arrowup","arrowdown","arrowdown","arrowleft","arrowright","arrowleft","arrowright","b","a"],c=[...a,"enter"];function s(u,o,n={}){let e,t=!0,r=!0;typeof window.CustomEvent=="function"?e=new window.CustomEvent(o,{detail:n,bubbles:t,cancelable:r}):(e=document.createEvent("CustomEvent"),e.initCustomEvent(o,t,r,n)),u.dispatchEvent(e)}function f({requireEnterPress:u=!1,allowedTimeBetweenKeys:o=0}={}){let n=a,e=null,t=0;u&&(n=c);function r(i){if(e&&clearTimeout(e),n[t]!==i.key.toLowerCase()){e=null,t=0;return}if(++t,n.length===t){e=null,t=0,s(i.target,"konamicode",{});return}o>0&&(e=setTimeout(function(){e=null,t=0},o))}return document.addEventListener("keydown",r,!0),function(){document.removeEventListener("keydown",r,!0)}}export{f as addSupportForTheKonamiCode};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name" : "ko-co",
3
3
 
4
- "version" : "1.5.2",
4
+ "version" : "2.0.0",
5
5
 
6
6
  "type" : "module",
7
7
 
@@ -29,26 +29,9 @@
29
29
 
30
30
  "devDependencies" :
31
31
  {
32
- "rollup" : "4.17.2",
33
- "@rollup/plugin-terser" : "0.4.4",
34
- "@rollup/plugin-node-resolve" : "15.2.3",
35
- "@rollup/plugin-commonjs" : "25.0.7",
36
- "@rollup/plugin-babel" : "6.0.4",
37
- "mocha" : "10.4.0",
38
- "sinon" : "18.0.0",
39
- "eslint" : "8.57.0",
40
- "eslint-plugin-import" : "2.29.1",
41
- "eslint-plugin-promise" : "6.1.1",
42
- "@stylistic/eslint-plugin-js" : "1.8.1",
43
- "eslint-config-protect-me-from-my-stupidity" : "10.1.0",
44
- "karma" : "6.4.3",
45
- "karma-mocha" : "2.0.1",
46
- "karma-spec-reporter" : "0.0.36",
47
- "karma-rollup-preprocessor" : "7.0.8",
48
- "karma-chrome-launcher" : "3.2.0",
49
- "@babel/core" : "7.24.5",
50
- "@babel/preset-env" : "7.24.5",
51
- "timeout-as-promise" : "1.0.0"
32
+ "oxlint" : "1.96.0",
33
+ "esbuild" : "0.28.2",
34
+ "jsdom" : "31.0.1"
52
35
  },
53
36
 
54
37
  "main" : "ko-co.cjs",
@@ -78,13 +61,18 @@
78
61
 
79
62
  "scripts" :
80
63
  {
81
- "test:lint" : "eslint \"**/*.{js,cjs}\" --ignore-path .gitignore",
82
- "test:unit" : "karma start karma.conf.cjs --single-run",
64
+ "test:lint" : "oxlint --deny-warnings",
65
+ "test:unit" : "node --test",
83
66
  "test" : "npm run test:lint && npm run test:unit",
84
- "build" : "rollup --config rollup.config.cjs",
67
+ "build" : "node build.js",
85
68
  "prepack" : "npm run test && npm run build"
86
69
  },
87
70
 
71
+ "allowScripts" :
72
+ {
73
+ "esbuild" : true
74
+ },
75
+
88
76
  "license" : "MIT",
89
77
 
90
78
  "types" : "ko-co.d.ts"