ember-codemod-remove-ember-css-modules 0.1.4 → 0.2.0-alpha.1

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 (53) hide show
  1. package/README.md +6 -1
  2. package/{bin → dist/bin}/ember-codemod-remove-ember-css-modules.js +9 -17
  3. package/{src → dist/src}/index.js +1 -2
  4. package/dist/src/migration/ember-app/index.js +21 -0
  5. package/dist/src/migration/ember-app/steps/analyze-app.js +98 -0
  6. package/dist/src/migration/ember-app/steps/create-options.js +24 -0
  7. package/dist/src/migration/ember-app/steps/import-styles-in-components.js +35 -0
  8. package/dist/src/migration/ember-app/steps/import-styles-in-routes.js +32 -0
  9. package/dist/src/migration/ember-app/steps/move-stylesheets.js +35 -0
  10. package/dist/src/migration/ember-app/steps/shared/import-styles.js +136 -0
  11. package/dist/src/migration/ember-app/steps/shared/update-templates.js +354 -0
  12. package/dist/src/migration/ember-app/steps/update-app-app-js.js +46 -0
  13. package/dist/src/migration/ember-app/steps/update-component-templates.js +22 -0
  14. package/dist/src/migration/ember-app/steps/update-package-json.js +38 -0
  15. package/dist/src/migration/ember-app/steps/update-route-templates.js +18 -0
  16. package/dist/src/types/index.js +1 -0
  17. package/dist/src/utils/blueprints/blueprints-root.js +4 -0
  18. package/dist/src/utils/blueprints/get-version.js +13 -0
  19. package/dist/src/utils/string/ember-cli-string-utils/camelize.js +11 -0
  20. package/dist/src/utils/string/ember-cli-string-utils/classify.js +10 -0
  21. package/{src → dist/src}/utils/string/entity-name/classify.js +1 -2
  22. package/{src → dist/src}/utils/string/entity-name/double-colonize.js +3 -6
  23. package/dist/src/utils/string/entity-name/parse.js +15 -0
  24. package/package.json +30 -25
  25. package/src/migration/ember-app/index.js +0 -37
  26. package/src/migration/ember-app/steps/analyze-app.js +0 -155
  27. package/src/migration/ember-app/steps/create-options.js +0 -44
  28. package/src/migration/ember-app/steps/import-styles-in-components.js +0 -43
  29. package/src/migration/ember-app/steps/import-styles-in-routes.js +0 -39
  30. package/src/migration/ember-app/steps/move-stylesheets.js +0 -51
  31. package/src/migration/ember-app/steps/shared/import-styles.js +0 -210
  32. package/src/migration/ember-app/steps/shared/index.js +0 -2
  33. package/src/migration/ember-app/steps/shared/update-templates.js +0 -438
  34. package/src/migration/ember-app/steps/update-app-app-js.js +0 -65
  35. package/src/migration/ember-app/steps/update-component-templates.js +0 -28
  36. package/src/migration/ember-app/steps/update-package-json.js +0 -59
  37. package/src/migration/ember-app/steps/update-route-templates.js +0 -22
  38. package/src/utils/abstract-syntax-tree/handlebars.js +0 -20
  39. package/src/utils/abstract-syntax-tree/javascript.js +0 -103
  40. package/src/utils/abstract-syntax-tree.js +0 -2
  41. package/src/utils/blueprints/blueprints-root.js +0 -8
  42. package/src/utils/blueprints/get-version.js +0 -16
  43. package/src/utils/string/ember-cli-string-utils/camelize.js +0 -12
  44. package/src/utils/string/ember-cli-string-utils/classify.js +0 -14
  45. package/src/utils/string/entity-name/parse.js +0 -19
  46. /package/{src/blueprints → blueprints}/ember-cli/component/javascript.js +0 -0
  47. /package/{src/blueprints → blueprints}/ember-cli/component/typescript.ts +0 -0
  48. /package/{src/blueprints → blueprints}/ember-cli/controller/javascript.js +0 -0
  49. /package/{src/blueprints → blueprints}/ember-cli/controller/typescript.ts +0 -0
  50. /package/{src → dist/src}/migration/ember-app/steps/index.js +0 -0
  51. /package/{src → dist/src}/migration/index.js +0 -0
  52. /package/{src → dist/src}/utils/blueprints.js +0 -0
  53. /package/{src → dist/src}/utils/string.js +0 -0
