clang-format-node 1.1.2 → 1.2.0-canary.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.
package/build/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/build/cli.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ "use strict";var _require=require("child_process"),spawn=_require.spawn;var _require2=require("./utils/clangFormatPath"),clangFormatPath=_require2.clangFormatPath;var spawned=spawn(clangFormatPath,process.argv.slice(2),{stdio:"inherit"});spawned.on("close",function(code){if(code!==0){console.error("Process exited with code: ".concat(code));process.exit(code)}});
@@ -0,0 +1,5 @@
1
+ import { clangFormatPath } from "./utils/clangFormatPath";
2
+ import { clangFormatNodePath } from "./utils/clangFormatPath";
3
+ import { getClangFormatPath } from "./utils/getClangFormatPath";
4
+ import { getClangFormatNodePath } from "./utils/getClangFormatPath";
5
+ export { clangFormatPath, clangFormatNodePath, getClangFormatPath, getClangFormatNodePath };
package/build/index.js CHANGED
@@ -1,2 +1 @@
1
- #!/usr/bin/env node
2
- "use strict";var _require=require("os"),platform=_require.platform,arch=_require.arch;var _require2=require("child_process"),spawn=_require2.spawn;var getClangFormatPath=require("./getClangFormatPath");var OS_PLATFORM=platform();var ARCHITECTURE=arch();try{var spawned=spawn(getClangFormatPath(OS_PLATFORM,ARCHITECTURE),process.argv.slice(2),{stdio:"inherit"});spawned.on("close",process.exit)}catch(error){console.error(error.message);process.exit(1)}
1
+ "use strict";var _require=require("./utils/clangFormatPath"),clangFormatPath=_require.clangFormatPath,clangFormatNodePath=_require.clangFormatNodePath;var _require2=require("./utils/getClangFormatPath"),getClangFormatPath=_require2.getClangFormatPath,getClangFormatNodePath=_require2.getClangFormatNodePath;module.exports={clangFormatPath:clangFormatPath,clangFormatNodePath:clangFormatNodePath,getClangFormatPath:getClangFormatPath,getClangFormatNodePath:getClangFormatNodePath};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The ABSOLUTE path to the `clang-format` executable binary based on the OS platform and architecture.
3
+ *
4
+ * @alias `clangFormatNodePath`. See {@link clangFormatNodePath}.
5
+ * @version `v1.2.0` Initial release.
6
+ */
7
+ export const clangFormatPath: string;
8
+ /**
9
+ * Alias for `clangFormatPath`.
10
+ *
11
+ * @alias `clangFormatPath`. See {@link clangFormatPath}.
12
+ * @version `v1.2.0` Initial release.
13
+ */
14
+ export const clangFormatNodePath: string;
@@ -0,0 +1 @@
1
+ "use strict";var _require=require("os"),platform=_require.platform,arch=_require.arch;var _require2=require("./getClangFormatPath"),getClangFormatPath=_require2.getClangFormatPath;var clangFormatPath=getClangFormatPath(platform(),arch());var clangFormatNodePath=clangFormatPath;module.exports={clangFormatPath:clangFormatPath,clangFormatNodePath:clangFormatNodePath};
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Returns the ABSOLUTE path to the `clang-format` executable binary based on the OS platform and architecture.
3
+ *
4
+ * The possible combinations are `darwin-arm64`, `darwin-x64`, `linux-arm`, `linux-arm64`, `linux-ppc64`, `linux-s390x`, `linux-x64`, `win32-x64`.
5
+ *
6
+ * Throws an error if the executable is not found.
7
+ *
8
+ * @param {string} osPlatform The current operating system platform. (e.g., `darwin`, `linux`, `win32`)
9
+ * @param {string} architecture The current system architecture. (e.g., `arm`, `arm64`, `ppc64`, `s390x`, `x64`)
10
+ * @returns {string} The ABSOLUTE path to the `clang-format` executable binary.
11
+ * @throws `Error` Throws an error if the executable binary is not found for the specified OS platform and architecture.
12
+ * @alias `getClangFormatNodePath`. See {@link getClangFormatNodePath}.
13
+ * @version `v1.2.0` Initial release.
14
+ */
15
+ export function getClangFormatPath(osPlatform: string, architecture: string): string;
16
+ /**
17
+ * Returns the ABSOLUTE path to the `clang-format` executable binary based on the OS platform and architecture.
18
+ *
19
+ * The possible combinations are `darwin-arm64`, `darwin-x64`, `linux-arm`, `linux-arm64`, `linux-ppc64`, `linux-s390x`, `linux-x64`, `win32-x64`.
20
+ *
21
+ * Throws an error if the executable is not found.
22
+ *
23
+ * @param {string} osPlatform The current operating system platform. (e.g., `darwin`, `linux`, `win32`)
24
+ * @param {string} architecture The current system architecture. (e.g., `arm`, `arm64`, `ppc64`, `s390x`, `x64`)
25
+ * @returns {string} The ABSOLUTE path to the `clang-format` executable binary.
26
+ * @throws `Error` Throws an error if the executable binary is not found for the specified OS platform and architecture.
27
+ * @alias `getClangFormatNodePath`. See {@link getClangFormatNodePath}.
28
+ * @version `v1.2.0` Initial release.
29
+ */
30
+ export function getClangFormatNodePath(osPlatform: string, architecture: string): string;
@@ -0,0 +1 @@
1
+ "use strict";var _require=require("fs"),existsSync=_require.existsSync;var _require2=require("path"),resolve=_require2.resolve;function getClangFormatPath(osPlatform,architecture){var clangFormatPath=resolve(__dirname,"..","bin","cfn-".concat(osPlatform,"-").concat(architecture),"clang-format".concat(osPlatform==="win32"?".exe":""));if(!existsSync(clangFormatPath))throw new Error("No executable found for '".concat(osPlatform,"(OS platform)-").concat(architecture,"(architecture)'\nThe possible combinations are 'darwin-arm64', 'darwin-x64', 'linux-arm', 'linux-arm64', 'linux-ppc64', 'linux-s390x', 'linux-x64', 'win32-x64'"));return clangFormatPath}var getClangFormatNodePath=getClangFormatPath;module.exports={getClangFormatPath:getClangFormatPath,getClangFormatNodePath:getClangFormatNodePath};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clang-format-node",
3
- "version": "1.1.2",
3
+ "version": "1.2.0-canary.0",
4
4
  "description": "Node repackaging of the clang-format native binary inspired by angular/clang-format.🐉",
