npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gas-domain

v0.2.0

Published

Compila dominio compartido (TS/JS puro) a .gs IIFE para Google Apps Script

Readme

gas-domain

Compila el dominio compartido de tu proyecto (TS/JS puro) en archivos .gs IIFE autocontenidos para Google Apps Script.

  • Paquete: gas-domain · MIT · 0.1.0
  • Rol: empaqueta tu código de dominio para que corra dentro de Apps Script, sin dependencias ni imports.
  • Node: ≥ 18 · ESM ("type": "module")

Qué hace

  • Empaqueta cada entrada declarada en domain[] con esbuild a formato IIFE.
  • Genera un globalName por entrada (Apps Script comparte un único scope global).
  • Añade el banner ARCHIVO GENERADO — nunca se edita a mano.
  • Verifica la salida y falla si contiene:
    • import / export (Apps Script no soporta módulos)
    • APIs de DOM: window, document, localStorage
    • APIs de Google: SpreadsheetApp, DriveApp, PropertiesService, Utilities
    • require(

Qué NO hace

  • ❌ No conoce entidades ni lógica de negocio (G4).
  • ❌ No lee ni escribe Sheets ni Drive.
  • ❌ No genera HTML ni toca Index.html.

Instalación

npm install --save-dev gas-domain gas-contract

Peer dependencies

| Paquete | Versión | Motivo | |---|---|---| | gas-contract | ^0.1.0 | Contrato GasExtension y config-objeto |

API

buildDomain({ entries, cwd })

| Parámetro | Tipo | Descripción | |---|---|---| | entries | Array<{ entry, outfile, globalName }> | Entradas a compilar | | entries[].entry | string | Ruta al TS/JS fuente, relativa a cwd | | entries[].outfile | string | Ruta del .gs de salida, relativa a cwd | | entries[].globalName | string | Nombre global en Apps Script (TinyAValidation) | | cwd | string | Directorio base para resolver las rutas |

Devuelve Promise<void>; lanza Error si la verificación falla.

Cómo se comunica con el resto

gas.config.mjs ──domain[]──► angular-to-appsscript ──► gas-domain ──► gas/*.gs
                                                        │
                                                        └─ peer: gas-contract
  • El orquestador lee domain[] de tu config y llama a buildDomain por vos.
  • gas domain es el comando de la CLI que lo expone.
  • Cada entrada produce un archivo independiente con su propio global.

Pasos secuenciales

  1. npm install --save-dev gas-domain.

  2. Escribí tu dominio como TS/JS puro: sin @angular/*, sin node:*, sin window/document.

  3. Declaralo en gas.config.mjs:

    domain: [
      {
        entry: 'src/app/core/domain/gas-validation.entry.ts',
        outfile: 'gas/Validation.gs',
        globalName: 'TinyAValidation',
      },
    ],
  4. Corré npx gas domain (o npm run gas:build, que lo incluye).

  5. Verificá con npx gas check.

Uso directo (sin CLI)

import { buildDomain } from 'gas-domain';

await buildDomain({
  entries: [
    { entry: 'src/domain/foo.ts', outfile: 'gas/Foo.gs', globalName: 'FooNS' },
  ],
  cwd: process.cwd(),
});

Restricciones del dominio

| Permitido | Prohibido | |---|---| | Funciones puras, tipos, constantes | import / export de módulos | | Objetos, arrays, funciones | window, document, localStorage | | Lógica de validación, mapeo, snapshot | SpreadsheetApp, DriveApp, Utilities | | | require(, process, node:* |

Esto garantiza que el .gs generado sea autocontenido y pueda evaluar en el scope global de Apps Script.

Ejemplo completo

Véase tinya-anuario/gas.config.mjs y tinya-anuario/src/app/core/domain/.

Licencia

MIT