@baseplate-dev/tools 0.1.2 → 0.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baseplate-dev/tools",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Shared dev configurations for linting, formatting, and testing Baseplate projects",
5
5
  "homepage": "https://www.baseplate.dev",
6
6
  "repository": {
@@ -28,38 +28,41 @@ export function srcSubpathImportPlugin(dirname) {
28
28
 
29
29
  return {
30
30
  name: 'custom-src-resolve',
31
- resolveId(id, importer) {
32
- // Only handle #src imports
33
- if (!id.startsWith('#src')) {
34
- return null;
35
- }
31
+ resolveId: {
32
+ order: 'pre',
33
+ handler(id, importer) {
34
+ // Only handle #src imports
35
+ if (!id.startsWith('#src')) {
36
+ return null;
37
+ }
36
38
 
37
- // Skip if no importer (entry point) or importer is in node_modules
38
- if (!importer || importer.includes('node_modules')) {
39
- return null;
40
- }
39
+ // Skip if no importer (entry point) or importer is in node_modules
40
+ if (!importer || importer.includes('node_modules')) {
41
+ return null;
42
+ }
41
43
 
42
- // Check if importer is within the project directory
43
- const resolvedImporter = path.resolve(importer);
44
- const projectRoot = path.resolve(dirname);
44
+ // Check if importer is within the project directory
45
+ const resolvedImporter = path.resolve(importer);
46
+ const projectRoot = path.resolve(dirname);
45
47
 
46
- if (!resolvedImporter.startsWith(projectRoot)) {
47
- return null;
48
- }
48
+ if (!resolvedImporter.startsWith(projectRoot)) {
49
+ return null;
50
+ }
49
51
 
50
- // Replace #src with the actual src path
51
- const basePath = id.replace(/^#src/, srcPath).replace(/\.js$/, '');
52
+ // Replace #src with the actual src path
53
+ const basePath = id.replace(/^#src/, srcPath).replace(/\.js$/, '');
52
54
 
53
- // Try each extension
54
- for (const ext of EXTENSIONS) {
55
- const resolvedPath = basePath + ext;
56
- if (fs.existsSync(resolvedPath)) {
57
- return resolvedPath;
55
+ // Try each extension
56
+ for (const ext of EXTENSIONS) {
57
+ const resolvedPath = basePath + ext;
58
+ if (fs.existsSync(resolvedPath)) {
59
+ return resolvedPath;
60
+ }
58
61
  }
59
- }
60
62
 
61
- // If no extension matches, return the base path
62
- return basePath;
63
+ // If no extension matches, return the base path
64
+ return basePath;
65
+ },
63
66
  },
64
67
  };
65
68
  }