5
5
  "main": "build/index.js",
6
6
  "files": [
@@ -9,7 +9,8 @@
9
9
  "README.md"
10
10
  ],
11
11
  "bin": {
12
- "clang-format": "build/index.js"
12
+ "clang-format": "build/cli.js",
13
+ "clang-format-node": "build/cli.js"
13
14
  },
14
15
  "keywords": [
15
16
  "clang-format",
@@ -29,7 +30,7 @@
29
30
  ],
30
31
  "author": "루밀LuMir <rpfos@naver.com> (https://github.com/lumirlumir)",
31
32
  "license": "MIT",
32
- "homepage": "https://github.com/lumirlumir/npm-clang-format-node",
33
+ "homepage": "https://clang-format-node.lumir.page",
33
34
  "repository": {
34
35
  "type": "github",
35
36
  "url": "git+https://github.com/lumirlumir/npm-clang-format-node.git"
@@ -41,48 +42,12 @@
41
42
  "node": ">=16"
42
43
  },
43
44
  "scripts": {
44
- "prepare": "husky",
45
- "postinstall": "find ./build/bin -type f -exec chmod 755 {} + || true",
45
+ "postinstall": "test -d src && npm run build || npm run chmod",
46
46
  "prepublishOnly": "npm run build",
47
- "build": "npx babel src -d build --no-comments --compact true --minified && cp -r src/bin build",
48
- "test": "npx mocha ./tests --inline-diffs true",
49
- "coverage": "npx nyc --reporter=lcov npm run test",
50
- "lint": "concurrently \"npm:lint-*\"",
51
- "lint-eslint": "npx eslint . --ext .js",
52
- "lint-prettier": "npx prettier . --check",
53
- "lint-editorconfig": "npx editorconfig-checker",
54
- "lint-markdownlint": "npx markdownlint **/*.md",
55
- "fix": "concurrently \"npm:fix-*\"",
56
- "fix-eslint": "npx eslint . --fix --ext .js",
57
- "fix-prettier": "npx prettier . --write"
47
+ "build": "npx babel src -d build && npx tsc && cp -r src/bin build && cp ../../LICENSE ../../README.md .",
48
+ "postbuild": "npm run chmod",
49
+ "test": "node --test",
50
+ "chmod": "find ./src/bin ./build/bin -type f -exec chmod 755 {} + || true"
58
51
  },
59
- "devDependencies": {
60
- "@babel/cli": "^7.24.8",
61
- "@babel/core": "^7.25.2",
62
- "@babel/preset-env": "^7.25.3",
63
- "concurrently": "^9.0.0",
64
- "editorconfig-checker": "^6.0.0",
65
- "eslint": "^8.57.0",
66
- "eslint-config-airbnb-base": "^15.0.0",
67
- "eslint-config-prettier": "^9.1.0",
68
- "eslint-plugin-import": "^2.29.1",
69
- "eslint-plugin-prettier": "^5.2.1",
70
- "husky": "^9.1.5",
71
- "lint-staged": "^15.2.10",
72
- "markdownlint-cli": "^0.42.0",
73
- "mocha": "^10.7.3",
74
- "nyc": "^17.0.0",
75
- "prettier": "^3.3.3"
76
- },
77
- "lint-staged": {
78
- "*": [
79
- "npx prettier --check",
80
- "npx editorconfig-checker -exclude README.md"
81
- ],
82
- "*.js": "npx eslint",
83
- "*.md": "npx markdownlint",
84
- "{src,tests}/**/!(index.js)": [
85
- "npm run test"
86
- ]
87
- }
52
+ "gitHead": "ddfb3cac2964da5d88b6f145b818a14234f09a22"
88
53
  }
@@ -1 +0,0 @@
1
- "use strict";var _require=require("fs"),existsSync=_require.existsSync;var _require2=require("path"),resolve=_require2.resolve;module.exports=function(osPlatform,architecture){var clangFormatPath=resolve(__dirname,"bin","".concat(osPlatform,"-").concat(architecture),"clang-format".concat(osPlatform==="win32"?".exe":""));if(!existsSync(clangFormatPath))throw new Error("No executable found for '".concat(osPlatform,"(OS platform)-").concat(architecture,"(architecture)'\nSee supported OS platform and architecture lists of clang-format-node in README.md"));return clangFormatPath};