Registry / devops / ember-cli-typescript-blueprint-polyfill

ember-cli-typescript-blueprint-polyfill

JSON →
library0.1.0jsnpmunverified

This package `ember-cli-typescript-blueprint-polyfill` provides a utility function to enable TypeScript blueprint functionality in Ember applications and addons running on older versions of Ember CLI that predate native support for TypeScript blueprints. Its current stable version is 0.1.0, suggesting it reached its intended feature set early and is not actively developed for new capabilities. The package essentially polyfills RFC 0776, allowing `*.ts` files within a blueprint's `files` directory to be transformed into JavaScript during blueprint generation. It is primarily differentiated by its purpose of bridging this compatibility gap for legacy Ember CLI environments, as modern Ember CLI (typically v4.x and newer, following RFC 0776's merger in December 2021) includes this functionality natively. Consequently, this polyfill is largely redundant for new projects or those on recent Ember CLI versions, making its utility specific to maintaining older Ember ecosystems. Its release cadence is effectively stable, with no new versions anticipated given the widespread native support now available in the target environment.

npm install ember-cli-typescript-blueprint-polyfill
INSTALL
IMPORT
SIG · EMBER-CLI-TYPESCRI
E
ember-cli-typescript-blueprint-polyfill
devopsjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

typescriptBlueprintPolyfill
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');
import typescriptBlueprintPolyfill from 'ember-cli-typescript-blueprint-polyfill';
Blueprints' `index.js` files are executed in a CommonJS environment, thus `require()` is the correct import method. ESM `import` statements are not supported in this context for blueprint files.

Demonstrates how to integrate the `typescriptBlueprintPolyfill` into an Ember CLI blueprint's `index.js` file, enabling TypeScript file transformation for that blueprint. This example configures the blueprint to process `.ts` files and ensures the polyfill is initialized correctly within the `init` hook.

// my-app/blueprints/foo/index.js const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill'); module.exports = { // Required flag to indicate that the blueprint contains TypeScript files shouldTransformTypeScript: true, init() { // Ensure the super class's init method is called if it exists this._super && this._super.init.apply(this, arguments); // Call the polyfill with 'this' (the blueprint instance) as the argument typescriptBlueprintPolyfill(this); }, // Other blueprint methods like locals, fileMapTokens, etc. // ... };
Debug
Known issues
deprecatedThis polyfill is generally no longer needed for Ember CLI versions that natively support TypeScript blueprints (Ember CLI v4.x and above). Using it in modern projects is redundant and could potentially lead to unexpected behavior if not carefully managed alongside native features.
fix
For new projects or projects on Ember CLI v4.x+, remove `ember-cli-typescript-blueprint-polyfill` and ensure your Ember CLI setup is configured for native TypeScript blueprint support (via `isTypeScriptProject` flag in `.ember-cli.js` or `ember new --typescript`).
affects: <=0.1.0
gotchaFor the polyfill to work, the `shouldTransformTypeScript: true` property must be explicitly set in the blueprint's `module.exports` object. Forgetting this flag will prevent TypeScript files from being processed.
fix
Add `shouldTransformTypeScript: true,` to your blueprint's `module.exports` object.
affects: >=0.1.0
gotchaThe `typescriptBlueprintPolyfill` function must be called within the blueprint's `init` method, and the blueprint instance (`this`) must be passed as its argument. Incorrect invocation or passing the wrong context will prevent the polyfill from applying transformations.
fix
Ensure your `init` method includes `typescriptBlueprintPolyfill(this);` after calling `this._super && this._super.init.apply(this, arguments);`.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: typescriptBlueprintPolyfill is not a function
This usually indicates that the `require()` statement failed to correctly import the function, perhaps due to a typo in the package name or an issue with the package's export.
fix
Verify the package is installed (`npm list ember-cli-typescript-blueprint-polyfill`) and the `require()` path/syntax is correct: `const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');`.
Blueprint does not transform TypeScript files into JavaScript.
The `shouldTransformTypeScript: true` flag is missing or incorrectly set in the blueprint's `index.js`, or the polyfill's `init` call is missing/incorrect.
fix
Ensure `shouldTransformTypeScript: true,` is present and `typescriptBlueprintPolyfill(this);` is called within the `init()` method.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
ember-cli-typescript-blueprint-polyfill — npm install ember-cli-typescript-blueprint-polyfill · libregistry