diff --git a/packages/identity-obj-proxy/.babelrc b/packages/identity-obj-proxy/.babelrc
new file mode 100644
index 00000000..0993cfa1
--- /dev/null
+++ b/packages/identity-obj-proxy/.babelrc
@@ -0,0 +1,3 @@
+{
+ "presets": [ "es2015", "stage-0" ],
+}
diff --git a/packages/identity-obj-proxy/.eslintrc b/packages/identity-obj-proxy/.eslintrc
new file mode 100644
index 00000000..6569bcbc
--- /dev/null
+++ b/packages/identity-obj-proxy/.eslintrc
@@ -0,0 +1,9 @@
+{
+ "extends": "airbnb-base",
+ "env": {
+ "browser": true,
+ "node": true,
+ "es6": true,
+ "jest": true,
+ }
+}
diff --git a/packages/identity-obj-proxy/.gitignore b/packages/identity-obj-proxy/.gitignore
new file mode 100644
index 00000000..bfb12125
--- /dev/null
+++ b/packages/identity-obj-proxy/.gitignore
@@ -0,0 +1,29 @@
+# Logs
+logs
+*.log
+
+# Runtime data
+pids
+*.pid
+*.seed
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (http://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directory
+# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
+node_modules
+
+.DS_Store
diff --git a/packages/identity-obj-proxy/.travis.yml b/packages/identity-obj-proxy/.travis.yml
new file mode 100644
index 00000000..2928299a
--- /dev/null
+++ b/packages/identity-obj-proxy/.travis.yml
@@ -0,0 +1,22 @@
+language: node_js
+
+node_js:
+ - 6.2.0
+ - 5.3.0
+ - 4.0
+
+compiler: clang-3.6
+
+env:
+ - CXX=clang-3.6
+
+addons:
+ apt:
+ sources:
+ - llvm-toolchain-precise-3.6
+ - ubuntu-toolchain-r-test
+ packages:
+ - clang-3.6
+ - g++-4.8
+
+after_success: npm run coveralls
diff --git a/packages/identity-obj-proxy/LICENSE b/packages/identity-obj-proxy/LICENSE
new file mode 100644
index 00000000..7a27ce55
--- /dev/null
+++ b/packages/identity-obj-proxy/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Keyan Zhang
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/packages/identity-obj-proxy/README.md b/packages/identity-obj-proxy/README.md
new file mode 100644
index 00000000..eb672090
--- /dev/null
+++ b/packages/identity-obj-proxy/README.md
@@ -0,0 +1,51 @@
+# identity-obj-proxy [](https://travis-ci.org/keyanzhang/identity-obj-proxy) [](https://www.npmjs.com/package/identity-obj-proxy) [](https://coveralls.io/github/keyanzhang/identity-obj-proxy?branch=master)
+An identity object using ES6 proxies. Useful for mocking webpack imports. For instance, you can tell Jest to mock this object as imported [CSS modules](https://github.com/css-modules/css-modules); then all your `className` lookups on the imported `styles` object will be returned as-is.
+
+```
+npm install identity-obj-proxy
+```
+
+## ~~Real world example~~ Wait what does that even mean
+### tl;dr
+For a React component like
+```js
+import React, { Component } from 'react';
+
+import styles from './App.css'; // CSS Modules here
+
+export default class App extends Component {
+ render() {
+ return (
+
+
Hello, world!
+
+ );
+ }
+}
+```
+
+we can generate a snapshot as below (notice that the class names get correctly mocked):
+```js
+exports[`test App renders correctly 1`] = `
+
+
+ Hello, world!
+
+
+`;
+```
+
+For more information, please take a look at https://github.com/keyanzhang/jest-css-modules-example/ and https://jestjs.io/docs/en/webpack.html.
+
+## Requirement
+No flag is required for Node.js `v6.*`; use `node --harmony_proxies` flag for `v5.*` and `v4.*`.
+
+## Example
+``` javascript
+import idObj from 'identity-obj-proxy';
+console.log(idObj.foo); // 'foo'
+console.log(idObj.bar); // 'bar'
+console.log(idObj[1]); // '1'
+```
diff --git a/packages/identity-obj-proxy/package.json b/packages/identity-obj-proxy/package.json
new file mode 100644
index 00000000..359b5dd3
--- /dev/null
+++ b/packages/identity-obj-proxy/package.json
@@ -0,0 +1,55 @@
+{
+ "name": "@opensourceframework/identity-obj-proxy",
+ "version": "3.0.0",
+ "description": "an identity object using ES6 proxies (forked)",
+ "main": "src/index.js",
+ "scripts": {
+ "lint": "eslint src",
+ "test": "node --harmony_proxies node_modules/.bin/jest",
+ "coverage": "node --harmony_proxies node_modules/.bin/jest --coverage",
+ "coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
+ "prepublish": "npm run lint && npm run test"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/riceharvest/opensourceframework.git",
+ "directory": "packages/identity-obj-proxy"
+ },
+ "keywords": [
+ "proxy",
+ "proxies",
+ "identity",
+ "jest",
+ "mock"
+ ],
+ "author": "OpenSource Framework Contributors (fork), Original: Keyan Zhang",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/riceharvest/opensourceframework/issues?q=is%3Aissue+is%3Aopen+identity-obj-proxy"
+ },
+ "homepage": "https://github.com/riceharvest/opensourceframework/tree/main/packages/identity-obj-proxy#readme",
+ "opensourceframework": "*",
+ "dependencies": {
+ "harmony-reflect": "^1.4.6"
+ },
+ "devDependencies": {
+ "babel-core": "^6.11.4",
+ "babel-jest": "^14.1.0",
+ "babel-preset-es2015": "^6.9.0",
+ "babel-preset-stage-0": "^6.5.0",
+ "coveralls": "^2.11.12",
+ "eslint": "^3.2.2",
+ "eslint-config-airbnb-base": "^5.0.1",
+ "eslint-plugin-import": "^1.12.0",
+ "jest-cli": "^14.1.0"
+ },
+ "jest": {
+ "automock": false,
+ "testPathDirs": [
+ "/src"
+ ]
+ }
+}
diff --git a/packages/identity-obj-proxy/src/__tests__/import-es6-export-test.js b/packages/identity-obj-proxy/src/__tests__/import-es6-export-test.js
new file mode 100644
index 00000000..724865d6
--- /dev/null
+++ b/packages/identity-obj-proxy/src/__tests__/import-es6-export-test.js
@@ -0,0 +1,13 @@
+import idObj from '../test-redirections/idObjES6Export';
+
+describe('idObj', () => {
+ it('should return the key as a string', () => {
+ expect(idObj.foo).toBe('foo');
+ });
+ it('should support dot notation', () => {
+ expect(idObj.bar).toBe('bar');
+ });
+ it('should support bracket notation', () => {
+ expect(idObj[1]).toBe('1');
+ });
+});
diff --git a/packages/identity-obj-proxy/src/__tests__/import-es6-import-export-test.js b/packages/identity-obj-proxy/src/__tests__/import-es6-import-export-test.js
new file mode 100644
index 00000000..358c3a3a
--- /dev/null
+++ b/packages/identity-obj-proxy/src/__tests__/import-es6-import-export-test.js
@@ -0,0 +1,13 @@
+import idObj from '../test-redirections/idObjES6ImportExport';
+
+describe('idObj', () => {
+ it('should return the key as a string', () => {
+ expect(idObj.foo).toBe('foo');
+ });
+ it('should support dot notation', () => {
+ expect(idObj.bar).toBe('bar');
+ });
+ it('should support bracket notation', () => {
+ expect(idObj[1]).toBe('1');
+ });
+});
diff --git a/packages/identity-obj-proxy/src/__tests__/import-es6-import-test.js b/packages/identity-obj-proxy/src/__tests__/import-es6-import-test.js
new file mode 100644
index 00000000..94c18cb1
--- /dev/null
+++ b/packages/identity-obj-proxy/src/__tests__/import-es6-import-test.js
@@ -0,0 +1,13 @@
+import idObj from '../test-redirections/idObjES6Import';
+
+describe('idObj', () => {
+ it('should return the key as a string', () => {
+ expect(idObj.foo).toBe('foo');
+ });
+ it('should support dot notation', () => {
+ expect(idObj.bar).toBe('bar');
+ });
+ it('should support bracket notation', () => {
+ expect(idObj[1]).toBe('1');
+ });
+});
diff --git a/packages/identity-obj-proxy/src/__tests__/import-vanilla-test.js b/packages/identity-obj-proxy/src/__tests__/import-vanilla-test.js
new file mode 100644
index 00000000..8dc4eeae
--- /dev/null
+++ b/packages/identity-obj-proxy/src/__tests__/import-vanilla-test.js
@@ -0,0 +1,13 @@
+import idObj from '..';
+
+describe('idObj', () => {
+ it('should return the key as a string', () => {
+ expect(idObj.foo).toBe('foo');
+ });
+ it('should support dot notation', () => {
+ expect(idObj.bar).toBe('bar');
+ });
+ it('should support bracket notation', () => {
+ expect(idObj[1]).toBe('1');
+ });
+});
diff --git a/packages/identity-obj-proxy/src/__tests__/index-test.js b/packages/identity-obj-proxy/src/__tests__/index-test.js
new file mode 100644
index 00000000..8265b185
--- /dev/null
+++ b/packages/identity-obj-proxy/src/__tests__/index-test.js
@@ -0,0 +1,13 @@
+const idObj = require('..');
+
+describe('idObj', () => {
+ it('should return the key as a string', () => {
+ expect(idObj.foo).toBe('foo');
+ });
+ it('should support dot notation', () => {
+ expect(idObj.bar).toBe('bar');
+ });
+ it('should support bracket notation', () => {
+ expect(idObj[1]).toBe('1');
+ });
+});
diff --git a/packages/identity-obj-proxy/src/__tests__/require-es6-export-test.js b/packages/identity-obj-proxy/src/__tests__/require-es6-export-test.js
new file mode 100644
index 00000000..29942fcf
--- /dev/null
+++ b/packages/identity-obj-proxy/src/__tests__/require-es6-export-test.js
@@ -0,0 +1,13 @@
+const idObj = require('../test-redirections/idObjES6Export').default;
+
+describe('idObj', () => {
+ it('should return the key as a string', () => {
+ expect(idObj.foo).toBe('foo');
+ });
+ it('should support dot notation', () => {
+ expect(idObj.bar).toBe('bar');
+ });
+ it('should support bracket notation', () => {
+ expect(idObj[1]).toBe('1');
+ });
+});
diff --git a/packages/identity-obj-proxy/src/__tests__/require-es6-import-export-test.js b/packages/identity-obj-proxy/src/__tests__/require-es6-import-export-test.js
new file mode 100644
index 00000000..3238c7a8
--- /dev/null
+++ b/packages/identity-obj-proxy/src/__tests__/require-es6-import-export-test.js
@@ -0,0 +1,13 @@
+const idObj = require('../test-redirections/idObjES6ImportExport').default;
+
+describe('idObj', () => {
+ it('should return the key as a string', () => {
+ expect(idObj.foo).toBe('foo');
+ });
+ it('should support dot notation', () => {
+ expect(idObj.bar).toBe('bar');
+ });
+ it('should support bracket notation', () => {
+ expect(idObj[1]).toBe('1');
+ });
+});
diff --git a/packages/identity-obj-proxy/src/__tests__/require-es6-import-test.js b/packages/identity-obj-proxy/src/__tests__/require-es6-import-test.js
new file mode 100644
index 00000000..13a42c29
--- /dev/null
+++ b/packages/identity-obj-proxy/src/__tests__/require-es6-import-test.js
@@ -0,0 +1,13 @@
+const idObj = require('../test-redirections/idObjES6Import');
+
+describe('idObj', () => {
+ it('should return the key as a string', () => {
+ expect(idObj.foo).toBe('foo');
+ });
+ it('should support dot notation', () => {
+ expect(idObj.bar).toBe('bar');
+ });
+ it('should support bracket notation', () => {
+ expect(idObj[1]).toBe('1');
+ });
+});
diff --git a/packages/identity-obj-proxy/src/__tests__/require-vanilla-test.js b/packages/identity-obj-proxy/src/__tests__/require-vanilla-test.js
new file mode 100644
index 00000000..8265b185
--- /dev/null
+++ b/packages/identity-obj-proxy/src/__tests__/require-vanilla-test.js
@@ -0,0 +1,13 @@
+const idObj = require('..');
+
+describe('idObj', () => {
+ it('should return the key as a string', () => {
+ expect(idObj.foo).toBe('foo');
+ });
+ it('should support dot notation', () => {
+ expect(idObj.bar).toBe('bar');
+ });
+ it('should support bracket notation', () => {
+ expect(idObj[1]).toBe('1');
+ });
+});
diff --git a/packages/identity-obj-proxy/src/index.js b/packages/identity-obj-proxy/src/index.js
new file mode 100644
index 00000000..29cf58d0
--- /dev/null
+++ b/packages/identity-obj-proxy/src/index.js
@@ -0,0 +1,26 @@
+/* eslint-disable no-var, comma-dangle */
+var Reflect; // eslint-disable-line no-unused-vars
+var idObj;
+
+function checkIsNodeV6OrAbove() {
+ if (typeof process === 'undefined') {
+ return false;
+ }
+
+ return parseInt(process.versions.node.split('.')[0], 10) >= 6;
+}
+
+if (!checkIsNodeV6OrAbove()) {
+ Reflect = require('harmony-reflect'); // eslint-disable-line global-require
+}
+
+idObj = new Proxy({}, {
+ get: function getter(target, key) {
+ if (key === '__esModule') {
+ return false;
+ }
+ return key;
+ }
+});
+
+module.exports = idObj;
diff --git a/packages/identity-obj-proxy/src/test-redirections/idObjES6Export.js b/packages/identity-obj-proxy/src/test-redirections/idObjES6Export.js
new file mode 100644
index 00000000..73da7b64
--- /dev/null
+++ b/packages/identity-obj-proxy/src/test-redirections/idObjES6Export.js
@@ -0,0 +1,3 @@
+const idObj = require('..');
+
+export default idObj;
diff --git a/packages/identity-obj-proxy/src/test-redirections/idObjES6Import.js b/packages/identity-obj-proxy/src/test-redirections/idObjES6Import.js
new file mode 100644
index 00000000..dd6a80a8
--- /dev/null
+++ b/packages/identity-obj-proxy/src/test-redirections/idObjES6Import.js
@@ -0,0 +1,3 @@
+import idObj from '..';
+
+module.exports = idObj;
diff --git a/packages/identity-obj-proxy/src/test-redirections/idObjES6ImportExport.js b/packages/identity-obj-proxy/src/test-redirections/idObjES6ImportExport.js
new file mode 100644
index 00000000..e096c012
--- /dev/null
+++ b/packages/identity-obj-proxy/src/test-redirections/idObjES6ImportExport.js
@@ -0,0 +1,3 @@
+import idObj from '..';
+
+export default idObj;