@cmmn/tools 1.7.12 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import ts from "ttypescript";
1
+ import ts from "typescript/lib/typescript.js";
2
2
  import {resolve, relative} from 'path';
3
3
  import fs from "fs";
4
4
  const rootDir = process.cwd();
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "esnext",
4
- "moduleResolution": "Node",
5
- "target": "ES2020",
3
+ "module": "NodeNext",
4
+ "moduleResolution": "NodeNext",
5
+ "target": "ESNext",
6
6
  "composite": true,
7
7
  "sourceMap": false,
8
8
  "baseUrl": "./",
@@ -21,29 +21,14 @@
21
21
  "emitDecoratorMetadata": true ,
22
22
  "noEmitHelpers": true,
23
23
  "declarationDir": "./dist/typings",
24
+ "esModuleInterop": true,
25
+ "forceConsistentCasingInFileNames": true,
26
+ "useDefineForClassFields": false,
24
27
  "declaration": true,
25
- "types": [
26
- "@cmmn/tools"
27
- ],
28
28
  "lib": [
29
29
  "ES2020.BigInt",
30
30
  "ESNext",
31
31
  "DOM"
32
- ],
33
- "plugins": [
34
- // Transform paths in output .js files
35
- {
36
- "transform": "typescript-transform-paths"
37
- },
38
- {
39
- "transform": "@cmmn/tools/plugins/absolute-plugin.cjs",
40
- "after": true
41
- },
42
- // Transform paths in output .d.ts files (Include this line if you output declarations files)
43
- {
44
- "transform": "typescript-transform-paths",
45
- "afterDeclarations": true
46
- }
47
32
  ]
48
33
  },
49
34
  "exclude": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmmn/tools",
3
- "version": "1.7.12",
3
+ "version": "1.8.0",
4
4
  "description": "Compilation, bundling, code generator, testing.",
5
5
  "main": "dist/rollup.config.js",
6
6
  "type": "module",
@@ -15,6 +15,7 @@
15
15
  "cmmn": "bin.js"
16
16
  },
17
17
  "exports": {
18
+ "./compile/tsconfig.json": "./compile/tsconfig.json",
18
19
  "./test": "./test/index.js",
19
20
  "./test/config": "./test/jest.config.js"
20
21
  },
@@ -58,7 +59,7 @@
58
59
  "fast-glob": "^3.2.11",
59
60
  "file-uri-to-path": "2.x.x",
60
61
  "import-meta-resolve": "2",
61
- "jest": "27.x.x",
62
+ "jest": "29.x.x",
62
63
  "less": "^4",
63
64
  "live-server": "1.2.2",
64
65
  "postcss-assets": "6",
@@ -76,13 +77,11 @@
76
77
  "rollup-plugin-terser": "^7",
77
78
  "rollup-plugin-visualizer": "^5.5.4",
78
79
  "sinon": "10.x.x",
79
- "ts-jest": "27.x.x",
80
- "ttypescript": "1.5.13",
81
- "typescript": "4.6.x",
82
- "typescript-transform-paths": "^3.3.1",
80
+ "ts-jest": "29.x.x",
81
+ "typescript-transform-paths": "3.4.6",
83
82
  "unique-slug": "*"
84
83
  },
85
84
  "author": "",
86
85
  "license": "ISC",
87
- "gitHead": "fcf6faf7560f27a57563dcf211e1b4773e9dd7e0"
86
+ "gitHead": "c265a04bb744ba37bdd61f5e11a5beafabb74b7b"
88
87
  }
@@ -26,14 +26,16 @@ function visitExportNode(exportNode, sourceFile) {
26
26
  }
27
27
  }
28
28
 
29
- function visitImportNode(importNode, sourceFile, options) {
29
+ function visitImportNode(importNode, sourceFile, options, context) {
30
30
  const file = importNode.moduleSpecifier?.text;
31
31
  if (!file || !file.startsWith('.'))
32
32
  return;
33
+ const caseSensitiveFileNames = context.getEmitHost().useCaseSensitiveFileNames();
34
+ const formatPath = caseSensitiveFileNames ? x => x : x => x.toLowerCase();
33
35
  const sourceFileDir = path.dirname(sourceFile.path);
34
- const abs = path.resolve(sourceFileDir, file);
36
+ const abs = formatPath(path.resolve(sourceFileDir, formatPath(file)));
35
37
  if (/\.(less|css|scss|sass|svg|png|html)$/.test(file)) {
36
- const absSource = path.join(options.outDir, path.relative(options.baseUrl, sourceFileDir));
38
+ const absSource = formatPath(path.join(options.outDir, formatPath(path.relative(options.baseUrl, sourceFileDir))));
37
39
  const relFile = path.relative(absSource, abs).replaceAll(path.sep, '/');
38
40
  return ts.updateImportDeclaration(importNode, importNode.decorators, importNode.modifiers, importNode.importClause, ts.createStringLiteral(relFile));
39
41
  }
@@ -65,6 +67,7 @@ function visitRequireNode(importNode, sourceFile) {
65
67
 
66
68
  const lessToStringTransformer = function (context) {
67
69
  const options = context.getCompilerOptions();
70
+ console.log(context);
68
71
  return (sourceFile) => {
69
72
  function visitor(node) {
70
73
  // if (node && node.kind == ts.SyntaxKind.ImportDeclaration) {
@@ -78,7 +81,7 @@ const lessToStringTransformer = function (context) {
78
81
  return result;
79
82
  }
80
83
  if (ts.isImportDeclaration(node)) {
81
- const result = visitImportNode(node, sourceFile, options);
84
+ const result = visitImportNode(node, sourceFile, options, context);
82
85
  if (result)
83
86
  return result;
84
87
  }