driftdetect-lsp 0.9.32 → 0.9.34

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.
Files changed (61) hide show
  1. package/dist/capabilities.d.ts.map +1 -0
  2. package/dist/capabilities.js +183 -0
  3. package/dist/capabilities.js.map +1 -0
  4. package/dist/commands/show-patterns.d.ts +30 -0
  5. package/dist/commands/show-patterns.d.ts.map +1 -1
  6. package/dist/commands/show-patterns.js +175 -0
  7. package/dist/commands/show-patterns.js.map +1 -0
  8. package/dist/handlers/code-actions.d.ts +32 -0
  9. package/dist/handlers/code-actions.d.ts.map +1 -1
  10. package/dist/handlers/code-actions.js +184 -0
  11. package/dist/handlers/code-actions.js.map +1 -0
  12. package/dist/handlers/code-lens.d.ts +32 -0
  13. package/dist/handlers/code-lens.d.ts.map +1 -1
  14. package/dist/handlers/code-lens.js +162 -0
  15. package/dist/handlers/code-lens.js.map +1 -0
  16. package/dist/handlers/commands.d.ts +48 -0
  17. package/dist/handlers/commands.d.ts.map +1 -1
  18. package/dist/handlers/commands.js +360 -0
  19. package/dist/handlers/commands.js.map +1 -0
  20. package/dist/handlers/diagnostics.d.ts +73 -0
  21. package/dist/handlers/diagnostics.d.ts.map +1 -1
  22. package/dist/handlers/diagnostics.js +259 -0
  23. package/dist/handlers/diagnostics.js.map +1 -0
  24. package/dist/handlers/document-sync.d.ts +37 -0
  25. package/dist/handlers/document-sync.d.ts.map +1 -1
  26. package/dist/handlers/document-sync.js +49 -0
  27. package/dist/handlers/document-sync.js.map +1 -0
  28. package/dist/handlers/hover.d.ts +30 -0
  29. package/dist/handlers/hover.d.ts.map +1 -1
  30. package/dist/handlers/hover.js +119 -0
  31. package/dist/handlers/hover.js.map +1 -0
  32. package/dist/integration/core-scanner.d.ts.map +1 -1
  33. package/dist/integration/core-scanner.js +309 -0
  34. package/dist/integration/core-scanner.js.map +1 -0
  35. package/dist/integration/pattern-store-adapter.d.ts +117 -0
  36. package/dist/integration/pattern-store-adapter.d.ts.map +1 -1
  37. package/dist/integration/pattern-store-adapter.js +349 -0
  38. package/dist/integration/pattern-store-adapter.js.map +1 -0
  39. package/dist/integration/types.d.ts +134 -0
  40. package/dist/integration/types.d.ts.map +1 -1
  41. package/dist/integration/types.js +39 -0
  42. package/dist/integration/types.js.map +1 -0
  43. package/dist/server/types.d.ts +139 -0
  44. package/dist/server/types.d.ts.map +1 -1
  45. package/dist/server/types.js +8 -0
  46. package/dist/server/types.js.map +1 -0
  47. package/dist/server.d.ts.map +1 -1
  48. package/dist/server.js +208 -0
  49. package/dist/server.js.map +1 -0
  50. package/dist/utils/diagnostic.js +263 -0
  51. package/dist/utils/diagnostic.js.map +1 -0
  52. package/dist/utils/document.d.ts +40 -0
  53. package/dist/utils/document.d.ts.map +1 -0
  54. package/dist/utils/document.js +138 -0
  55. package/dist/utils/document.js.map +1 -0
  56. package/dist/utils/index.d.ts.map +1 -0
  57. package/dist/utils/workspace.d.ts.map +1 -1
  58. package/dist/utils/workspace.js +241 -0
  59. package/dist/utils/workspace.js.map +1 -0
  60. package/package.json +13 -13
  61. package/LICENSE +0 -121
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Document Utilities
3
+ *
4
+ * Helper functions for working with LSP text documents.
5
+ */
6
+ /**
7
+ * Get the text at a specific range in a document
8
+ */
9
+ export function getTextAtRange(document, range) {
10
+ return document.getText(range);
11
+ }
12
+ /**
13
+ * Get the line text at a specific line number
14
+ */
15
+ export function getLineText(document, line) {
16
+ const lineRange = {
17
+ start: { line, character: 0 },
18
+ end: { line, character: Number.MAX_SAFE_INTEGER },
19
+ };
20
+ return document.getText(lineRange);
21
+ }
22
+ /**
23
+ * Get the word at a specific position
24
+ */
25
+ export function getWordAtPosition(document, position) {
26
+ const lineText = getLineText(document, position.line);
27
+ const character = position.character;
28
+ // Find word boundaries
29
+ let start = character;
30
+ let end = character;
31
+ // Move start backwards to find word start
32
+ while (start > 0) {
33
+ const char = lineText[start - 1];
34
+ if (char === undefined || !isWordChar(char)) {
35
+ break;
36
+ }
37
+ start--;
38
+ }
39
+ // Move end forwards to find word end
40
+ while (end < lineText.length) {
41
+ const char = lineText[end];
42
+ if (char === undefined || !isWordChar(char)) {
43
+ break;
44
+ }
45
+ end++;
46
+ }
47
+ if (start === end) {
48
+ return null;
49
+ }
50
+ return lineText.substring(start, end);
51
+ }
52
+ /**
53
+ * Check if a character is a word character
54
+ */
55
+ function isWordChar(char) {
56
+ return /[\w$]/.test(char);
57
+ }
58
+ /**
59
+ * Get the file name from a URI
60
+ */
61
+ export function getFileName(uri) {
62
+ const parts = uri.split('/');
63
+ return parts[parts.length - 1] ?? uri;
64
+ }
65
+ /**
66
+ * Get the file extension from a URI
67
+ */
68
+ export function getFileExtension(uri) {
69
+ const fileName = getFileName(uri);
70
+ const dotIndex = fileName.lastIndexOf('.');
71
+ if (dotIndex === -1) {
72
+ return '';
73
+ }
74
+ return fileName.substring(dotIndex + 1);
75
+ }
76
+ /**
77
+ * Check if a URI matches a glob pattern (simple implementation)
78
+ */
79
+ export function matchesGlob(uri, pattern) {
80
+ // Convert glob to regex
81
+ const regexPattern = pattern
82
+ .replace(/\*\*/g, '.*')
83
+ .replace(/\*/g, '[^/]*')
84
+ .replace(/\?/g, '.')
85
+ .replace(/\./g, '\\.');
86
+ const regex = new RegExp(`^${regexPattern}$`);
87
+ return regex.test(uri);
88
+ }
89
+ /**
90
+ * Get the language ID for a file based on extension
91
+ */
92
+ export function getLanguageId(uri) {
93
+ const ext = getFileExtension(uri).toLowerCase();
94
+ const languageMap = {
95
+ ts: 'typescript',
96
+ tsx: 'typescriptreact',
97
+ js: 'javascript',
98
+ jsx: 'javascriptreact',
99
+ py: 'python',
100
+ java: 'java',
101
+ cs: 'csharp',
102
+ php: 'php',
103
+ css: 'css',
104
+ scss: 'scss',
105
+ less: 'less',
106
+ json: 'json',
107
+ yaml: 'yaml',
108
+ yml: 'yaml',
109
+ md: 'markdown',
110
+ html: 'html',
111
+ vue: 'vue',
112
+ svelte: 'svelte',
113
+ };
114
+ return languageMap[ext] ?? 'plaintext';
115
+ }
116
+ /**
117
+ * Check if a document is a supported language
118
+ */
119
+ export function isSupportedLanguage(document) {
120
+ const supportedLanguages = [
121
+ 'typescript',
122
+ 'typescriptreact',
123
+ 'javascript',
124
+ 'javascriptreact',
125
+ 'python',
126
+ 'java',
127
+ 'csharp',
128
+ 'php',
129
+ 'css',
130
+ 'scss',
131
+ 'less',
132
+ 'json',
133
+ 'yaml',
134
+ 'markdown',
135
+ ];
136
+ return supportedLanguages.includes(document.languageId);
137
+ }
138
+ //# sourceMappingURL=document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/utils/document.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAsB,EAAE,KAAY;IACjE,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,QAAsB,EAAE,IAAY;IAC9D,MAAM,SAAS,GAAU;QACvB,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE;QAC7B,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,gBAAgB,EAAE;KAClD,CAAC;IACF,OAAO,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAsB,EACtB,QAAkB;IAElB,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;IAErC,uBAAuB;IACvB,IAAI,KAAK,GAAG,SAAS,CAAC;IACtB,IAAI,GAAG,GAAG,SAAS,CAAC;IAEpB,0CAA0C;IAC1C,OAAO,KAAK,GAAG,CAA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,iBAAiB;QACjB,YAAY;QACZ,iBAAiB;QACjB,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,KAAK;QACL,KAAK;QACL,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,UAAU;KACX,CAAC;IAEF,OAAO,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/utils/workspace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAM7D;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAKnE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAS1E;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAA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Utilities - Workspace helpers
3
+ * @requirements 27.1
4
+ */
5
+ import { URI } from 'vscode-uri';
6
+ // ============================================================================
7
+ // URI Utilities
8
+ // ============================================================================
9
+ /**
10
+ * Convert file path to URI
11
+ */
12
+ export function pathToUri(path) {
13
+ return URI.file(path).toString();
14
+ }
15
+ /**
16
+ * Convert URI to file path
17
+ */
18
+ export function uriToPath(uri) {
19
+ return URI.parse(uri).fsPath;
20
+ }
21
+ /**
22
+ * Get file name from URI
23
+ */
24
+ export function getFileName(uri) {
25
+ const parsed = URI.parse(uri);
26
+ const path = parsed.fsPath;
27
+ return path.split(/[/\\]/).pop() ?? '';
28
+ }
29
+ /**
30
+ * Get file extension from URI
31
+ */
32
+ export function getFileExtension(uri) {
33
+ const fileName = getFileName(uri);
34
+ const parts = fileName.split('.');
35
+ return parts.length > 1 ? parts.pop() ?? '' : '';
36
+ }
37
+ /**
38
+ * Get directory from URI
39
+ */
40
+ export function getDirectory(uri) {
41
+ const parsed = URI.parse(uri);
42
+ const path = parsed.fsPath;
43
+ const parts = path.split(/[/\\]/);
44
+ parts.pop();
45
+ return parts.join('/');
46
+ }
47
+ /**
48
+ * Join URI with path segments
49
+ */
50
+ export function joinUri(base, ...segments) {
51
+ const parsed = URI.parse(base);
52
+ const basePath = parsed.fsPath;
53
+ const joined = [basePath, ...segments].join('/');
54
+ return URI.file(joined).toString();
55
+ }
56
+ /**
57
+ * Get relative path from base URI
58
+ */
59
+ export function getRelativePath(baseUri, targetUri) {
60
+ const basePath = uriToPath(baseUri);
61
+ const targetPath = uriToPath(targetUri);
62
+ if (targetPath.startsWith(basePath)) {
63
+ return targetPath.substring(basePath.length).replace(/^[/\\]/, '');
64
+ }
65
+ return targetPath;
66
+ }
67
+ /**
68
+ * Check if URI is a child of another URI
69
+ */
70
+ export function isChildOf(parentUri, childUri) {
71
+ const parentPath = uriToPath(parentUri);
72
+ const childPath = uriToPath(childUri);
73
+ return childPath.startsWith(parentPath + '/') || childPath.startsWith(parentPath + '\\');
74
+ }
75
+ // ============================================================================
76
+ // Workspace Utilities
77
+ // ============================================================================
78
+ /**
79
+ * Find workspace folder for URI
80
+ */
81
+ export function findWorkspaceFolder(uri, workspaceFolders) {
82
+ for (const folder of workspaceFolders) {
83
+ if (isChildOf(folder.uri, uri) || folder.uri === uri) {
84
+ return folder;
85
+ }
86
+ }
87
+ return undefined;
88
+ }
89
+ /**
90
+ * Get workspace root URI
91
+ */
92
+ export function getWorkspaceRoot(workspaceFolders) {
93
+ return workspaceFolders[0]?.uri;
94
+ }
95
+ /**
96
+ * Check if URI is in workspace
97
+ */
98
+ export function isInWorkspace(uri, workspaceFolders) {
99
+ return findWorkspaceFolder(uri, workspaceFolders) !== undefined;
100
+ }
101
+ /**
102
+ * Get all workspace URIs
103
+ */
104
+ export function getWorkspaceUris(workspaceFolders) {
105
+ return workspaceFolders.map((f) => f.uri);
106
+ }
107
+ // ============================================================================
108
+ // Pattern Matching
109
+ // ============================================================================
110
+ /**
111
+ * Check if URI matches a glob pattern
112
+ */
113
+ export function matchesGlob(uri, pattern) {
114
+ const path = uriToPath(uri);
115
+ const regex = globToRegex(pattern);
116
+ return regex.test(path);
117
+ }
118
+ /**
119
+ * Check if URI matches any of the glob patterns
120
+ */
121
+ export function matchesAnyGlob(uri, patterns) {
122
+ return patterns.some((pattern) => matchesGlob(uri, pattern));
123
+ }
124
+ /**
125
+ * Convert glob pattern to regex
126
+ */
127
+ function globToRegex(glob) {
128
+ const regex = glob
129
+ // Escape special regex characters except * and ?
130
+ .replace(/[.+^${}()|[\]\\]/g, '\\$&')
131
+ // Convert ** to match any path
132
+ .replace(/\*\*/g, '.*')
133
+ // Convert * to match any characters except /
134
+ .replace(/\*/g, '[^/\\\\]*')
135
+ // Convert ? to match single character
136
+ .replace(/\?/g, '.');
137
+ return new RegExp(`^${regex}$`, 'i');
138
+ }
139
+ /**
140
+ * Filter URIs by glob patterns
141
+ */
142
+ export function filterByGlob(uris, includePatterns, excludePatterns = []) {
143
+ return uris.filter((uri) => {
144
+ // Must match at least one include pattern
145
+ if (includePatterns.length > 0 && !matchesAnyGlob(uri, includePatterns)) {
146
+ return false;
147
+ }
148
+ // Must not match any exclude pattern
149
+ if (excludePatterns.length > 0 && matchesAnyGlob(uri, excludePatterns)) {
150
+ return false;
151
+ }
152
+ return true;
153
+ });
154
+ }
155
+ // ============================================================================
156
+ // File Type Utilities
157
+ // ============================================================================
158
+ /**
159
+ * Check if URI is a TypeScript file
160
+ */
161
+ export function isTypeScriptFile(uri) {
162
+ const ext = getFileExtension(uri).toLowerCase();
163
+ return ['ts', 'tsx', 'mts', 'cts'].includes(ext);
164
+ }
165
+ /**
166
+ * Check if URI is a JavaScript file
167
+ */
168
+ export function isJavaScriptFile(uri) {
169
+ const ext = getFileExtension(uri).toLowerCase();
170
+ return ['js', 'jsx', 'mjs', 'cjs'].includes(ext);
171
+ }
172
+ /**
173
+ * Check if URI is a CSS file
174
+ */
175
+ export function isCssFile(uri) {
176
+ const ext = getFileExtension(uri).toLowerCase();
177
+ return ['css', 'scss', 'sass', 'less'].includes(ext);
178
+ }
179
+ /**
180
+ * Check if URI is a JSON file
181
+ */
182
+ export function isJsonFile(uri) {
183
+ const ext = getFileExtension(uri).toLowerCase();
184
+ return ['json', 'jsonc'].includes(ext);
185
+ }
186
+ /**
187
+ * Check if URI is a Markdown file
188
+ */
189
+ export function isMarkdownFile(uri) {
190
+ const ext = getFileExtension(uri).toLowerCase();
191
+ return ['md', 'markdown'].includes(ext);
192
+ }
193
+ /**
194
+ * Check if URI is a configuration file
195
+ */
196
+ export function isConfigFile(uri) {
197
+ const fileName = getFileName(uri).toLowerCase();
198
+ const configPatterns = [
199
+ /^\..*rc$/,
200
+ /^\..*rc\.json$/,
201
+ /^\..*rc\.js$/,
202
+ /^\..*rc\.cjs$/,
203
+ /^\..*rc\.mjs$/,
204
+ /^.*\.config\.(js|ts|json|cjs|mjs)$/,
205
+ /^tsconfig.*\.json$/,
206
+ /^package\.json$/,
207
+ /^\.env.*$/,
208
+ ];
209
+ return configPatterns.some((pattern) => pattern.test(fileName));
210
+ }
211
+ /**
212
+ * Check if URI is a test file
213
+ */
214
+ export function isTestFile(uri) {
215
+ const fileName = getFileName(uri).toLowerCase();
216
+ const testPatterns = [
217
+ /\.test\.(ts|tsx|js|jsx)$/,
218
+ /\.spec\.(ts|tsx|js|jsx)$/,
219
+ /_test\.(ts|tsx|js|jsx)$/,
220
+ /test_.*\.(ts|tsx|js|jsx)$/,
221
+ ];
222
+ return testPatterns.some((pattern) => pattern.test(fileName));
223
+ }
224
+ /**
225
+ * Check if URI should be excluded from scanning
226
+ */
227
+ export function shouldExclude(uri, excludePatterns) {
228
+ // Default exclusions
229
+ const defaultExclusions = [
230
+ '**/node_modules/**',
231
+ '**/dist/**',
232
+ '**/build/**',
233
+ '**/.git/**',
234
+ '**/coverage/**',
235
+ '**/.next/**',
236
+ '**/.nuxt/**',
237
+ ];
238
+ const allPatterns = [...defaultExclusions, ...excludePatterns];
239
+ return matchesAnyGlob(uri, allPatterns);
240
+ }
241
+ //# sourceMappingURL=workspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/utils/workspace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAIjC,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CA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,GAAG,iBAAiB,EAAE,GAAG,eAAe,CAAC,CAAC;IAC/D,OAAO,cAAc,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AAC1C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "driftdetect-lsp",
3
- "version": "0.9.32",
3
+ "version": "0.9.34",
4
4
  "description": "Language Server Protocol implementation for Drift",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -22,6 +22,17 @@
