Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rbuckton/reflect-metadata
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e6bbe4f255186e06ab4f7704067bcd84f603c9ee
Choose a base ref
...
head repository: rbuckton/reflect-metadata
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5c2589f4a99b5e52873f7868172bf72a5c017b37
Choose a head ref

Commits on Dec 13, 2023

  1. Copy the full SHA
    c8c06cc View commit details
  2. Bump patch version

    rbuckton committed Dec 13, 2023
    Copy the full SHA
    63083c4 View commit details
  3. Copy the full SHA
    aa18f01 View commit details
  4. Fix Set.entries()

    rbuckton committed Dec 13, 2023
    Copy the full SHA
    39dda64 View commit details
  5. Fix Set.entries()

    rbuckton committed Dec 13, 2023
    Copy the full SHA
    359e1f6 View commit details
  6. Copy the full SHA
    83fc28b View commit details
  7. package.json cleanup

    rbuckton committed Dec 13, 2023
    Copy the full SHA
    bdab024 View commit details
  8. Copy the full SHA
    977503c View commit details
  9. Copy the full SHA
    6227ddf View commit details
  10. Copy the full SHA
    31dde5f View commit details
  11. Copy the full SHA
    b53ea48 View commit details
  12. Copy the full SHA
    ad6f84b View commit details
  13. Create ci.yml

    rbuckton authored Dec 13, 2023
    Copy the full SHA
    4e604aa View commit details
  14. Update ci.yml

    rbuckton authored Dec 13, 2023
    Copy the full SHA
    f16259f View commit details
  15. Copy the full SHA
    7391602 View commit details
  16. Merge pull request #144 from rbuckton/lite-mode

    Add /lite and /no-conflict exports
    rbuckton authored Dec 13, 2023
    Copy the full SHA
    6ef3aed View commit details
  17. Drop prerelease from version

    rbuckton committed Dec 13, 2023
    Copy the full SHA
    893db5d View commit details
  18. Copy the full SHA
    85d168f View commit details
  19. Merge pull request #149 from rbuckton/lite-mode-no-dynamic-eval

    No dynamic evaluation in `/lite` mode
    rbuckton authored Dec 13, 2023
    Copy the full SHA
    68fd019 View commit details

Commits on Dec 14, 2023

  1. Copy the full SHA
    1e66739 View commit details
  2. 0.2.1

    rbuckton committed Dec 14, 2023
    Copy the full SHA
    5c2589f View commit details
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build

on:
push:
branches: [ "main", "release-*" ]
pull_request:
branches: [ "main", "release-*" ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Build
run: |
npm install
gulp
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.vscode/
node_modules/
test/**/*.js
test/**/*.js.map
test/**/*.js.map
index.d.mts
no-conflict.d.mts
*.js
*.js.map
*.mjs
*.mjs.map
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
.vscode
node_modules
out
docs
spec
temp
test
typings
bower.json
gulpfile.js
globals.d.ts
Reflect.ts
Reflect.js.map
ReflectLite.ts
ReflectLite.js.map
ReflectNoConflict.ts
ReflectNoConflict.js.map
spec.html
tsconfig.json
tsconfig-release.json
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Metadata Reflection API

NOTE: Now that both [Decorators](https://github.com/tc39/proposal-decorators) and
[Decorator Metadata](https://github.com/tc39/proposal-decorator-metadata) have achieved Stage 3 within TC39, the API
proposed below is no longer being considered for standardization. However, this package will continue to support
projects that leverage TypeScript's legacy `--experimentalDecorators` option as some projects may not be able to migrate
to use standard decorators.

* [Detailed proposal][Metadata-Spec]

## Installation
@@ -8,6 +14,53 @@
npm install reflect-metadata
```

## Usage

### ES Modules in NodeJS/Browser, TypeScript/Babel, Bundlers
```ts
// - Modifies global `Reflect` object (or defines one in ES5 runtimes).
// - Supports ESM and CommonJS.
// - Contains internal polyfills for `Map`, `Set`, and `WeakMap` for older runtimes.
import "reflect-metadata";

// - Modifies global `Reflect` object (or defines one in ES5 runtimes).
// - Supports ESM and CommonJS.
// - Requires runtime support for `"exports"` in `package.json`.
// - Does not include internal polyfills.
import "reflect-metadata/lite";
```

### CommonJS
```ts
// - Modifies global `Reflect` object (or defines one in ES5 runtimes).
// - Contains internal polyfills for `Map`, `Set`, and `WeakMap` for older runtimes.
require("reflect-metadata");

// - Modifies global `Reflect` object (or defines one in ES5 runtimes).
// - Requires runtime support for `"exports"` in `package.json`.
// - Does not include internal polyfills.
require("reflect-metadata/lite");
```

### In the Browser via `<script>`
**HTML**
```html
<!-- Modifies global `Reflect` object (or defines one in ES5 runtimes). -->
<!-- Contains internal polyfills for `Map`, `Set`, and `WeakMap` for older runtimes. -->
<script src="path/to/reflect-metadata/Reflect.js"></script>

<!-- Modifies global `Reflect` object (or defines one in ES5 runtimes). -->
<!-- Does not include internal polyfills. -->
<script src="path/to/reflect-metadata/ReflectLite.js"></script>
```

**Script**
```js
// - Makes types available in your editor.
/// <reference path="path/to/reflect-metadata/standalone.d.ts" />

```

## Background

* Decorators add the ability to augment a class and its members as the class is defined, through a declarative syntax.
Loading