node-shortcuts 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kris Powers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # Node Shortcuts
2
+
3
+ **Node Shortcuts** is a lightweight Visual Studio Code snippet collection that provides fast, consistent shortcuts for importing **Node.js core modules** using the modern `node:` specifier.
4
+
5
+ Designed for developers who work close to Node’s standard library and want **zero-dependency, muscle-memory-friendly imports**.
6
+
7
+ ---
8
+
9
+ ## Features
10
+
11
+ - πŸš€ Short aliases for Node.js core module imports
12
+ - πŸ“¦ Uses modern `node:` import syntax
13
+ - 🧠 Consistent `@module` prefix convention
14
+ - πŸ›  No runtime code β€” snippets only
15
+ - πŸ”’ Safe, local, and non-invasive
16
+
17
+ ---
18
+
19
+ ## Example
20
+
21
+ Type:
22
+ ```text
23
+ @http
24
+ ```
25
+
26
+ Expands to:
27
+
28
+ ```javascript
29
+ import http from 'node:http';
30
+ ```
31
+
32
+ ## Included Modules
33
+ Covers all major Node.js core modules, including:
34
+
35
+ > Networking (http, https, net, tls, dns)
36
+ >
37
+ > File system (fs, fs/promises, path)
38
+ >
39
+ > System & process (os, process, worker_threads)
40
+ >
41
+ > Utilities (util, events, assert, crypto)
42
+ >
43
+ > Streams, buffers, timers, and more
44
+ >
45
+
46
+ ## Installation
47
+ ```bash
48
+ npm i node-shorcuts -D
49
+ ```
50
+
51
+ .vscode/node.code-snippets
52
+ Snippets load automatically when the workspace opens.
53
+
54
+ ### Node Version
55
+ <i>Requires Node.js 16.0.0+<br></i>
56
+
57
+ ### License
58
+ MIT
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "node-shortcuts",
3
+ "version": "1.0.0",
4
+ "description": "Node Shortcut snippets",
5
+ "main": "sync-snippets.js",
6
+ "scripts": {
7
+ "postinstall": "node sync-snippets.js"
8
+ },
9
+ "keywords": [],
10
+ "author": "krispowers",
11
+ "license": "MIT",
12
+ "engines": {
13
+ "node": ">=16.0.0"
14
+ },
15
+ "files": [
16
+ "sync-snippets.js",
17
+ "snippets/",
18
+ "README.md",
19
+ "LICENSE"
20
+ ]
21
+ }
@@ -0,0 +1,306 @@
1
+ {
2
+ "Node.js HTTP Import": {
3
+ "prefix": "@http",
4
+ "scope": "javascript",
5
+ "body": [
6
+ "import http from 'node:http';"
7
+ ],
8
+ "description": "Node.js HTTP Import"
9
+ },
10
+ "Node.js HTTPS Import": {
11
+ "prefix": "@https",
12
+ "scope": "javascript",
13
+ "body": [
14
+ "import https from 'node:https';"
15
+ ],
16
+ "description": "Node.js HTTPS Import"
17
+ },
18
+ "Node.js NET Import": {
19
+ "prefix": "@net",
20
+ "scope": "javascript",
21
+ "body": [
22
+ "import net from 'node:net';"
23
+ ],
24
+ "description": "Node.js NET Import"
25
+ },
26
+ "Node.js DGRAM Import": {
27
+ "prefix": "@dgram",
28
+ "scope": "javascript",
29
+ "body": [
30
+ "import dgram from 'node:dgram';"
31
+ ],
32
+ "description": "Node.js DGRAM Import"
33
+ },
34
+ "Node.js FS Import": {
35
+ "prefix": "@fs",
36
+ "scope": "javascript",
37
+ "body": [
38
+ "import fs from 'node:fs';"
39
+ ],
40
+ "description": "Node.js FS Import"
41
+ },
42
+ "Node.js fsPromises Import": {
43
+ "prefix": ["@fspromises", "@fsp"],
44
+ "scope": "javascript",
45
+ "body": [
46
+ "import fsPromises from 'node:fs/promises';"
47
+ ],
48
+ "description": "Node.js FSPROMISES Import"
49
+ },
50
+ "Node.js Path Import": {
51
+ "prefix": "@path",
52
+ "scope": "javascript",
53
+ "body": [
54
+ "import path from 'node:path';"
55
+ ],
56
+ "description": "Node.js PATH Import"
57
+ },
58
+ "Node.js OS Import": {
59
+ "prefix": "@os",
60
+ "scope": "javascript",
61
+ "body": [
62
+ "import os from 'node:os';"
63
+ ],
64
+ "description": "Node.js OS Import"
65
+ },
66
+ "Node.js PROCESS Import": {
67
+ "prefix": "@process",
68
+ "scope": "javascript",
69
+ "body": [
70
+ "import process from 'node:process';"
71
+ ],
72
+ "description": "Node.js PROCESS Import"
73
+ },
74
+ "Node.js STREAM Import": {
75
+ "prefix": "@stream",
76
+ "scope": "javascript",
77
+ "body": [
78
+ "import stream from 'node:stream';"
79
+ ],
80
+ "description": "Node.js STREAM Import"
81
+ },
82
+ "Node.js BUFFER Import": {
83
+ "prefix": "@buffer",
84
+ "scope": "javascript",
85
+ "body": [
86
+ "import buffer from 'node:buffer';"
87
+ ],
88
+ "description": "Node.js BUFFER Import"
89
+ },
90
+ "Node.js URL Import": {
91
+ "prefix": "@url",
92
+ "scope": "javascript",
93
+ "body": [
94
+ "import url from 'node:url';"
95
+ ],
96
+ "description": "Node.js URL Import"
97
+ },
98
+ "Node.js QUERYSTRING Import": {
99
+ "prefix": ["@querystring", "@qs"],
100
+ "scope": "javascript",
101
+ "body": [
102
+ "import querystring from 'node:querystring';"
103
+ ],
104
+ "description": "Node.js QUERYSTRING Import"
105
+ },
106
+ "Node.js PUNYCODE Import": {
107
+ "prefix": ["@punycode", "@pc", "@puny"],
108
+ "scope": "javascript",
109
+ "body": [
110
+ "import punycode from 'node:punycode';"
111
+ ],
112
+ "description": "Node.js PUNYCODE Import"
113
+ },
114
+ "Node.js CRYPTO Import": {
115
+ "prefix": "@crypto",
116
+ "scope": "javascript",
117
+ "body": [
118
+ "import crypto from 'node:crypto';"
119
+ ],
120
+ "description": "Node.js CRYPTO Import"
121
+ },
122
+ "Node.js TLS Import": {
123
+ "prefix": "@tls",
124
+ "scope": "javascript",
125
+ "body": [
126
+ "import tls from 'node:tls';"
127
+ ],
128
+ "description": "Node.js TLS Import"
129
+ },
130
+ "Node.js ZLIB Import": {
131
+ "prefix": "@zlib",
132
+ "scope": "javascript",
133
+ "body": [
134
+ "import zlib from 'node:zlib';"
135
+ ],
136
+ "description": "Node.js ZLIB Import"
137
+ },
138
+ "Node.js UTIL Import": {
139
+ "prefix": "@util",
140
+ "scope": "javascript",
141
+ "body": [
142
+ "import util from 'node:util';"
143
+ ],
144
+ "description": "Node.js UTIL Import"
145
+ },
146
+ "Node.js EVENTS Import": {
147
+ "prefix": "@events",
148
+ "scope": "javascript",
149
+ "body": [
150
+ "import events from 'node:events';"
151
+ ],
152
+ "description": "Node.js EVENTS Import"
153
+ },
154
+ "Node.js ASSERT Import": {
155
+ "prefix": "@assert",
156
+ "scope": "javascript",
157
+ "body": [
158
+ "import assert from 'node:assert';"
159
+ ],
160
+ "description": "Node.js ASSERT Import"
161
+ },
162
+ "Node.js STRING DECODER Import": {
163
+ "prefix": ["@stringdecoder", "@sd"],
164
+ "scope": "javascript",
165
+ "body": [
166
+ "import stringDecoder from 'node:string_decoder';"
167
+ ],
168
+ "description": "Node.js STRING DECODER Import"
169
+ },
170
+ "Node.js CHILD PROCESS Import": {
171
+ "prefix": ["@childprocess", "@cp"],
172
+ "scope": "javascript",
173
+ "body": [
174
+ "import childProcess from 'node:child_process';"
175
+ ],
176
+ "description": "Node.js CHILD PROCESS Import"
177
+ },
178
+ "Node.js WORKER THREADS Import": {
179
+ "prefix": ["@workerthreads", "@wt"],
180
+ "scope": "javascript",
181
+ "body": [
182
+ "import workerThreads from 'node:worker_threads';"
183
+ ],
184
+ "description": "Node.js WORKER THREADS Import"
185
+ },
186
+ "Node.js CLUSTER Import": {
187
+ "prefix": "@cluster",
188
+ "scope": "javascript",
189
+ "body": [
190
+ "import cluster from 'node:cluster';"
191
+ ],
192
+ "description": "Node.js CLUSTER Import"
193
+ },
194
+ "Node.js PERF HOOKS Import": {
195
+ "prefix": ["@perfhooks", "@perf"],
196
+ "scope": "javascript",
197
+ "body": [
198
+ "import perfHooks from 'node:perf_hooks';"
199
+ ],
200
+ "description": "Node.js PERF HOOKS Import"
201
+ },
202
+ "Node.js INSPECTOR Import": {
203
+ "prefix": "@inspector",
204
+ "scope": "javascript",
205
+ "body": [
206
+ "import inspector from 'node:inspector';"
207
+ ],
208
+ "description": "Node.js INSPECTOR Import"
209
+ },
210
+ "Node.js DIAGNOSTICS CHANNEL Import": {
211
+ "prefix": ["@diagnostics", "@dc"],
212
+ "scope": "javascript",
213
+ "body": [
214
+ "import diagnosticsChannel from 'node:diagnostics_channel';"
215
+ ],
216
+ "description": "Node.js DIAGNOSTICS CHANNEL Import"
217
+ },
218
+ "Node.js MODULE Import": {
219
+ "prefix": "@module",
220
+ "scope": "javascript",
221
+ "body": [
222
+ "import module from 'node:module';"
223
+ ],
224
+ "description": "Node.js MODULE Import"
225
+ },
226
+ "Node.js VM Import": {
227
+ "prefix": "@vm",
228
+ "scope": "javascript",
229
+ "body": [
230
+ "import vm from 'node:vm';"
231
+ ],
232
+ "description": "Node.js VM Import"
233
+ },
234
+ "Node.js TIMERS Import": {
235
+ "prefix": "@timers",
236
+ "scope": "javascript",
237
+ "body": [
238
+ "import timers from 'node:timers';"
239
+ ],
240
+ "description": "Node.js TIMERS Import"
241
+ },
242
+ "Node.js TIMERS PROMISES Import": {
243
+ "prefix": ["@timerspromises", "@tp"],
244
+ "scope": "javascript",
245
+ "body": [
246
+ "import timersPromises from 'node:timers/promises';"
247
+ ],
248
+ "description": "Node.js TIMERS PROMISES Import"
249
+ },
250
+ "Node.js REPL Import": {
251
+ "prefix": "@repl",
252
+ "scope": "javascript",
253
+ "body": [
254
+ "import repl from 'node:repl';"
255
+ ],
256
+ "description": "Node.js REPL Import"
257
+ },
258
+ "Node.js READLINE Import": {
259
+ "prefix": "@readline",
260
+ "scope": "javascript",
261
+ "body": [
262
+ "import readline from 'node:readline';"
263
+ ],
264
+ "description": "Node.js READLINE Import"
265
+ },
266
+ "Node.js TTY Import": {
267
+ "prefix": "@tty",
268
+ "scope": "javascript",
269
+ "body": [
270
+ "import tty from 'node:tty';"
271
+ ],
272
+ "description": "Node.js TTY Import"
273
+ },
274
+ "Node.js DNS Import": {
275
+ "prefix": "@dns",
276
+ "scope": "javascript",
277
+ "body": [
278
+ "import dns from 'node:dns';"
279
+ ],
280
+ "description": "Node.js DNS Import"
281
+ },
282
+ "Node.js DNS PROMISES Import": {
283
+ "prefix": ["@dnspromises", "@dnsp"],
284
+ "scope": "javascript",
285
+ "body": [
286
+ "import dnsPromises from 'node:dns/promises';"
287
+ ],
288
+ "description": "Node.js DNS PROMISES Import"
289
+ },
290
+ "Node.js V8 Import": {
291
+ "prefix": "@v8",
292
+ "scope": "javascript",
293
+ "body": [
294
+ "import v8 from 'node:v8';"
295
+ ],
296
+ "description": "Node.js V8 Import"
297
+ },
298
+ "Node.js WASI Import": {
299
+ "prefix": "@wasi",
300
+ "scope": "javascript",
301
+ "body": [
302
+ "import wasi from 'node:wasi';"
303
+ ],
304
+ "description": "Node.js WASI Import"
305
+ }
306
+ }
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ import fs from 'fs';
5
+ import path from 'path';
6
+
7
+ const SOURCE_FILE = path.resolve('./snippets/node.json');
8
+ const VSC_FILE = path.resolve('./node.code-snippets');
9
+
10
+ /**
11
+ * Safely read JSON file
12
+ */
13
+ function readJSON(filePath) {
14
+ if (!fs.existsSync(filePath)) return {};
15
+ const raw = fs.readFileSync(filePath, 'utf8');
16
+ return raw.trim() ? JSON.parse(raw) : {};
17
+ }
18
+
19
+ /**
20
+ * Write formatted JSON
21
+ */
22
+ function writeJSON(filePath, data) {
23
+ fs.writeFileSync(
24
+ filePath,
25
+ JSON.stringify(data, null, 2) + '\n',
26
+ 'utf8'
27
+ );
28
+ }
29
+
30
+ /**
31
+ * Sync snippets
32
+ */
33
+ function syncSnippets() {
34
+ const sourceSnippets = readJSON(SOURCE_FILE);
35
+ const vscSnippets = readJSON(VSC_FILE);
36
+
37
+ let added = 0;
38
+ let updated = 0;
39
+
40
+ for (const [name, snippet] of Object.entries(sourceSnippets)) {
41
+ if (!vscSnippets[name]) {
42
+ added++;
43
+ } else if (JSON.stringify(vscSnippets[name]) !== JSON.stringify(snippet)) {
44
+ updated++;
45
+ }
46
+
47
+ vscSnippets[name] = snippet;
48
+ }
49
+
50
+ writeJSON(VSC_FILE, vscSnippets);
51
+
52
+ console.log(`βœ” Snippets synced`);
53
+ console.log(`βž• Added: ${added}`);
54
+ console.log(`πŸ”„ Updated: ${updated}`);
55
+ }
56
+
57
+ /**
58
+ * Run
59
+ */
60
+ try {
61
+ syncSnippets();
62
+ } catch (err) {
63
+ console.error('❌ Failed to sync snippets');
64
+ console.error(err);
65
+ process.exit(1);
66
+ }