22
22
  "files": [
23
23
  "dist"
24
24
  ],
25
+ "scripts": {
26
+ "build": "tsc",
27
+ "clean": "rm -rf dist",
28
+ "dev": "tsc --watch",
29
+ "lint": "eslint src --ext .ts",
30
+ "lint:fix": "eslint src --ext .ts --fix",
31
+ "test": "vitest run",
32
+ "test:watch": "vitest",
33
+ "test:coverage": "vitest run --coverage",
34
+ "typecheck": "tsc --noEmit"
35
+ },
25
36
  "dependencies": {
26
37
  "driftdetect-core": "^0.9.28",
27
38
  "driftdetect-detectors": "^0.9.28",
@@ -34,16 +45,5 @@
34
45
  "@vitest/coverage-v8": "^1.0.0",
35
46
  "typescript": "^5.3.0",
36
47
  "vitest": "^1.0.0"
37
- },
38
- "scripts": {
39
- "build": "tsc",
40
- "clean": "rm -rf dist",
41
- "dev": "tsc --watch",
42
- "lint": "eslint src --ext .ts",
43
- "lint:fix": "eslint src --ext .ts --fix",
44
- "test": "vitest run",
45
- "test:watch": "vitest",
46
- "test:coverage": "vitest run --coverage",
47
- "typecheck": "tsc --noEmit"
48
48
  }
