Skip to content

Commit

Permalink
test: add example node-classic
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Feb 11, 2024
1 parent bd68eef commit 5ec633f
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/.gitignore
@@ -0,0 +1,2 @@
!dist
!lib
35 changes: 35 additions & 0 deletions examples/node-classic/lib/index.js
@@ -0,0 +1,35 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/index.ts
var src_exports = {};
__export(src_exports, {
foo: () => foo
});
module.exports = __toCommonJS(src_exports);

// src/foo.ts
function foo() {
console.log("foo");
}
__name(foo, "foo");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
foo
});
12 changes: 12 additions & 0 deletions examples/node-classic/package.json
@@ -0,0 +1,12 @@
{
"name": "@dunble-examples/node-classic",
"version": "0.0.0",
"private": true,
"main": "lib/index.js",
"scripts": {
"build": "dunble"
},
"dependencies": {
"dunble": "^0.1.0"
}
}
3 changes: 3 additions & 0 deletions examples/node-classic/src/foo.ts
@@ -0,0 +1,3 @@
export function foo() {
console.log('foo')
}
1 change: 1 addition & 0 deletions examples/node-classic/src/index.ts
@@ -0,0 +1 @@
export { foo } from './foo'
13 changes: 13 additions & 0 deletions examples/node-classic/tsconfig.json
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"rootDir": "src",
"outDir": "lib",
"target": "esnext",
"module": "commonjs",
"declaration": true,
"emitDeclarationOnly": true,
},
"include": [
"src",
],
}
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -10,6 +10,9 @@
"lib",
"src"
],
"workspaces": [
"examples/*"
],
"repository": {
"type": "git",
"url": "git+https://github.com/shigma/dunble.git"
Expand Down

0 comments on commit 5ec633f

Please sign in to comment.