{"id":17749518,"url":"https://github.com/oresoftware/tsc-systemjs-example","last_synced_at":"2025-04-01T08:11:26.832Z","repository":{"id":95713231,"uuid":"88080377","full_name":"ORESoftware/tsc-systemjs-example","owner":"ORESoftware","description":"Example project to demonstrate problems with TSC and SystemJS","archived":false,"fork":false,"pushed_at":"2018-05-30T05:48:09.000Z","size":309,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-02T00:26:09.213Z","etag":null,"topics":["systemjs","tsc","tsconfig"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ORESoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-12T17:48:26.000Z","updated_at":"2018-05-30T05:48:11.000Z","dependencies_parsed_at":"2023-06-05T15:15:47.306Z","dependency_job_id":null,"html_url":"https://github.com/ORESoftware/tsc-systemjs-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Ftsc-systemjs-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Ftsc-systemjs-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Ftsc-systemjs-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Ftsc-systemjs-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ORESoftware","download_url":"https://codeload.github.com/ORESoftware/tsc-systemjs-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246604611,"owners_count":20804100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["systemjs","tsc","tsconfig"],"created_at":"2024-10-26T11:23:36.255Z","updated_at":"2025-04-01T08:11:26.814Z","avatar_url":"https://github.com/ORESoftware.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"@ryan cavanaugh\n\nthanks for taking a look, I think I can demonstrate some problems\n\nyou can build this project with\n\n```bash\n$ tsc --project tsconfig-amd.json\n$ tsc --project tsconfig-system.json\n```\n\nThese two different configs are identical except one targets AMD the other targets SystemJS.\nThe short of this, is:\n \n 1. that AMD transpiles correctly, but SystemJS does not.\n 2. With either AMD or SystemJS, only 12 of my 100+ .js/.ts files get included in the bundle, not sure why \n\n\nYou will notice in either the dist/systemjs-bundle.js file or dist/amd-bundle.js file, that there are only\n12 `System.register` calls (try ctrl+f)\n\nHowever, my `lib` directory has many more like 100+ .ts/.js files\n\nso the *first* problem (1) is that TSC is not picking up all my files, not sure why\n\u003cbr\u003e\nthe *second* problem (2) is that TSC is not taking my modules and accurately transpiling them.\n\n\nFor example, an original .ts module looks like this:\n\n\n```typescript\n\n'use strict';\n\n//polyfills\nconst process = require('suman-browser-polyfills/modules/process');\nconst global = require('suman-browser-polyfills/modules/global');\n\n//core\nconst domain = require('domain');\nconst util = require('util');\n\n//npm\nconst pragmatik = require('pragmatik');\nconst async = require('async');\nconst colors = require('colors/safe');\n\n//project\nconst _suman = global.__suman = (global.__suman || {});\nconst rules = require('../helpers/handle-varargs');\nconst constants = require('../../config/suman-constants');\nconst handleSetupComplete = require('../handle-setup-complete');\n\n///////////////////////////////////////////////////////////////////////////////////////\n\nfunction handleBadOptions(opts: IAfterOpts): void {\n\n    if (opts.plan !== undefined \u0026\u0026 !Number.isInteger(opts.plan)) {\n        console.error(' =\u003e Suman usage error =\u003e \"plan\" option is not an integer.');\n        process.exit(constants.EXIT_CODES.OPTS_PLAN_NOT_AN_INTEGER);\n        return;\n    }\n}\n\n//////////////////////////// inline types  ///////////////////////////////////\n\n//TODO\n\n////////////////////////////////////////////////////////////////////////////\n\nexport = function (suman: ISuman, zuite: ITestSuite): Function {\n\n    return function ($desc: string, $opts: IAfterOpts, $fn: Function): ITestSuite {\n\n        handleSetupComplete(zuite);\n\n        const args: Array\u003cany\u003e = pragmatik.parse(arguments, rules.hookSignature, {\n            preParsed: typeof $opts === 'object' ? $opts.__preParsed : null\n        });\n\n        // this transpiles much more nicely, rather than inlining it above\n        const [desc, opts, fn] = args;\n        handleBadOptions(opts);\n\n        if (opts.skip) {\n            suman.numHooksSkipped++;\n        }\n        else if (!fn) {\n            suman.numHooksStubbed++;\n        }\n        else {\n            zuite.getAfters().push({\n                ctx: zuite,\n                timeout: opts.timeout || 11000,\n                desc: desc || (fn ? fn.name : '(unknown due to stubbed function)'),\n                cb: opts.cb || false,\n                throws: opts.throws,\n                planCountExpected: opts.plan,\n                fatal: !(opts.fatal === false),\n                fn: fn,\n                type: 'after/teardown',\n                warningErr: new Error('SUMAN_TEMP_WARNING_ERROR')\n            });\n        }\n\n        return zuite;\n\n    };\n\n\n};\n\n\n```\n\nbut the transpiled module looks like this:\n\n\n```javascript\n\nSystem.register(\"test-suite-methods/make-after\", [], function (exports_7, context_7) {\n    'use strict';\n    var __moduleName = context_7 \u0026\u0026 context_7.id;\n    function handleBadOptions(opts) {\n        if (opts.plan !== undefined \u0026\u0026 !Number.isInteger(opts.plan)) {\n            console.error(' =\u003e Suman usage error =\u003e \"plan\" option is not an integer.');\n            process.exit(constants.EXIT_CODES.OPTS_PLAN_NOT_AN_INTEGER);\n            return;\n        }\n    }\n    var process, global, domain, util, pragmatik, async, colors, _suman, rules, constants, handleSetupComplete;\n    return {\n        setters: [],\n        execute: function () {\n            process = require('suman-browser-polyfills/modules/process');\n            global = require('suman-browser-polyfills/modules/global');\n            domain = require('domain');\n            util = require('util');\n            pragmatik = require('pragmatik');\n            async = require('async');\n            colors = require('colors/safe');\n            _suman = global.__suman = (global.__suman || {});\n            rules = require('../helpers/handle-varargs');\n            constants = require('../../config/suman-constants');\n            handleSetupComplete = require('../handle-setup-complete');\n        }\n    };\n});\n\n```\n\nHere are my **hypotheses**:\n\n1. TSC is (erroneously) not including .js files at all (only is transpiling .ts files, and moving those to --outFile) (seems likely)\n2. I do not currently have a hypothesis WRT why SystemJS is not being transpiled accurately. AMD seems to be OK.\n\n\nAs an aside, I would like to be able to bundle everything, including node_modules,\nthat is a whole other challenge I think. Any advice regarding that would be much appreciated.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foresoftware%2Ftsc-systemjs-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foresoftware%2Ftsc-systemjs-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foresoftware%2Ftsc-systemjs-example/lists"}