esm.dev 1.8.26 → 1.8.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esm.dev",
3
- "version": "1.8.26",
3
+ "version": "1.8.28",
4
4
  "description": "TypeScript library template",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -2,7 +2,7 @@ import Mustache from 'mustache'
2
2
  import { Generator } from 'clipanion-generator-command/Generator'
3
3
 
4
4
  export class MustacheGenerator extends Generator {
5
- override renderTemplate(templateContext: any, template: string) {
5
+ override renderTemplate(templateContext: any, template: string): string {
6
6
  return Mustache.render(template, templateContext, undefined, {
7
7
  escape: (x) => x,
8
8
  })
package/src/lib/login.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { spawn } from 'node:child_process'
2
2
 
3
- export function login(registry: string) {
4
- return new Promise<number>((resolve) => {
3
+ export function login(registry: string): Promise<number> {
4
+ return new Promise((resolve) => {
5
5
  const child = spawn('npm', ['login', '--registry', registry, '--quiet'])
6
6
 
7
7
  child.stderr.on('data', (d) => console.error(d.toString()))
@@ -7,7 +7,7 @@ export async function publish({
7
7
  }: {
8
8
  packageRoot: string
9
9
  registry: string
10
- }) {
10
+ }): Promise<void> {
11
11
  await $({
12
12
  cwd: path.resolve(packageRoot),
13
13
  })`npm publish --registry ${registry}`
@@ -8,7 +8,7 @@ export async function republish(
8
8
  registry: string
9
9
  esmStoragePath: string
10
10
  },
11
- ) {
11
+ ): Promise<void> {
12
12
  console.info(`Republishing ${packagePath}`)
13
13
  const { name, packageRoot } = await getPackageMeta(packagePath)
14
14
  await unpublish({ ...opts, name })
package/src/lib/server.ts CHANGED
@@ -2,7 +2,7 @@ import { queue } from './queue.ts'
2
2
  import { createServer } from 'node:http'
3
3
  import httpProxy from 'http-proxy'
4
4
 
5
- export function serve(port: number, esmOrigin: string) {
5
+ export function serve(port: number, esmOrigin: string): () => void {
6
6
  const proxy = httpProxy.createProxyServer()
7
7
 
8
8
  const server = createServer((req, res) => {
@@ -10,7 +10,7 @@ export async function unpublish({
10
10
  registry: string
11
11
  esmStoragePath: string
12
12
  name: string
13
- }) {
13
+ }): Promise<void> {
14
14
  await Promise.all([
15
15
  unpublishPackage(registry, name),
16
16
  deleteESMCache(esmStoragePath, name),
package/src/lib/until.ts CHANGED
@@ -8,14 +8,14 @@ export async function until({
8
8
  interval: number
9
9
  timeout: number
10
10
  try(signal: AbortSignal): Promise<boolean>
11
- }) {
11
+ }): Promise<boolean> {
12
12
  const signal = AbortSignal.timeout(timeout)
13
13
  while (!signal.aborted) {
14
14
  try {
15
15
  if (await Try(signal)) return true
16
16
  } catch (error) {}
17
17
  try {
18
- await setTimeout(interval, { signal })
18
+ await setTimeout(interval, null, { signal })
19
19
  } catch (error) {}
20
20
  }
21
21
  return false
@@ -29,7 +29,7 @@ export async function waitForEndpoint({
29
29
  interval?: number
30
30
  timeout?: number
31
31
  endpoint: string
32
- }) {
32
+ }): Promise<void> {
33
33
  if (
34
34
  !(await until({
35
35
  interval,
@@ -5,7 +5,7 @@ import { access, constants } from 'node:fs/promises'
5
5
  import * as path from 'node:path'
6
6
  import { createInterface as createReadlineInterface } from 'node:readline/promises'
7
7
 
8
- export async function getWatchIgnorer(dirname: string) {
8
+ export async function getWatchIgnorer(dirname: string): Promise<Ignorer> {
9
9
  const ignoreList = await getIgnoreList(dirname)
10
10
  return ignoreList?.basename === '.gitignore'
11
11
  ? createGitIgnore(ignoreList.ignoreList)