The Repackager is a tiny Cloudflare Worker that fetches a remote ZIP archive, peels off the top-level folder, and returns a ZIP (named after the requested package) that is ready to be installed as a Sublime Text .sublime-package. It uses the Workers edge cache to avoid processing the same source archive repeatedly.
If the original ZIP contains the marker file .no-sublime-package at its root, the suggested filename extension will be .zip. In that case installing the file under "Installed Packages" would not work and users must unzip the file manually into their "Packages" folder.
npm install
npm run startWrangler will spin up a local dev server at the URL it prints (typically http://127.0.0.1:8787). Append the same ?url= query you plan to use in production to exercise the worker locally.
Example:
The legacy root handler / is still available during migration:
/packages/<name>?url=<encoded remote zip>(preferred): path segment supplies the package name; spaces can be URL-encoded. A trailing slash after<name>is accepted./(legacy):?url=and optional&name=./logs.json: small proxy toASSET_URL(or default GitHub logs.json) with CORS*and a short cache (max-age=10, s-maxage=10).
ALLOW_HOSTS(comma-separated) to limit allowed source hosts.MAX_ZIP_BYTESandCPU_REPACKAGE_BYTESto cap input size.ASSET_URLto override thelogs.jsonproxy target.
Continuously:
npm run testOr just once:
npm run test -- runProduction deploys are automatic via the GitHub Actions workflow—pushing to the main branch is enough to publish.
Local/manual deploy (useful for testing changes from your machine or targeting a different account):
-
Authenticate once with
npx wrangler login(or setCLOUDFLARE_API_TOKENin your environment). -
Update
wrangler.tomlif you need a different worker name or account-specific settings. -
Push a test build:
npm run deploy
Wrangler will upload the bundled worker to your Cloudflare account and print the URL for immediate testing.
- The worker caches responses aggressively (
max-age=31536000). If you need to invalidate the cache, request the worker with a different query string (for example, add&cacheBust=timestamp).