49
- }
49
+ }
package/LICENSE DELETED
@@ -1,121 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work.
38
-
39
- "Derivative Works" shall mean any work, whether in Source or Object
40
- form, that is based on (or derived from) the Work and for which the
41
- editorial revisions, annotations, elaborations, or other modifications
42
- represent, as a whole, an original work of authorship.
43
-
44
- "Contribution" shall mean any work of authorship, including
45
- the original version of the Work and any modifications or additions
46
- to that Work or Derivative Works thereof, that is intentionally
47
- submitted to the Licensor for inclusion in the Work by the copyright owner.
48
-
49
- "Contributor" shall mean Licensor and any individual or Legal Entity
50
- on behalf of whom a Contribution has been received by Licensor and
51
- subsequently incorporated within the Work.
52
-
53
- 2. Grant of Copyright License. Subject to the terms and conditions of
54
- this License, each Contributor hereby grants to You a perpetual,
55
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
56
- copyright license to reproduce, prepare Derivative Works of,
57
- publicly display, publicly perform, sublicense, and distribute the
58
- Work and such Derivative Works in Source or Object form.
59
-
60
- 3. Grant of Patent License. Subject to the terms and conditions of
61
- this License, each Contributor hereby grants to You a perpetual,
62
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
63
- patent license to make, have made, use, offer to sell, sell, import,
64
- and otherwise transfer the Work.
65
-
66
- 4. Redistribution. You may reproduce and distribute copies of the
67
- Work or Derivative Works thereof in any medium, with or without
68
- modifications, and in Source or Object form, provided that You
69
- meet the following conditions:
70
-
71
- (a) You must give any other recipients of the Work or
72
- Derivative Works a copy of this License; and
73
-
74
- (b) You must cause any modified files to carry prominent notices
75
- stating that You changed the files; and
76
-
77
- (c) You must retain, in the Source form of any Derivative Works
78
- that You distribute, all copyright, patent, trademark, and
79
- attribution notices from the Source form of the Work; and
80
-
81
- (d) If the Work includes a "NOTICE" text file as part of its
82
- distribution, then any Derivative Works that You distribute must
83
- include a readable copy of the attribution notices contained
84
- within such NOTICE file.
85
-
86
- 5. Submission of Contributions. Unless You explicitly state otherwise,
87
- any Contribution intentionally submitted for inclusion in the Work
88
- by You to the Licensor shall be under the terms and conditions of
89
- this License, without any additional terms or conditions.
90
-
91
- 6. Trademarks. This License does not grant permission to use the trade
92
- names, trademarks, service marks, or product names of the Licensor.
93
-
94
- 7. Disclaimer of Warranty. Unless required by applicable law or
95
- agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
96
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
97
-
98
- 8. Limitation of Liability. In no event and under no legal theory,
99
- shall any Contributor be liable to You for damages, including any
100
- direct, indirect, special, incidental, or consequential damages.
101
-
102
- 9. Accepting Warranty or Additional Liability. While redistributing
103
- the Work or Derivative Works thereof, You may choose to offer,
104
- and charge a fee for, acceptance of support, warranty, indemnity,
105
- or other liability obligations.
106
-
107
- END OF TERMS AND CONDITIONS
108
-
109
- Copyright 2025 Geoffrey Fernald
110
-
111
- Licensed under the Apache License, Version 2.0 (the "License");
112
- you may not use this file except in compliance with the License.
113
- You may obtain a copy of the License at
114
-
115
- http://www.apache.org/licenses/LICENSE-2.0
116
-
117
- Unless required by applicable law or agreed to in writing, software
118
- distributed under the License is distributed on an "AS IS" BASIS,
119
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
120
- See the License for the specific language governing permissions and
121
- limitations under the License.