@@ -1,103 +0,0 @@
1
- import { parse as babelParser } from '@babel/parser';
2
- import { parse, print, types, visit } from 'recast';
3
-
4
- /* https://github.com/benjamn/recast/blob/v1.4.0/lib/options.ts */
5
- const formattingOptions = {
6
- quote: 'single',
7
- };
8
-
9
- /* https://github.com/facebook/jscodeshift/blob/v0.14.0/parser/babel5Compat.js */
10
- const jsOptions = {
11
- sourceType: 'module',
12
- allowHashBang: true,
13
- ecmaVersion: Infinity,
14
- allowImportExportEverywhere: true,
15
- allowReturnOutsideFunction: true,
16
- startLine: 1,
17
- tokens: true,
18
- plugins: [
19
- 'estree',
20
- 'jsx',
21
- 'asyncGenerators',
22
- 'classProperties',
23
- 'doExpressions',
24
- 'exportExtensions',
25
- 'functionBind',
26
- 'functionSent',
27
- 'objectRestSpread',
28
- 'dynamicImport',
29
- 'nullishCoalescingOperator',
30
- 'optionalChaining',
31
- [
32
- 'decorators',
33
- {
34
- decoratorsBeforeExport: false,
35
- },
36
- ],
37
- ],
38
- };
39
-
40
- /* https://github.com/facebook/jscodeshift/blob/v0.14.0/parser/tsOptions.js */
41
- const tsOptions = {
42
- sourceType: 'module',
43
- allowImportExportEverywhere: true,
44
- allowReturnOutsideFunction: true,
45
- startLine: 1,
46
- tokens: true,
47
- plugins: [
48
- 'asyncGenerators',
49
- 'bigInt',
50
- 'classPrivateMethods',
51
- 'classPrivateProperties',
52
- 'classProperties',
53
- 'decorators-legacy',
54
- 'doExpressions',
55
- 'dynamicImport',
56
- 'exportDefaultFrom',
57
- 'exportExtensions',
58
- 'exportNamespaceFrom',
59
- 'functionBind',
60
- 'functionSent',
61
- 'importMeta',
62
- 'nullishCoalescingOperator',
63
- 'numericSeparator',
64
- 'objectRestSpread',
65
- 'optionalCatchBinding',
66
- 'optionalChaining',
67
- ['pipelineOperator', { proposal: 'minimal' }],
68
- 'throwExpressions',
69
- 'typescript',
70
- ],
71
- };
72
-
73
- function getParseOptions(hasTypeScript) {
74
- const options = hasTypeScript ? tsOptions : jsOptions;
75
-
76
- return {
77
- parser: {
78
- parse(file) {
79
- return babelParser(file, options);
80
- },
81
- },
82
- };
83
- }
84
-
85
- function traverse(hasTypeScript) {
86
- return function (file, visitMethods) {
87
- const ast = parse(file, getParseOptions(hasTypeScript));
88
-
89
- visit(ast, visitMethods);
90
-
91
- return ast;
92
- };
93
- }
94
-
95
- const tools = {
96
- builders: types.builders,
97
- print(ast) {
98
- return print(ast, formattingOptions).code;
99
- },
100
- traverse,
101
- };
102
-
103
- export default tools;
@@ -1,2 +0,0 @@
1
- export { default as ASTHandlebars } from './abstract-syntax-tree/handlebars.js';
2
- export { default as ASTJavaScript } from './abstract-syntax-tree/javascript.js';
@@ -1,8 +0,0 @@
1
- import { join } from 'node:path';
2
-
3
- import { getFilePath } from '@codemod-utils/blueprints';
4
-
5
- const fileURL = import.meta.url;
6
- const srcDirectory = join(getFilePath(fileURL), '../..');
7
-
8
- export const blueprintsRoot = join(srcDirectory, 'blueprints');
@@ -1,16 +0,0 @@
1
- import { decideVersion } from '@codemod-utils/blueprints';
2
-
3
- const latestVersions = new Map([
4
- ['embroider-css-modules', '0.1.1'],
5
- ['type-css-modules', '0.1.1'],
6
- ['webpack', '5.81.0'],
7
- ]);
8
-
9
- export function getVersion(packageName, options) {
10
- const { project } = options;
11
-
12
- return decideVersion(packageName, {
13
- dependencies: project.dependencies,
14
- latestVersions,
15
- });
16
- }
@@ -1,12 +0,0 @@
1
- /* https://github.com/ember-cli/ember-cli-string-utils/blob/v1.1.0/index.js */
2
- const STRING_CAMELIZE_REGEXP = /(-|_|\.|\s)+(.)?/g;
3
-
4
- export function camelize(string) {
5
- return string
6
- .replace(STRING_CAMELIZE_REGEXP, function (_match, _separator, character) {
7
- return character ? character.toUpperCase() : '';
8
- })
9
- .replace(/^([A-Z])/, function (match) {
10
- return match.toLowerCase();
11
- });
12
- }
@@ -1,14 +0,0 @@
1
- /* https://github.com/ember-cli/ember-cli-string-utils/blob/v1.1.0/index.js */
2
- import { camelize } from './camelize.js';
3
-
4
- export function classify(string) {
5
- const tokens = string.split('.');
6
-
7
- const tokensTransformed = tokens.map((token) => {
8
- const camelized = camelize(token);
9
-
10
- return camelized.charAt(0).toUpperCase() + camelized.substring(1);
11
- });
12
-
13
- return tokensTransformed.join('.');
14
- }
@@ -1,19 +0,0 @@
1
- import { parse } from 'node:path';
2
-
3
- import { classifyEntityName } from './classify.js';
4
- import { doubleColonizeEntityName } from './double-colonize.js';
5
-
6
- export function parseEntityName(entityName) {
7
- const classifiedName = classifyEntityName(entityName);
8
- const doubleColonizedName = doubleColonizeEntityName(entityName);
9
- const { name: fileName } = parse(entityName);
10
-
11
- const entity = {
12
- classifiedName,
13
- doubleColonizedName,
14
- fileName,
15
- name: entityName,
16
- };
17
-
18
- return entity;
19
- }
File without changes
File without changes
File without changes